Knowledge graphs (KGs) such as Wikidata serve as the foundational structure for modern AI applications, including search engines and recommendation systems. However, the construction of these graphs is traditionally a labor-intensive process, requiring extensive human verification or complex, supervised extraction algorithms. This "knowledge bottleneck" limits the scalability and up-to-date nature of structured knowledge bases.
In the paper "Language Models are Open Knowledge Graphs," researchers from UC Berkeley and Tsinghua University propose a paradigm shift. They explore whether pre-trained language models (LMs) like BERT or GPT-2, which implicitly store vast amounts of world knowledge in their numerical weights, can be used as "zero-shot" knowledge extractors without any human supervision or additional training.
The MAMA Framework: Match and Map
To address this, the authors introduced MAMA (Match and Map), an unsupervised method designed to extract factual knowledge directly from the internal mechanisms of pre-trained LMs. The pipeline consists of two primary stages:
- Match Stage: This stage identifies factual relationships by analyzing the model's attention matrices. For a given sentence, MAMA identifies "head" and "tail" entities using a standard noun-chunker. It then performs a beam search through the attention weights to find the most "attended-to" path of tokens connecting these entities. This path is interpreted as the "relation" between them. Crucially, this process requires no fine-tuning or labeled examples.
- Map Stage: Extracted candidate triplets are then processed to align with a fixed schema, such as Wikidata. Facts that do not fit the existing schema but appear high-quality are retained in an "open schema." This results in an Open KG—a hybrid graph that combines standardized data with newly discovered, unstructured facts.
Experimental Results and Insights
The researchers evaluated MAMA using benchmarks like TAC KBP and Wikidata, running extractions over English Wikipedia. Several key insights emerged:
- Attention as Knowledge: Factual relationships are physically represented in the attention patterns of LMs, allowing them to be mathematically decoded.
- Model Performance: BERT-style models (bidirectional) often outperformed GPT-style models (autoregressive) of similar sizes, likely due to their superior ability to link entities within a sentence. However, performance scales with model size; MAMA-GPT-2XL achieved the highest overall scores.
- Superior Precision: MAMA achieved over 60% precision on the TAC KBP task, outperforming traditional open information extraction systems like Stanford OpenIE.
One of the most significant findings was MAMA's ability to discover "long-tail" knowledge missing from human-curated databases. Manual audits revealed that MAMA correctly identified specific residences and professional milestones for figures like Bob Dylan that were not yet present in Wikidata.
Limitations and Future Directions
While MAMA demonstrates high precision, its recall remains relatively low, and it is dependent on the accuracy of external entity detection tools like spaCy. Future work aims to explore "lifelong learning" capabilities, where models continuously update their internal KGs, and to scale the method to massive models like GPT-4 or Megatron-LM.
By transforming the "black box" of language models into a transparent, structured knowledge graph, MAMA bridges the gap between connectionist AI and symbolic logic, offering a scalable path toward more comprehensive and automated knowledge representation.
Summary updated