[Paper Review] Crawling the Internal Knowledge-Base of Language Models
This paper proposes a prompt-based method to crawl and extract a high-precision knowledge graph from the internal knowledge base of large language models (LLMs), starting from a single seed entity. By decomposing the task into relation generation, object prediction with a 'Don't know' fallback, and paraphrasing for recall, the approach achieves 82–92% precision on 2-hop graphs using GPT-3, enabling interpretable, queryable, and schema-agnostic knowledge extraction without fine-tuning.
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.
Motivation & Objective
- To enable interpretable and transparent access to the factual knowledge encoded in large language models.
- To address the lack of mechanisms for representing the internal knowledge base of LMs in a structured, queryable format.
- To develop a method that extracts high-precision knowledge graphs from LMs starting from a single seed entity, without requiring predefined relations or schemas.
- To maintain high factual correctness while maximizing recall through in-context learning and paraphrasing.
- To provide a foundation for auditing model biases, detecting factual errors, and enabling knowledge-based reasoning in LMs.
Proposed method
- Decompose knowledge crawling into sub-tasks: relation generation, object prediction per relation, and paraphrasing for recall.
- Use few-shot in-context learning with manually designed prompts and examples from Wikidata to guide each sub-task.
- Incorporate a 'Don't know' output token to enforce high precision by rejecting uncertain predictions.
- Construct in-context examples using Wikidata facts that are known to be absent from the LMs to simulate uncertainty.
- Generate paraphrases of entities and relations to increase recall by exposing additional factual connections.
- Iteratively expand the knowledge graph up to two hops from the seed entity, maintaining precision through confidence-based filtering.

Experimental results
Research questions
- RQ1Can we extract a structured, high-precision knowledge graph from the internal parameters of a pre-trained language model without fine-tuning?
- RQ2How can we enable a language model to autonomously identify relevant relations and objects for a given seed entity?
- RQ3What in-context prompting strategies can balance precision and recall in knowledge graph crawling from LMs?
- RQ4How does the inclusion of a 'Don't know' mechanism improve factual correctness in knowledge extraction?
- RQ5To what extent can the method generalize beyond the schema of existing knowledge bases like Wikidata?
Key findings
- The proposed method achieves 82–92% precision on two-hop knowledge graphs extracted from GPT-3 using 140 seed entities.
- The approach successfully generates facts outside the Wikidata schema, such as (Boston Celtics, Championships, 17), demonstrating schema-agnostic knowledge extraction.
- The use of 'Don't know' outputs significantly improves precision by filtering out low-confidence predictions.
- Paraphrasing of entities and relations increases recall without a measurable drop in precision, enabling discovery of additional valid facts.
- The method scales to multiple seed entities and produces interpretable, queryable knowledge graphs that reflect the LM’s internal factual knowledge.
- Evaluation shows that the reported precision is conservative, with true precision likely higher due to the approximate nature of the automatic evaluation metric.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.