1Heat the oven to 425°F and arrange a rack in the middle. Coat an 8-by-8-inch baking dish with butter; set aside.
2Place the walnuts and brown sugar in a small bowl and stir until combined; set aside.
3Peel the sweet potatoes. Using a mandoline or a very sharp knife, slice into even 1/8-inch-thick rounds; set aside.
4Place the remaining ingredients in a large saucepan over medium-low heat, stirring until the butter has melted and the mixture is combined. Remove from heat, add the sweet potato slices, and stir until evenly coated. Taste a sweet potato and add more salt and pepper as needed.
5Place half of the potato slices in an even layer in the prepared dish, overlapping as needed. Sprinkle with half of the walnut–brown sugar mixture. Place the remaining sweet potato slices in the dish, along with any remaining juices from the saucepan. Sprinkle with the remaining walnut–brown sugar mixture.
6Cover with aluminum foil and bake for 20 minutes. Remove the foil, rotate the dish, and cook until the top is browned and the sweet potatoes are tender when pierced with a fork, about 20 to 25 minutes more.