time-to-onset analyses suggested that most miscarriages occurred within 2 years after drug exposure, with marked heterogeneity in risk timing across agents; anti-Tumor Necrosis Factor-alpha drugs (TNF-α) exhibited a higher early risk.<h4>Conclusion</h4>Machine learning and SHAP interpretability analysis based on the FAERS database effectively identified immunomodulators, antiviral drugs, and psychiatric/neuropsychiatric medications as potential risk signals associated with miscarriage. This evidence concerns the gene TNF and Miscarriage.