arXiv:2607.20507cs.AIcs.LG2026-07中稿 · EMNLP

用小模型加速大模型推理,通过程序缓存提升效率。

CacheSpec: Finding the Sweet Spot for Small Models in Large Language Models

  • 将思维链程序转为可复用缓存,小模型负责变量提取与推测生成。
  • 在多个数据集上实现最高3.1倍延迟降低,吞吐提升2.8倍。
  • 适合需要高频重复推理的智能体任务,如购物、代码生成等场景。

大型语言模型在程序辅助推理、智能体决策和结构化任务中应用广泛,但推理成本高昂。许多请求具有相似计算结构,仅变量、约束或上下文不同,为程序级缓存提供机会。程序缓存需重用可复用计算逻辑,关键步骤包括轻量级结构化操作如变量提取、程序绑定和生成加速,这些恰好适合小模型。我们提出CacheSpec,一种以可复用程序缓存为核心的推理优化框架。该框架将一次性的思维链(PoT)程序转化为可复用缓存对象,并用同一小模型承担双重角色:在缓存命中路径中进行语义变量提取,以及在目标大模型生成时执行推测性草稿。在购物类请求数据集WebShop、Formula和CodeTAT-QA上的实验表明,CacheSpec显著降低推理延迟并提升有效缓存利用率,任务质量与现有基线相当或更优,最高实现约3.1×延迟加速;在并行服务实验中,吞吐相比传统PoT方法提升约2.8×。结果表明,在大模型推理系统中,小模型的最优定位并非独立完成复杂任务,而是执行轻量、结构化且可验证的辅助操作。

原文摘要 · Abstract (English)

Large language models (LLMs) are increasingly used for program-aided reasoning, agentic decision making, and structured task execution, but these settings often incur substantial inference cost. Many such requests share similar computational structures while differing in variables, constraints, or contexts, creating opportunities for program-level caching. Since program caches need to reapply reusable computation logic to new requests, their key steps often involve lightweight and structured operations such as variable extraction, program binding, and generation acceleration, which are well suited for small models. We propose CacheSpec, an inference optimization framework centered on reusable program caches. The framework converts Program-of-Thoughts (PoT)-style programs from one-time reasoning artifacts into reusable cache objects, and reuses the same small model for two roles: semantic variable extraction on the cache-hit path and speculative drafting during target-LLM generation. Experiments on shopping-style request datasets, WebShop, Formula, and CodeTAT-QA show that CacheSpec reduces inference latency and improves effective cache reuse while preserving comparable or better task quality than existing caching and generation baselines, achieving up to about 3.1$\times$ latency speedup; in parallel serving experiments, it improves throughput by about 2.8$\times$ over PoT-style methods. These results suggest that the sweet spot for small models in large-model inference systems lies not in solving complex tasks independently, but in performing lightweight, structured, and verifiable auxiliary operations.

推理优化程序缓存小模型LLM加速

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。