Abstract
Extracting structured knowledge from scientific text remains a challenging task for machine learning models. Here, we present a simple approach to joint named entity recognition and relation extraction and demonstrate how pretrained large language models (GPT-3, Llama-2) can be fine-tuned to extract useful records of complex scientific knowledge. We test three representative tasks in materials chemistry: linking dopants and host materials, cataloging metal-organic frameworks, and general composition/phase/morphology/application information extraction. Records are extracted from single sentences or entire paragraphs, and the output can be returned as simple English sentences or a more structured format such as a list of JSON objects. This approach represents a simple, accessible, and highly flexible route to obtaining large databases of structured specialized scientific knowledge extracted from research papers.
Introduction
The rapid growth of scientific literature has created a bottleneck: millions of papers contain experimental data trapped in unstructured text. To build searchable databases or train models for materials discovery, this knowledge must be extracted into structured formats. Traditionally, Natural Language Processing (NLP) addresses this through a two-step pipeline: Named Entity Recognition (NER) to identify entities (e.g., "LiCoO2") and Relation Extraction (RE) to link them. However, scientific relationships are often complex, hierarchical, and n-ary, involving multiple intertwined entities that traditional pipelines struggle to capture accurately.
Methods: LLM-NERRE
The authors propose LLM-NERRE (Joint Named Entity Recognition and Relation Extraction), an end-to-end sequence-to-sequence approach. Instead of multi-step pipelines, information extraction is treated as a translation task. Pre-trained Large Language Models (LLMs), specifically GPT-3 and Llama-2, are fine-tuned to read raw text and output a structured "summary" of the knowledge.
The model can output data as simple English sentences or, more powerfully, as nested JSON objects. This allows for the direct mapping of unstructured text into database-ready formats without custom parsing logic. To accelerate data labeling, a "human-in-the-loop" process was used where a partially trained LLM pre-annotates text for expert correction.
Datasets and Evaluation
Three custom datasets were developed from over 8 million materials science abstracts:
- Solid-state impurity doping: Extracting host materials, dopants, and modifiers.
- Metal-organic frameworks (MOFs): Extracting chemical formulae, guest species, and applications.
- General materials information: Extracting inorganic materials, acronyms, phase labels, and descriptions.
Key Results
The fine-tuned Llama-2 model achieved an exact-match F1 score of 0.821 on the host-dopant task, significantly outperforming baselines like MatBERT-Proximity (F1 = 0.390). In the complex General Materials task, manual expert scoring revealed even higher performance, with GPT-3 reaching F1 scores of 0.943 for chemical formulas and 0.832 for applications.
Beyond raw accuracy, the models demonstrated "implicit normalization," naturally correcting typos and standardizing chemical formulas (e.g., "Li Co O2" to "LiCoO2") during extraction. Furthermore, the human-in-the-loop approach reduced annotation time by approximately 60%.
Discussion and Future Work
While highly effective, the approach faces limitations regarding token context windows and occasional "hallucinations" of plausible but absent information. However, as context windows expand and open-source models like Llama-2 become more efficient through quantization, self-hosted LLM extraction offers a scalable, private, and accessible route for scientists to build specialized knowledge bases.
Summary updated