20260514:增加新内容
This commit is contained in:
33
concepts/ramsey-context-template.md
Normal file
33
concepts/ramsey-context-template.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: "Ramsey Context Template(拉姆齐上下文模板)"
|
||||
created: 2026-05-11
|
||||
updated: 2026-05-11
|
||||
type: concept
|
||||
tags: [caching, template, kv-cache, context-design]
|
||||
sources: [[ramsey-context-construction]]
|
||||
---
|
||||
|
||||
# Ramsey Context Template(拉姆齐上下文模板)
|
||||
|
||||
## 定义
|
||||
|
||||
拉姆齐上下文模板是系统后台异步维护的**蓝色团模板库**,存储历史上频繁出现且效果良好的兼容上下文组合。这些模板天然是稳定前缀,直接提升 [[cache-hit-ratio|KV cache 命中率]]。
|
||||
|
||||
## 工作流程
|
||||
|
||||
1. **后台构建**:异步追踪历史上成功的蓝色团,存入模板库
|
||||
2. **在线匹配**:新请求到达时,用向量相似度或关键词匹配寻找最接近模板
|
||||
3. **模板复用**:匹配度超阈值 → 直接复用模板作为上下文骨架
|
||||
4. **动态更新**:使用统计上报,模板库持续进化
|
||||
|
||||
## 与 Prompt Caching 的协同
|
||||
|
||||
- 模板复用的前缀一致性 → [[prefix-matching|前缀匹配]] 命中
|
||||
- 与 [[stub-pattern|Stub 模式]] 异曲同工:通过固定结构保证缓存稳定性
|
||||
- KV cache 命中率实测可达 **80%+**
|
||||
|
||||
## 相关概念
|
||||
|
||||
- [[context-blue-clique|上下文蓝色团]]
|
||||
- [[ramsey-context-cache|拉姆齐上下文缓存]]
|
||||
- [[prompt-caching|Prompt Caching]]
|
||||
Reference in New Issue
Block a user