atlas

Research map / Architectures and efficiency / Attention and transformers

APE: Faster and Longer Context-Augmented Generation via Adaptive Parallel Encoding

ICLR 2025 · Architectures and efficiency › Attention and transformers · approach: Sparse attention for long-context LLMs · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes APE, a training-free inference-time modification of parallel KV encoding (shared prefix, attention temperature, and scaling factor) that closes most of the accuracy gap to sequential encoding for RAG and ICL while enabling cached, faster long-context generation.

Problem

Context-augmented generation (RAG and ICL) is slow because long concatenated contexts must be re-encoded per request, while naive parallel encoding with cached KV states degrades accuracy substantially, especially for ICL and reasoning tasks.

Approach

Align the attention distribution of parallel encoding with sequential encoding through three training-free steps: prepending a shared prefix to avoid duplicated attention-sink states, lowering attention temperature for contexts, and applying a scaling factor to the context LogSumExp term.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add a shared prefix (ablation)Parallel encoding · GSM8K, TriviaQA, and MMLUAccuracy: 38.25% -> 50.42%; 67.99% -> 70.76%; 63.09% -> 63.70%Helped
Add attention temperature to the shared-prefix variant (ablation)APE · GSM8K, TriviaQA, and MMLUAccuracy: 50.42% -> 51.15%; 70.76% -> 71.03%; 63.70% -> 64.49%Helped
Add a scaling factor to the shared-prefix and temperature variant (ablation)APE · GSM8K, TriviaQA, and MMLUAccuracy: 51.15% -> 53.62%; 71.03% -> 72.64%; 64.49% -> 66.62%Helped
Use APE rather than sequential encoding with the same retrieved chunksChatRAG-Bench with Contriever · ChatRAG-Bench (Contriever)Average: 29.53 -> 29.02; -0.51Hurt
Use APE rather than sequential encoding with the same retrieved chunksChatRAG-Bench with GTE-base · ChatRAG-Bench (GTE-base)Average: 32.91 -> 31.99; -0.92Hurt
Use APE rather than sequential encoding with the same retrieved chunksChatRAG-Bench with Dragon-multiturn · ChatRAG-Bench (Dragon-multiturn)Average: 36.38 -> 35.24; -1.14Hurt
Retrieve more and longer contexts using APELongBench RAG on LLaMA-3-8B-Instruct · LongBench RAGAverage: 37.60 -> 39.62Helped
Retrieve more and longer contexts using APELongBench RAG on Mistral-7B-Instruct-v0.3 · LongBench RAGAverage: 25.06 -> 32.55Helped
Retrieve more and longer contexts using APELongBench RAG on Gemma-2-9b-it · LongBench RAGAverage: 41.28 -> 44.18Helped
Add APE and process 20 parallel segments of 4K tokensLlama-3-8B-Instruct on CRAG · CRAG Task 1Accuracy (%): 23.28 -> 25.53Helped
Add APE and process 20 parallel segments of 4K tokensLlama-3-8B-Instruct on CRAG · CRAG Task 2Accuracy (%): 24.46 -> 27.04Helped
Segment long-context inputs and apply APELLaMA-3-8B-Instruct · LongBench long-context tasksAverage: 31.50 -> 38.11Helped

Surprising findings

Limitations

Experimental setup

Datasets: ChatRAG-Bench LongBench GSM8K TriviaQA MMLU LOFT CRAG

Benchmarks: ChatRAG-Bench LongBench GSM8K TriviaQA MMLU LOFT CRAG

Metrics: accuracy F1 Rouge-L EM latency prefill time CRAG score

Baselines: Sequential encoding Parallel Context Windows (PCW) CEPE-Distilled (CEPED) Block-Attention MInference LLMLingua2 StreamingLLM Self-Extend

Builds on: Parallel Context Windows StreamingLLM Flash Attention CEPE

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy