Intra-Prompt Parallel Decoding for Common-Context Question Answering
Organizations: Amazon.com, Inc. · McGill University · Mila · Int. Lab. Learning Systems
Abstract
In common-context question answering (CCQA) tasks, multiple input questions share a common context to base their answers from. However, Large Language Models typically generate each answer using an independent prompt. While existing batching and caching techniques help improve parallelism and reduce repeated computations, the separation of questions across prompts limits the achievable speedup, as modern GPUs are underutilized due to a memory bottleneck during attention. We present Intra-Prompt Parallel Decoding (IPPD), a novel inference method that answers multiple common-context questions in parallel within a single prompt. IPPD directly addresses the bottleneck by efficiently sharing both memory and computation during the attention process, as the next token for every question is decoded in a single inference step. IPPD uses virtual position IDs and attention mask manipulation to generate the same output as standard prompting without requiring fine-tuning or any changes to the LLM architecture. Since all parallelism occurs within a prompt, IPPD is fully compatible with batched inference, even when each prompt features a different context. Our experiments show that IPPD delivers up to 7X the effective throughput as standard decoding without quality degradation, and outperforms prefix caching with PagedAttention in most settings.
Figures & tables
| Average token length | ||||||
| Dataset | Number of contexts | Avg. Parallelism | Instruction | Context | Question | Answer |
| NarrativeQA (5s) | 355 | 29.73 | 2,754.00 | 737.45 | 11.97 | 5.81 |
| SQuAD 2.0 | 1,365 | 8.70 | 47.00 | 177.94 | 12.58 | 3.94 |
| RACE | 1,407 | 3.51 | 40.00 | 344.30 | 39.81 | 1.00 |
| LongHealth | 20 | 20.00 | 73.00 | 11,719.75 | 72.50 | 1.00 |
| Model | NarrativeQA (5 shot) | SQuAD 2.0 | RACE | LongHealth | ||||
| ROUGE-L | EM% | F1 | EM% | Acc.% | EM% | Acc.% | EM% | |
| Qwen3-32B | 96.5 | 0.649_{{\color[rgb]{1,0,0}-0.004}} | 96.9 | 99.7 | 87.0_{{\color[rgb]{1,0,0}-0.5}} | 99.5 | ||
| OLMo-2-32B | 97.6 | 98.1 | 99.8 | – | – | |||
| Phi4-14B | 0.702_{{\color[rgb]{1,0,0}-0.004}} | 91.3 | 0.466_{{\color[rgb]{1,0,0}-0.005}} | 95.8 | 99.9 | 86.5_{{\color[rgb]{0,1,0}+0.5}} | 99.3 | |
| Qwen3-8B | 97.5 | 0.598_{{\color[rgb]{1,0,0}-0.001}} | 97.5 | 88.3_{{\color[rgb]{1,0,0}-0.1}} | 99.6 | 100 | ||
| Qwen3-4B-Instr. | 95.7 | 0.659_{{\color[rgb]{0,1,0}+0.002}} | 98.1 | 99.7 | 83.0_{{\color[rgb]{0,1,0}+0.5}} | 99.5 | ||
| Short context | Long context | |
| Single-token answer | IPPD | PC+PA |
| Multi-token answer | IPPD | IPPD |
| Long generation | Standard inf. | PC+PA |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Prefill | Decode | ||
| First | Subsequent | |||
| PC+PA | ||||
| Frequency | Once per | Once per | ||
| IPPD | ||||
| Model | NarrativeQA (5s) | SQuAD 2.0 | RACE | LongHealth | |||||
| B | C/P | B | C/P | B | C/P | B | C/P | ||
| Batched Inf. | Qwen3-32B | 8 | 1 | 30 | 1 | 5 | 1 | 1 | 1 |
| OLMo-2-32B | 8 | 1 | 30 | 1 | 5 | 1 | 1 | 1 | |
| Phi-4-14B | 8 | 1 | 30 | 1 | 5 | 1 | 1 | 1 | |
| Qwen3-8B | 20 | 1 | 30 | 1 | 5 | 1 | 1 | 1 | |
| Qwen3-4B-Instr. | 20 | 1 | 30 | 1 | 5 | 1 | 1 | 1 | |
| Model | NarrativeQA (5s) | LongHealth | SQuAD 2.0 | RACE | |
| QPS | QPS | QPS | QPS | ||
| Qwen3-32B | Batched Inference | 0.48 | 0.18 | 2.86 | 4.52 |
| PC + PA | 7.06 | 2.82 | 11.90 | 5.84 | |
| IPPD | 10.74 | 1.93 | 15.74 | 11.78 | |
| OLMo-2-32B | Batched Inference | 0.54 | - | 3.47 | 4.75 |
| PC + PA | 7.15 | - | 12.54 | 6.15 |
| Model | Dataset | Prefill steps | Prefill time | Decode steps | Decode time |
| Qwen3-32B | NarrativeQA (5s) | 20.95 | 37.59 | 10.25 | 8.66 |
| SQuAD 2.0 | 7.07 | 5.00 | 5.79 | 5.08 | |
| RACE | 2.80 | 2.58 | – | – | |
| LongHealth | 20.00 | 9.33 | – | – | |
| OLMo-2-32B | NarrativeQA (5s) | 20.95 | 43.68 | 10.45 | 11.81 |
| SQuAD 2.0 | 6.19 | 5.86 | 4.02 | 4.18 |
| Model | Questions / context | |||||||||||
| 1 | 2 | 4 | 8 | 16 | 32 | |||||||
| PC+PA | IPPD | PC+PA | IPPD | PC+PA | IPPD | PC+PA | IPPD | PC+PA | IPPD | PC+PA | IPPD | |
| NarrativeQA (5s) | ||||||||||||
| Qwen3-32B | 5.09 | 1.52 | 5.72 | 2.63 | 6.73 | 4.34 | 7.93 | 7.20 | 10.81 | 12.28 | 15.76 | 18.91 |
| OLMo-2-32B | – | – | – | – | – | – | – | – | – | – | – | – |
| Phi-4-14B | 6.50 | 1.57 | 7.07 | 2.74 | 8.38 | 5.02 | 9.77 | 8.84 | 12.33 | 15.60 | 16.60 | 23.98 |
| Model | Context length | |||||||
| 1 | 2 | 4 | 8 | |||||
| PC+PA | IPPD | PC+PA | IPPD | PC+PA | IPPD | PC+PA | IPPD | |
| NarrativeQA (5s) | ||||||||
| Qwen3-32B | 15.97 | 18.25 | 20.50 | 17.73 | 20.74 | 13.44 | 18.74 | 12.91 |
| OLMo-2-32B | 14.39 | 22.07 | – | – | – | – | – | – |
| Phi-4-14B | 16.05 | 23.16 | 21.46 | 18.85 | – | – | – | – |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,101 papers