Readme_AI: Dynamic Context Construction for Large Language Models

📄 arXiv: 2509.19322v1 📥 PDF

作者: Millie Vyas, Timothy Blattner, Alden Dima

分类: cs.CL, cs.AI

发布日期: 2025-09-12

🔗 代码/项目: GITHUB


💡 一句话要点

Readme_AI:提出动态上下文构建方法,提升大语言模型在特定查询下的准确性和可靠性。

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大语言模型 动态上下文 知识库 元数据 模型上下文协议

📋 核心要点

  1. 大语言模型在特定领域或数据集上表现不佳,容易产生幻觉,缺乏准确性和可靠性。
  2. Readme_AI通过构建动态上下文,让LLM能够基于数据源所有者提供的元数据进行推理,从而提升响应质量。
  3. 实验表明,Readme_AI能显著提升LLM在特定库(如Hedgehog)上的理解和代码生成能力,减少不准确信息。

📝 摘要(中文)

大语言模型(LLMs)虽然经过大量数据训练,但在用户特定查询的背景下,可能会提供不准确或不可靠的信息。提供特定于查询的上下文可以显著提高其响应的有效性。本文提出了一种规范,用于动态构建数据源的上下文。数据源所有者创建包含元数据的文件,供LLMs在推理与数据集相关的查询时使用。为了展示我们提出的规范,我们创建了一个原型Readme_AI模型上下文协议(MCP)服务器,该服务器从数据源检索元数据,并使用它来动态构建上下文。该规范的一些动态特性包括可扩展的类型,这些类型表示爬取网页、从数据存储库获取数据、下载和解析出版物以及通用文本。上下文使用用户指定的标签进行格式化和分组,这些标签为LLM提供清晰的上下文信息以进行推理。我们通过询问LLM关于NIST开发的Hedgehog库来展示这个早期原型的能力,对于该库,常见的LLMs通常提供不准确和不相关的包含幻觉的响应。借助Readme_AI,LLM接收到足够的上下文,现在能够推理关于该库及其使用,甚至可以生成从Hedgehog的开发者提供的Readme_AI文件中包含的示例中插值的代码。我们的主要贡献是一个可扩展的协议,用于在专门的、所有者提供的数据中动态地 grounding LLMs,从而增强LLMs的响应并减少幻觉。

🔬 方法详解

问题定义:现有的大语言模型虽然参数量巨大,但在面对特定领域或数据集的查询时,由于缺乏足够的上下文信息,容易产生不准确、不相关甚至带有幻觉的回答。这限制了LLM在专业领域的应用。

核心思路:Readme_AI的核心思路是为LLM动态构建与查询相关的上下文。通过让数据源的拥有者提供包含元数据的Readme_AI文件,使得LLM在回答问题之前,能够先获取并理解这些元数据,从而更好地理解用户的意图,并给出更准确的回答。这种方法的核心在于将领域知识显式地提供给LLM,而不是依赖其自身在训练过程中获得的知识。

技术框架:Readme_AI包含一个模型上下文协议(MCP)服务器。数据源拥有者创建包含元数据的Readme_AI文件,并将其存储在服务器上。当用户向LLM提出与该数据源相关的问题时,MCP服务器会根据问题动态地从Readme_AI文件中检索相关的元数据,并将其作为上下文提供给LLM。LLM在接收到上下文后,再进行推理和回答。

关键创新:Readme_AI的关键创新在于其动态上下文构建机制和可扩展的元数据规范。传统的LLM应用通常依赖于预训练的知识或静态的上下文信息,而Readme_AI能够根据用户的查询动态地构建上下文,从而更好地适应不同的场景。此外,Readme_AI的元数据规范是可扩展的,可以支持各种类型的数据源和元数据。

关键设计:Readme_AI的关键设计包括:1) 可扩展的元数据类型,支持爬取网页、获取数据、解析文档等多种数据源;2) 用户可自定义的标签,用于对上下文信息进行分组和格式化,方便LLM理解;3) MCP服务器,负责动态地检索和构建上下文。

📊 实验亮点

实验结果表明,Readme_AI能够显著提升LLM在特定库(如NIST开发的Hedgehog库)上的表现。在没有Readme_AI的情况下,LLM通常会给出不准确甚至带有幻觉的回答。而借助Readme_AI提供的上下文,LLM能够更好地理解Hedgehog库的功能和使用方法,甚至可以生成从示例中插值的代码。

🎯 应用场景

Readme_AI可应用于各种需要LLM提供专业领域知识的场景,例如软件开发、科学研究、金融分析等。通过提供动态上下文,Readme_AI可以帮助LLM更好地理解用户的意图,并给出更准确、更可靠的回答,从而提高工作效率和决策质量。未来,Readme_AI有望成为LLM在专业领域应用的重要基础设施。

📄 摘要(原文)

Despite being trained on significant amounts of data, Large Language Models (LLMs) can provide inaccurate or unreliable information in the context of a user's specific query. Given query-specific context significantly improves the usefulness of its responses. In this paper, we present a specification that can be used to dynamically build context for data sources. The data source owner creates the file containing metadata for LLMs to use when reasoning about dataset-related queries. To demonstrate our proposed specification, we created a prototype Readme_AI Model Context Protocol (MCP) server that retrieves the metadata from the data source and uses it to dynamically build context. Some features that make this specification dynamic are the extensible types that represent crawling web-pages, fetching data from data repositories, downloading and parsing publications, and general text. The context is formatted and grouped using user-specified tags that provide clear contextual information for the LLM to reason about the content. We demonstrate the capabilities of this early prototype by asking the LLM about the NIST-developed Hedgehog library, for which common LLMs often provides inaccurate and irrelevant responses containing hallucinations. With Readme_AI, the LLM receives enough context that it is now able to reason about the library and its use, and even generate code interpolated from examples that were included in the Readme_AI file provided by Hedgehog's developer. Our primary contribution is a extensible protocol for dynamically grounding LLMs in specialized, owner-provided data, enhancing responses from LLMs and reducing hallucinations. The source code for the Readme_AI tool is posted here: https://github.com/usnistgov/readme_ai .