Metadata Enhancement Using Large Language Models

Hyunju Song, Steven Bethard, Andrea K. Thomer2024

TL;DR

Researchers have developed a high-accuracy workflow using Large Language Models (LLMs) to automatically fill in missing metadata for physical scientific samples, such as rocks and fossils. By combining few-shot prompting with a "bottom-up" approach to navigating complex classification taxonomies, they achieved an impressive F1 score of 0.928, significantly outperforming traditional machine learning baselines.

What Problem Does This Paper Address?

In the natural sciences, "physical sample records" are the digital fingerprints of specimens like sediment cores, minerals, or fossils. These records are vital for reproducible research and resource discovery. However, they are notoriously incomplete—often due to data entry errors or mismatches when merging databases. For example, in the SESAR2 Earth science repository, a staggering 78% of records (over 3.5 million) are missing the "MATERIAL" metadata field.

Manually fixing millions of records is impossible. While traditional automated methods exist, they often struggle with the specialized, hierarchical language of science. This paper investigates whether LLMs can bridge this gap by "reading" the available messy text in a record to infer the missing categorical labels.

Methods

The authors treated metadata assignment as a hierarchical multi-label text classification problem. They tested three 7-billion parameter models: Llama-2-7B-chat, Mistral-7B-Instruct, and Mistral-7B-OpenOrca.

Key innovations in their approach include:

  • Input Transformation: They compared different ways to present record data to the LLM, finding that "verbose" inputs (including full descriptions of what each metadata field means) worked best.
  • Summarize & Explain: They tested a two-step process where the LLM first summarizes the messy record and explains domain-specific terms before attempting to classify it.
  • Taxonomy Traversal: Instead of just picking a label from a flat list, they explored how to use the hierarchical nature of scientific categories. They found that a Bottom-Up approach—predicting the most specific "leaf" label first and then inferring the broader parent categories—was far more effective than the traditional Top-Down approach.
  • Few-Shot Prompting with kNN: To improve accuracy, they used a k-Nearest Neighbor (kNN) strategy to find the most similar existing records in their training set and included them as examples in the LLM's prompt.

Datasets

The study utilized records from the SESAR2 (System for Earth Sample Registration) repository, which is part of the iSamples (Internet of Samples) project.

  • Focus: Earth science specimens (rocks, fossils, fluids).
  • Scale: They started with nearly 1 million records that did have material labels to use for training and testing. After balancing the dataset to ensure rare labels were represented, they used a training set of ~294,000 records and a test set of ~63,000 records.
  • Taxonomy: The iSamples MATERIAL type taxonomy, which includes complex hierarchies (e.g., Basalt is a type of Fine-grained igneous rock, which is an Igneous rock, which is a Material).

Key Insights and Ideas

  • Bottom-Up is Better: In many NLP tasks, top-down (general to specific) is the standard. Here, bottom-up won. The authors suspect this is because the "root" nodes in scientific taxonomies (like "any anthropogenic material") are often vague and confusing for LLMs, whereas specific "leaf" nodes (like "Basalt") are distinct and well-represented in the models' pre-training data.
  • Context Matters: LLMs performed better when the prompt included the description of the metadata field (e.g., "The type of platform for the cruise is...") rather than just the field name. This suggests LLMs leverage their "natural language" understanding more effectively when the input looks like a sentence rather than a database entry.
  • The Power of Few-Shot: Providing just 3 to 5 relevant examples in the prompt allowed the LLM to leapfrog past a fine-tuned RoBERTa model (0.928 vs 0.721 F1). This highlights the efficiency of LLMs for specialized domains where massive fine-tuning might be computationally expensive.

Key Results

  • Top Performance: The Mistral-7B-OpenOrca model, using few-shot prompting and bottom-up taxonomy traversal, achieved the highest Macro F1 score of 0.928.
  • Zero-Shot vs. Few-Shot: Moving from zero-shot (no examples) to few-shot (5 examples) saw F1 scores jump from roughly 0.44 to over 0.92.
  • Baseline Comparison: The LLM approach significantly outperformed traditional baselines like Multinomial Naive Bayes (0.652) and even a fine-tuned RoBERTa-Large model (0.721). It even beat a specialized k-Nearest Neighbor classifier (0.844).

Limitations and Future Work

  • Institutional Bias: The authors found that models perform better on records from institutions they have already "seen" in the training data. When tested on entirely new institutions, performance dropped, suggesting the models might be picking up on specific formatting quirks of certain labs.
  • Model Size: The study was limited to 7B parameter models. Larger models (like GPT-4 or Llama-3 70B) or science-specific models (like Galactica) might yield even better results.
  • Domain Scope: The current work is focused on Earth science. Future work is needed to see if these "bottom-up" strategies hold true for other complex fields like archaeology or biology.

Summary updated

Abstract

In the natural sciences, a common form of scholarly document is a physical sample record, which provides categorical and textual metadata for specimens collected and analyzed for scientific research.Physical sample archives like museums and repositories publish these records in data repositories to support reproducible science and enable the discovery of physical samples.However, the success of resource discovery in such interfaces depends on the completeness of the sample records.We investigate approaches for automatically completing the scientific metadata fields of sample records.We apply large language models in zero and few-shot settings and incorporate the hierarchical structure of the taxonomy.We show that a combination of record summarization, bottom-up taxonomy traversal, and fewshot prompting yield an F1 score as high as 0.928 on metadata completion in the Earth science domain.
BibTeX
@misc{song2024metadata,
  author = {Hyunju Song and Steven Bethard and Andrea K. Thomer},
  title = {{Metadata Enhancement Using Large Language Models}},
  year = {2024},
  doi = {10.18653/v1/2024.sdp-1.14},
}
Figure