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.
