← Back to AI Infrastructure Mind Map
🖥️ AI InfrastructureID: context-memory-service

Context & Memory Services

上下文缓存与记忆服务
🎯Core Definition
context and memory services reuse prefix KV caches across requests (prefix KV caching service) and provide tiered memory — short-term working memory plus long-term storage/retrieval.
💡Use Cases
multi-turn chat, multi-tenant shared system prompts, long-horizon memory agents; prompt caching and memory tiers are classic high-concurrency AI system design questions.
⚡Key Problems Solved
full per-turn prefill makes TTFT and cost grow linearly with context length; prefix caching cuts prefill compute from O(Ltotal)O(L_{\text{total}}) to O(Lnew)O(L_{\text{new}}) (TTFT down 80%+), and tiered memory (short-term context window + long-term external store with retrieval) compresses long-session cost to “window + cache hits” scale.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Context & Memory Services.
Use Cases
In production engineering, what are the primary use cases for Context & Memory Services and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
How does prefix KV caching reuse work across requests, and how does hit rate affect TTFT and cost?
2
How are short-term and long-term memory tiered (working memory vs external vector store)?
3
How do retrieval services (RAG) integrate with memory services, trading off relevance vs latency?
4
How to control long-session cost (window trimming, summarization, cached prefixes)?
5
How are prefix caches invalidated and rebuilt when system prompts or history change?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Context & Memory Services"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardAgent Runtime (cross-module)Next Card →RL Training/Serving (cross-module)

🔗 More AI Infrastructure Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/AI_Infra/card/context-memory-service
中文速览与面试要点

上下文缓存与记忆服务 (Context & Memory Services)

定义: 上下文与记忆服务将系统提示/历史会话的前缀 KV 缓存跨请求复用 (前缀 KV 缓存服务), 并对外提供短期工作记忆与长期存储的分层记忆能力。 使用场景: 多轮对话、多租户共享系统提示、长期记忆 Agent; 高并发 AI 系统设计面试常考 prompt caching 与记忆分层。 解决的问题: 长会话逐轮全量 prefill 使 TTFT 与成本随长度线性膨胀; 前缀缓存把 prefill 计算量由 O(L_ total) 降至 O(L_ new) (TTFT 可降 80%+), 记忆分层 (短期 KV/上下文窗口 + 长期外部存储与检索) 将长会话成本从“全量复算”压缩为“窗口 + 缓存命中”量级。

核心要点

  • 前缀 KV 缓存 (prompt caching) 如何跨请求复用, 命中率如何影响 TTFT 与成本?
  • 短期记忆与长期记忆如何分层存储 (工作记忆 vs 外部向量库)?
  • 检索服务 (RAG) 如何与记忆服务集成, 相关度与延迟如何权衡?
  • 长会话成本如何控制 (窗口裁剪、摘要压缩、缓存前缀)?
  • 系统提示或历史更新后, 前缀缓存如何失效与重建?