Abstract
Language models (LMs) have made remarkable progress, but still struggle to generalize beyond the training data to rare linguistic patterns. Since rare entities and facts are prevalent in the queries users submit to popular applications such as search and personal assistant systems, improving the ability of LMs to reliably capture knowledge over rare entities is a pressing challenge. Noticing that existing approaches primarily modify the LM architecture or introduce auxiliary objectives to inject useful entity knowledge, we ask to what extent we could match the quality of these architectures using a base LM architecture, and only changing the data? We propose metadata shaping, a method in which readily available metadata, such as entity descriptions and categorical tags, are appended to examples based on information theoretic metrics. On standard entity-rich tasks (TACRED, FewRel, OpenEntity), with no changes to the LM whatsoever, metadata shaping exceeds the BERT-baseline by up to 5.3 F1 points, and achieves or competes with state-of-the-art results. We further show the improvements are up to 10x larger on examples containing tail versus popular entities.
Introduction
Modern language models are incredibly capable, yet they suffer from a significant "tail" problem: they struggle with rare linguistic patterns and entities. While a model might possess extensive knowledge about a popular entity like "Barack Obama," it often falters when processing queries regarding rare entities like "Daniel Dugléry." This gap is critical for real-world applications like search engines and personal assistants where niche facts are frequently queried.
Historically, the research community has favored "model engineering"—modifying architectures, adding specialized modules, or introducing complex auxiliary training objectives to inject knowledge. However, these methods are computationally expensive and difficult to maintain. Metadata shaping offers a provocative alternative: can we achieve state-of-the-art results by simply changing the input data instead of the model?
The Metadata Shaping Framework
Metadata shaping modifies the input data at both train and test time through a three-step process:
- Metadata Retrieval: For any given entity in a sentence, the system retrieves metadata from knowledge bases like Wikidata, including categorical tags (e.g., "politician") and short natural language descriptions.
- Information-Theoretic Selection: To ensure only helpful metadata is used, the authors employ an algorithm based on Pointwise Mutual Information (PMI) and Entropy to rank and select "class-discriminative" tokens that most effectively reduce model uncertainty.
- Data Augmentation: These selected tokens are appended to the original input sentence, often demarcated by special boundary tokens to help the model distinguish between original text and metadata.
Crucially, this method requires zero changes to the underlying model architecture, such as a standard BERT-base.
Experimental Results
The researchers evaluated metadata shaping on three standard entity-rich benchmarks: TACRED (relation extraction), FewRel (few-shot relation extraction), and OpenEntity (entity typing). Metadata was sourced from Wikidata and Wikipedia.
As shown in the results below, metadata shaping significantly outperforms the BERT-base baseline and remains competitive with—or exceeds—complex, knowledge-aware models like ERNIE and KnowBERT.
Key Findings
- Performance Gains: Metadata Shaping improved the BERT-base baseline by 5.3 F1 points on FewRel, 4.3 on TACRED, and 3.0 on OpenEntity.
- Tail Generalization: The most striking result was the concentration of improvements on the "tail." For entities seen fewer than 10 times during training, the performance gain was up to 10x larger than the gain seen on popular entities.
- Explainability: By analyzing attention weights, the researchers found that the model explicitly focuses on useful metadata tokens (like "politician" or "commune") when making predictions, providing a layer of interpretability often missing in model-based knowledge injection.
Conclusion
Metadata shaping demonstrates that "data engineering" can be a viable, lower-cost alternative to increasingly complex model architectures. By explicitly encoding shared properties through natural language metadata, models can reason about rare entities using patterns learned from similar, more popular ones. While the method currently depends on external knowledge base coverage, it opens a promising path for making large language models more robust on the long tail of human knowledge.
Summary updated