跳到正文
arXiv cs.AI· Zekun Zhao, Jeffrey Flanigan·· 1 天前AI 评分38

Read Once, Answer Many:Parallel Prompting 加速共享上下文 LLM 推理

Read Once, Answer Many: Parallel Prompting for Shared-Context LLM Inference

AI 导读

研究者提出 Parallel Prompting,将同一长文档上的 P 个问题作为单次请求的 P 条独立流一次性解码,每步只读取一次共享文档的 KV cache,并用在 attention kernel 内计算的 stream-id attention mask 保证各答案只依赖文档与自身问题。

正文 · 原文

View PDF HTML (experimental)

Abstract:LLM workloads sometimes ask many independent questions about the same long document, as in document QA, data labeling and LLM-based evaluation. Prefix caching removes the redundant prefill shared by these queries, but each decode step still reads the document's key-value (KV) cache once per question, so decoding is bound by memory bandwidth and scales with the number of questions. We present Parallel Prompting, which decodes P questions as P independent streams of a single request all at once, fixing this issue. In our method, every step reads the shared document once for all P streams, and a stream-id attention mask, evaluated inside the attention kernel, keeps each answer conditioned only on the document and its own question. We implement Parallel Prompting in SGLang by adding about 80 lines to three existing files and a small engine package; the mask needs no dense tensor, and every decode step has a fixed shape that is captured as a CUDA graph. With CodeLlama-7B, 8k-16k-token documents and 64-256 questions per document, Parallel Prompting is 3.7x faster than stock SGLang with its FlashInfer backend on an A100 and 5.9-6.0x faster on an RTX A6000, on two SGLang releases, including the most recent release. Timed on identical inputs, it is faster than stock SGLang in all 144 runs (2 GPUs x 2 releases x 6 workloads x 6 input sets). Code: this https URL
Comments: 17 pages, 6 figures. Code: this https URL. Project page: this https URL
Subjects: Computation and Language (cs.CL); Artificial Intelligence (cs.AI); Distributed, Parallel, and Cluster Computing (cs.DC); Machine Learning (cs.LG)
Cite as: arXiv:2611.15130 [cs.CL]
  (or arXiv:2611.15130v1 [cs.CL] for this version)
  https://doi.org/10.48550/arXiv.2611.15130

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Zekun Zhao [view email]
[v1] Wed, 11 Nov 2026 07:15:18 UTC (343 KB)

来源:arXiv cs.AI · arxiv.org