全书目录

附录 G:分章资料清单

G.33 第 17 章《输入契约:原始输入、清洗输入与模型可见上下文》资料清单

16 分钟 6,981 字 第 89 / 161 个阅读单元
  1. Conversation state 作者/机构:OpenAI 年份:2026 URL:https://developers.openai.com/api/docs/guides/conversation-state 角度:单次请求无状态、previous_response_id、多轮上下文维护 采用原因:适合支撑“模型上下文并非天然存在,而是系统显式维护出来”。

  2. Text generation 作者/机构:OpenAI 年份:2026 URL:https://developers.openai.com/api/docs/guides/text 角度:instructions、message roles、请求边界 采用原因:适合支撑“输入不是原始聊天文本,而是被角色化与边界化后的请求对象”。

  3. Using the Messages API 作者/机构:Anthropic 年份:2026 URL:https://platform.claude.com/docs/en/build-with-claude/working-with-messages 角度:stateless messages、synthetic assistant messages 采用原因:适合支撑“多轮输入依赖系统重组历史,而非模型自行记住一切”。

  4. Define tools 作者/机构:Anthropic 年份:2026 URL:https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools 角度:tool schemas、system prompt compilation 采用原因:适合支撑“模型看到的上下文包含系统拼装后的工具定义与约束”。

  5. Context windows 作者/机构:Anthropic 年份:2026 URL:https://platform.claude.com/docs/en/build-with-claude/context-windows 角度:上下文窗口、thinking block 剥离、可见 token 管理 采用原因:适合支撑“可见上下文会被系统主动裁剪和重组”。

  6. Text generation 作者/机构:Google Gemini API 年份:2026 URL:https://ai.google.dev/gemini-api/docs/text-generation 角度:history、system_instruction、curated history 采用原因:适合支撑“输入历史是 curated 的,不是原始会话的简单拼接”。

  7. Work with chat completion models 作者/机构:Microsoft 年份:2026 URL:https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/chatgpt 角度:每次请求显式携带 transcript 采用原因:适合支撑“模型请求层通常是无状态的,系统要负责送入哪段历史”。

  8. Compaction 作者/机构:Microsoft Agent Framework 年份:2026 URL:https://learn.microsoft.com/en-us/agent-framework/agents/conversations/compaction 角度:remove、collapse、summarize、保留 system messages 采用原因:适合支撑“输入压缩是会话工程的一部分,不只是成本优化”。

  9. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks 作者/机构:Patrick Lewis 等 年份:2020 URL:https://papers.neurips.cc/paper_files/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html 角度:RAG、外部知识检索、参数记忆与非参数记忆结合 采用原因:适合支撑“模型效果取决于被送入的外部证据,而不只取决于参数本体”。

  10. Dense Passage Retrieval for Open-Domain Question Answering 作者/机构:Vladimir Karpukhin 等 年份:2020 URL:https://aclanthology.org/2020.emnlp-main.550/ 角度:dense retriever、passage 切分、top-k 检索质量 采用原因:适合支撑“检索器选择和切片粒度会改变模型后续看到的内容质量”。

  11. Retrieval meets Long Context Large Language Models 作者/机构:Peng Xu 等 年份:2024 URL:https://proceedings.iclr.cc/paper_files/paper/2024/hash/d75f29006df67df084e6586f1cb8458c-Abstract-Conference.html 角度:长上下文与检索的互补关系 采用原因:适合支撑“即便上下文窗口变长,检索和输入筛选仍然决定性能”。

  12. RankRAG: Unifying Context Ranking with Retrieval-Augmented Generation in LLMs 作者/机构:Yue Yu 等 年份:2024 URL:https://papers.neurips.cc/paper_files/paper/2024/file/db93ccb6cf392f352570dd5af0a223d3-Paper-Conference.pdf 角度:context ranking、reranking、top-k 噪声控制 采用原因:适合支撑“不是检到就够,排序决定真正进入上下文的证据质量”。

  13. RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation 作者/机构:Fangyuan Xu、Weijia Shi、Eunsol Choi 年份:2024 URL:https://openreview.net/forum?id=mlJLVigNHp 角度:context compression、selective augmentation、空摘要策略 采用原因:适合支撑“清洗输入到模型可见上下文之间还存在压缩与过滤这一层关键转换”。

  14. Searching for Best Practices in Retrieval-Augmented Generation 作者/机构:Xiaohua Wang 等 年份:2024 URL:https://aclanthology.org/2024.emnlp-main.981.pdf 角度:query processing、retrieval、reranking、repacking、summarization 的系统比较 采用原因:适合支撑“输入契约是整条 RAG pipeline 的联合产物”。

  15. Lost in the Middle: How Language Models Use Long Contexts 作者/机构:Nelson F. Liu 等 年份:2024 URL:https://aclanthology.org/2024.tacl-1.9/ 角度:上下文位置偏置、长上下文信息利用退化 采用原因:适合支撑“信息放在哪里,与放不放一样重要”。

  16. Context Length Alone Hurts LLM Performance Despite Perfect Retrieval 作者/机构:ACL Findings 论文作者团队 年份:2025 URL:https://aclanthology.org/2025.findings-emnlp.1264/ 角度:长上下文长度本身带来的性能退化 采用原因:适合支撑“把更多 token 塞进去不等于更高质量输入”。

  17. LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compression 作者/机构:Yuxiang Hu 等 年份:2024 URL:https://aclanthology.org/2024.acl-long.91/ 角度:prompt compression、长上下文压缩 采用原因:适合支撑“压缩本身是输入契约的重要组成,而不是单纯降本技巧”。

  18. Trafilatura: A Web Scraping Library and Command-Line Tool for Text Discovery and Extraction 作者/机构:Adrien Barbaresi 年份:2021 URL:https://aclanthology.org/2021.acl-demo.15/ 角度:网页正文抽取、模板噪声移除、元数据保留 采用原因:适合支撑“原始网页不能直接作为模型输入,必须先做解析和清洗”。

  19. DocLLM: A Layout-Aware Generative Language Model for Multimodal Document Understanding 作者/机构:Dongsheng Wang 等 年份:2024 URL:https://aclanthology.org/2024.acl-long.463/ 角度:版面感知文档理解、布局与文本联合建模 采用原因:适合支撑“文档输入不仅是文本问题,还涉及结构与版面信息重建”。

  20. Parse and chunk documents 作者/机构:Google Cloud 年份:2026 URL:https://cloud.google.com/generative-ai-app-builder/docs/parse-chunk-documents 角度:layout parsing、chunking、返回相关 chunks 而非整份文档 采用原因:适合支撑“生产系统会先解析和切块,再把相关片段提供给模型”。

  21. Build advanced retrieval-augmented generation systems 作者/机构:Microsoft 年份:2026 URL:https://learn.microsoft.com/en-us/azure/developer/ai/advanced-retrieval-augmented-generation 角度:ingestion pipeline、metadata extraction、post-retrieval filtering、prompt compression 采用原因:适合支撑“原始输入到模型可见上下文之间存在完整工程管线”。

  22. Introducing Contextual Retrieval 作者/机构:Anthropic 年份:2024 URL:https://www.anthropic.com/engineering/contextual-retrieval 角度:contextual chunk、BM25 + embeddings、reranking 采用原因:适合支撑“chunk 需要被上下文化后,才更接近模型真正可用的输入单元”。

  23. Effective context engineering for AI agents 作者/机构:Anthropic 年份:2025 URL:https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents 角度:just-in-time retrieval、compaction、structured note-taking、context rot 采用原因:适合支撑“输入工程已经从 prompt engineering 延伸为完整 context engineering”。

  24. How we built enterprise search to be secure and private 作者/机构:Slack Engineering 年份:2025 URL:https://slack.engineering/how-we-built-enterprise-search-to-be-secure-and-private/ 角度:ACL 权限过滤、联邦检索、安全私有企业搜索 采用原因:适合支撑“企业输入首先受权限与数据治理约束,而不是先受模型能力约束”。

  25. How Cody understands your codebase 作者/机构:Sourcegraph 年份:2024 URL:https://sourcegraph.com/blog/how-cody-understands-your-codebase 角度:query cleansing、代码检索、排序、上下文选片 采用原因:适合支撑“编码 Agent 的输入是工程化构造出来的代码上下文,而非原始仓库全量文本”。

  26. Lessons from Building AI Coding Assistants: Context Retrieval and Evaluation 作者/机构:Sourcegraph 年份:2025 URL:https://sourcegraph.com/blog/lessons-from-building-ai-coding-assistants-context-retrieval-and-evaluation 角度:多源召回、ranking、evaluation 采用原因:适合支撑“高质量上下文来自 observation sources 的聚合与筛选,而非单源直接注入”。

  27. Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection 作者/机构:Kai Greshake 等 年份:2023 URL:https://arxiv.org/abs/2302.12173 角度:间接提示注入、外部内容污染 采用原因:适合支撑“输入契约失守会把外部恶意内容混入模型决策层”。

  28. Formalizing and Benchmarking Prompt Injection Attacks and Defenses 作者/机构:Yupei Liu 等 年份:2024 URL:https://www.usenix.org/conference/usenixsecurity24/presentation/liu-yupei 角度:prompt injection 攻防形式化与基准 采用原因:适合支撑“数据与指令边界不清,会直接演化为系统性安全风险”。

  29. AgentPoison: Red-teaming LLM Agents via Memory or Knowledge Base Poisoning 作者/机构:研究团队 年份:2024 URL:https://arxiv.org/abs/2407.12784 角度:memory poisoning、knowledge base poisoning 采用原因:适合支撑“输入污染并不止于单轮上下文,还会跨轮侵入记忆与知识库”。

  30. Prompt injection is not SQL injection 作者/机构:NCSC 年份:2025 URL:https://www.ncsc.gov.uk/blog-post/prompt-injection-is-not-sql-injection 角度:prompt injection 风险建模、可信边界 采用原因:适合支撑“Agent 输入安全的对象不是单条提示,而是整个内容摄入链路”。