Preheat oven to 375°F and butter a 9×9-inch baking dish. Peel and slice sweet potatoes into 1/8-inch rounds using a mandoline or sharp knife.
2 lb sweet potatoes, 2 tbsp unsalted butter
In a medium saucepan over medium heat, melt butter and whisk in flour until bubbly and fragrant, about 1 minute.
2 tbsp unsalted butter, 2 tbsp all-purpose flour
Slowly pour in milk and cream, whisking until the sauce is glossy and coats the back of a spoon, 3–5 minutes. Remove from heat and stir in salt, pepper, and nutmeg.
1 cup whole milk, 1 cup heavy cream, 1 tsp salt, 0.25 tsp black pepper, 0.125 tsp ground nutmeg
Arrange one-third of the sweet potato slices in the dish, drizzle one-third of the sauce, then sprinkle one-third of each cheese. Repeat two more times for three layers total.
2 lb sweet potatoes, 0.5 cup gruyère cheese, 0.5 cup parmesan cheese
Bake until the top is golden and bubbling around the edges, 40–45 minutes. Let stand for 5–10 minutes before serving.