Set the Instant Pot to 'Sauté' mode. Melt the butter in the pot.
Add the sliced onions and sprinkle with salt and sugar. Stir frequently for about 10-12 minutes until the onions are caramelized and golden brown.
Add the minced garlic and sauté for an additional 1 minute until fragrant.
Pour in the white wine (if using), scraping any bits off the bottom of the pot. Allow to simmer for about 2-3 minutes.
Add the beef broth, thyme, bay leaf, and pepper. Stir to combine.
Close the Instant Pot lid and set it to 'Manual' or 'Pressure Cook' for 10 minutes.
Once the cooking time is complete, do a quick release of pressure.
Remove the bay leaf and taste for seasoning, adding more salt or pepper if needed.
Preheat your broiler. Ladle the soup into oven-safe bowls, top with a slice of French bread, and sprinkle with Gruyère cheese.
Place the bowls under the broiler for 2-4 minutes, or until the cheese is bubbly and golden.