Preheat your oven to 350°F (175°C).
Boil the peeled and cubed sweet potatoes in a large pot of water until fork-tender, about 15 minutes.
Drain and mash the sweet potatoes until smooth.
Stir in the brown sugar, melted butter, eggs, vanilla extract, cinnamon, nutmeg, and a pinch of salt until fully combined.
Spread the sweet potato mixture evenly into a greased 9x13-inch casserole dish.
In a small bowl, mix the chopped pecans, brown sugar, flour, and melted butter for the topping.
Sprinkle the pecan mixture evenly over the sweet potatoes.
If using marshmallows, sprinkle them on top of the pecan mixture in an even layer before baking. For a golden finish, keep an eye on the marshmallows as they toast during the last few minutes of baking.
Bake for 25–30 minutes, or until the topping is golden and bubbling.
Let the casserole cool for a few minutes before serving.