Preheat oven to 350 F. Toss the 25 unpeeled garlic cloves with 2 teaspoons olive oil in a small baking dish, cover and roast for about 30 minutes until soft and golden brown. When the cloves are cool enough to handle, squeeze each one to remove the roasted garlic from its skin.
While the first half of the garlic cloves roast, mince the other 25 peeled garlic cloves and allow them to sit at least 10 minutes before cooking.
In a pressure cooker, heat 2 tablespoons olive oil or butter over medium heat (with Instant Pot, choose "Saute" and keep the default heat setting). Add the chopped onion and cook until soft, about 4-5 minutes, then stir in the minced raw garlic and roasted garlic cloves. Drain the white beans of their soaking water, and add them to the pot along with the broth, rosemary and salt.
Cover the pressure cooker with the lid, ensuring that the valve is in sealed position. Cook under high pressure for 20 minutes (with Instant Pot, choose ‘Manual’ mode, and adjust time to 20 minutes).
When the cooking time is complete, allow the pot to de-pressurize naturally for at least 10 minutes before opening the lid. Puree the soup with an immersion blender until smooth, then check and adjust seasoning if needed.