Melt the butter in the Instant Pot on the saute 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 saute 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 1/8 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.