Preheat the oven to 400ºF and grease a 9x13-inch casserole dish.
Prepare the sweet potatoes by using a mandolin to slice them into uniform rounds. A 1.3mm or 2mm thickness works for this recipe. Try to avoid thicker potato slices. Set the potatoes aside.
Prepare the au gratin sauce. Melt butter in a large skillet over medium/high heat. When the butter is melted, add the onion and ¼ teaspoon of salt. Saute for 3-4 minutes. Add the garlic and saute until fragrant, about 1 minute.
Add the flour, pepper, and fresh thyme to the skillet and mix with the ingredients until it turns into a paste. Cook the mixture for at least 1 minute.
Turn the heat to medium heat and slowly add the milk to the skillet, whisking constantly so the milk doesn’t burn. Once all the milk has been added, it should thicken quickly.
Slowly add the broth to the skillet, whisking to combine and thicken.
Remove the mixture from the heat and add the parmesan and gruyere cheese a little bit at a time, whisking vigorously until melted. The mixture should be smooth (except for the onion and garlic) and thick.
Add 1 cup of cheese sauce to the bottom of the 9x13-inch dish. Spread it out evenly. Place the sweet potato rounds, skin side up, into the dish. The sweet potatoes should fill the entire dish.
Pour the remaining sauce evenly over the potatoes. Use a spatula to push the sauce down and in between the potatoes.
Lastly, spread the Ritz cracker crumbs over the top of the potatoes and cover the casserole dish.
Bake for 30 minutes covered and 30 minutes uncovered.
Remove from the oven and let the potatoes rest for 10 minutes before serving. Top with the remaining fresh thyme.