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.
翻译:语言模型在海量文本数据上训练,其参数中可能蕴含大量事实知识。这些模型执行的任何下游任务都隐式地建立在事实知识基础上,因此,寻求以可解释的方式表征这类知识体系的方法尤为重要。然而,目前尚缺乏实现这种表征的机制。本研究提出通过从给定语言模型中提取事实知识图谱来应对这一挑战。我们描述了一种“爬取”语言模型内部知识库的流程。具体而言,我们以种子实体为起点,围绕其扩展知识图谱。爬取流程被分解为若干子任务,通过专门设计的提示词实现,这些提示词既保证精确度(即不生成错误事实),也保证召回率(即生成的事实数量)。我们从数十个种子实体出发爬取图谱,对方法进行评估,结果表明能生成高精度图谱(82-92%),同时每个实体可产出合理数量的事实。