Metabolomic studies have succeeded in identifying small molecule metabolites that mediate cell signaling, competition, and disease pathology in part due to large-scale community efforts to measure mass spectra for thousands of metabolite standards. Nevertheless, the vast majority of spectra observed in clinical samples cannot be unambiguously matched to known structures, suggesting powerful opportunities for further discoveries in the dark metabolome. Deep learning approaches to small molecule structure elucidation have surprisingly failed to rival classical statistical methods, which we hypothesize is due to the lack of in-domain knowledge incorporated into current neural network architectures. We introduce a new neural network driven workflow for untargeted metabolomics, Metabolite Inference with Spectrum Transformers (MIST), to annotate mass spectrometry peaks with chemical structures generalizing beyond known standards. Unlike other neural approaches, MIST incorporates domain insights into its architecture by forcing the network to more directly link peaks to physical atom representations, neutral losses, and chemical substructures. MIST outperforms both standard neural architectures and the state-of-the-art kernel method on fingerprint prediction from spectra for over 70% of metabolite standards and retrieves over 66% of metabolites with equal or improved accuracy, with 29% strictly better. We further demonstrate the utility of MIST in a prospective setting to identify new differentially abundant metabolite structures from an inflammatory bowel disease patient cohort and subsequently annotate dipeptides and alkaloid compounds without spectral standards.