Table of Contents
Fetching ...

Crawling the Internal Knowledge-Base of Language Models

Roi Cohen, Mor Geva, Jonathan Berant, Amir Globerson

TL;DR

This work introduces LMCRAWL, a prompt-driven framework to extract a readable knowledge graph from a language model's internal knowledge, starting from a seed entity and expanding to depth-2. By decomposing the task into relation generation, object generation, subject/paraphrasing, and a dedicated Don't Know mechanism, the method achieves high precision (82-92%) while maintaining reasonable graph sizes. The study systematically analyzes ablations, paraphasing, and DK effects, and demonstrates that recall can be boosted via paraphrasing without severely compromising precision. Results on GPT-3 show that seed-driven KG extraction is viable and that popular entities yield richer, more reliable graphs, with automatic evaluation complemented by manual checks. The work highlights both the potential and the practical challenges of turning large language models into interpretable, navigable knowledge bases.

Abstract

Language models are trained on large volumes of text, and as a result their parameters might contain a significant body of factual knowledge. Any downstream task performed by these models implicitly builds on these facts, and thus it is highly desirable to have means for representing this body of knowledge in an interpretable way. However, there is currently no mechanism for such a representation. Here, we propose to address this goal by extracting a knowledge-graph of facts from a given language model. We describe a procedure for ``crawling'' the internal knowledge-base of a language model. Specifically, given a seed entity, we expand a knowledge-graph around it. The crawling procedure is decomposed into sub-tasks, realized through specially designed prompts that control for both precision (i.e., that no wrong facts are generated) and recall (i.e., the number of facts generated). We evaluate our approach on graphs crawled starting from dozens of seed entities, and show it yields high precision graphs (82-92%), while emitting a reasonable number of facts per entity.

Crawling the Internal Knowledge-Base of Language Models

TL;DR

This work introduces LMCRAWL, a prompt-driven framework to extract a readable knowledge graph from a language model's internal knowledge, starting from a seed entity and expanding to depth-2. By decomposing the task into relation generation, object generation, subject/paraphrasing, and a dedicated Don't Know mechanism, the method achieves high precision (82-92%) while maintaining reasonable graph sizes. The study systematically analyzes ablations, paraphasing, and DK effects, and demonstrates that recall can be boosted via paraphrasing without severely compromising precision. Results on GPT-3 show that seed-driven KG extraction is viable and that popular entities yield richer, more reliable graphs, with automatic evaluation complemented by manual checks. The work highlights both the potential and the practical challenges of turning large language models into interpretable, navigable knowledge bases.

Abstract

Language models are trained on large volumes of text, and as a result their parameters might contain a significant body of factual knowledge. Any downstream task performed by these models implicitly builds on these facts, and thus it is highly desirable to have means for representing this body of knowledge in an interpretable way. However, there is currently no mechanism for such a representation. Here, we propose to address this goal by extracting a knowledge-graph of facts from a given language model. We describe a procedure for ``crawling'' the internal knowledge-base of a language model. Specifically, given a seed entity, we expand a knowledge-graph around it. The crawling procedure is decomposed into sub-tasks, realized through specially designed prompts that control for both precision (i.e., that no wrong facts are generated) and recall (i.e., the number of facts generated). We evaluate our approach on graphs crawled starting from dozens of seed entities, and show it yields high precision graphs (82-92%), while emitting a reasonable number of facts per entity.
Paper Structure (33 sections, 5 figures, 6 tables)

This paper contains 33 sections, 5 figures, 6 tables.

Figures (5)

  • Figure 1: An example of a generated depth-2 knowledge graph around the seed entity Alan Turing, applying LMCRAWL (see Sec. \ref{['sec:crawling']}-Sec. \ref{['sec:setup']}). Additional graphs are in Sec. \ref{['apx:example_graphs']}.
  • Figure 2: An illustration of the full method for crawling a subgraph (LMCRAWL), starting from Barack Obama as the subject, until obtaining the triplet (Barack Obama, spouse, Michelle Obama).
  • Figure 3: The # of triplets extracted by LMCRAWL as a function of the # of triplets in WikiData, for the set of validation entities of type Person.
  • Figure 4: An example of a generated depth-2 knowledge graph around the seed entity Angela Merkel, using LMCRAWL (see Sec. \ref{['sec:crawling']}). For readability, back edges from 2-depth nodes to 1-depth nodes are omitted.
  • Figure 5: An example of a generated depth-2 knowledge graph around the seed entity Boston Celtics, using LMCRAWL (see Sec. \ref{['sec:crawling']}).