Melt the butter in the Instant Pot on the sauté setting. Add the onions and stir to coat with the butter.
Switch the Instant Pot to the pressure setting and cook on high for 20 minutes. Use the quick release to release the pressure.
Turn the Instant Pot to sauté and cook for about 15 minutes, stirring occasionally, until onions start to turn brown and much of the liquid has evaporated.
Add the garlic, sherry, beef broth, bay leaf, thyme, salt and pepper. Pressure cook on high for 10 minutes.
Use the quick release to release the pressure.
While the soup is cooking, slice the baguette into 1 inch slices.
Ladle the soup into individual oven proof crocks.
Place 1-2 slices of bread over the soup and sprinkle with about ⅛ cup of the grated Gruyere.
Place under the broiler until the cheese is melted and browned, about 2-3 minutes. Be sure to watch it under the broiler to ensure it doesn't burn. All broilers act a little different.
Notes
Adjust salt to taste. Depending on the beef broth you use, it may contain more sodium than others. The recipe calls for a minimal amount of salt, but you will likely need to adjust it if using unsalted/low sodium broth.
Keep a close eye on the soup while broiling to ensure it doesn't burn.
Make sure you use ovenproof dishes when broiling the soup.