Preheat the oven to 350°F and lightly grease a 9x13-inch baking dish.
In a large mixing bowl, mash the cooked sweet potatoes to your desired consistency.
Add the melted butter, brown sugar, vanilla, cinnamon, salt, and nutmeg.
Mix until everything is well combined.
Spread the sweet potato mixture evenly into the prepared baking dish.
In a separate bowl, combine the chopped pecans, flour, brown sugar, salt, and melted butter.
Stir until the mixture is evenly coated and crumbly.
Evenly spoon the pecan topping over the sweet potato mixture.
If using marshmallows, sprinkle them over the top.
Bake uncovered on the center rack for 20-35 minutes, or until the topping is golden brown and the casserole is heated through.
If using marshmallows, keep an eye on them to prevent over-browning.