Factorized Context Attention: From Emulated to Native Grid Probing

Mohamed Eltahir, Manar Eyad, Yara Alzahrani, Fatimah Albesher, Duaa M. Tahir, Tanveer Hussain, Naeemullah KhanarXiv 2026

TL;DR

Handing a massive novel or an hour-long video to an AI model in one giant gulp slows it down, degrades its accuracy, and crashes into context-window walls. Recent prompting tricks fix this by slicing the input into a 2D grid and asking the model about each row and column separately—but at the painful cost of re-reading the entire book for every single question. Factorized Context Attention (FCA) brings this exact grid trick inside the model's attention layers, letting existing frozen models read massive inputs way past their context limits, with much higher accuracy, while encoding the data only once.

What Problem Does This Paper Address?

When large language and vision-language models read a massive input in a single forward pass (a "monolithic read"), three things go wrong: quadratic attention costs make it sluggish, distracting noise causes accuracy to plummet well before the context limit, and the model hits a hard wall at its maximum context window.

Recently, training-free methods known as grid probing found a clever workaround. Instead of feeding a 150,000-token novel all at once, you arrange chunks of the text (or frames of a video) into a hypothetical $K \times K$ grid. You then prompt the frozen model $2K$ separate times—once per row (contiguous "local" spans) and once per column (evenly spaced "strided" spans)—and pool the answers. Because each prompt is short, the model stays sharp and can read inputs far larger than its window. The catch? It is brutally expensive. Every question requires encoding the entire input twice from scratch, and nothing can be cached or reused for follow-up questions.

Figure 1. Emulated against native attention. (a) Grid probing builds the grid outside the frozen model and calls the model once per span. (b) FCA passes the input once and selects the spans inside the model with masked attention.

Methods

The authors start with a crisp observation: grid probing is just emulated attention—using external prompts to restrict what tokens a query can see, which is literally the job of an attention mask. To get the benefits without the redundant compute, they propose Factorized Context Attention (FCA), which runs this pattern as native attention inside a frozen model using standard attention kernels (like FlashAttention-2) and zero retraining.

Figure 2. One layer of FCA. (a) The chunked context is reshaped into a K×K grid, whose rows are local spans and whose columns are strided spans, and its keys and values are stored once. A request reads each span as a masked context, in 2K sequences that run in one batch and whose scores are pooled into the answer. (b) The resulting attention pattern for K=4.

FCA splits the work into two steps:

  1. Encode Once: The input is chunked into $N$ blocks on a $K \times K$ grid ($K = \lceil\sqrt{N}\rceil$). FCA encodes the $K$ rows (local spans) in a single batched pass, where tokens only attend to earlier tokens in their own row, and saves the Key-Value (KV) cache.
  2. Batched Masked Querying: When a question arrives, FCA runs $2K$ short sequences in one batch over the cached keys and values—gathering blocks for each row and column—and pools their log-odds scores (against an "abstain" option) to either answer directly or select the top $K$ blocks for a clean, focused read.

To make this work with Rotary Position Embeddings (RoPE) without retraining, FCA introduces stair positions. In native attention, a block's position is fixed during encoding. If you use true document positions, strided column spans take massive positional leaps and fall outside the model's trained window. Instead, FCA assigns the block at grid cell $(i, j)$ a starting position proportional to $(i + j - 2)\sigma$ (where $\sigma$ is block length). Moving one step right or one step down adds exact $\sigma$ tokens! Both rows and columns magically read as smooth, contiguous text well inside the model's comfort zone, expanding a window of size $W$ to hold up to $W^2/(4c)$ tokens (for chunk size $c$).

Datasets

Because FCA is strictly training-free, datasets are used purely for evaluation across three modalities:

  • Long Text: InfiniteBench (En.MC), SCBench (multi-turn QA and multiple-choice), and synthetic RULER needle-in-a-haystack tests injected into novels up to 512k tokens.
  • Long Video: LongVideoBench, Video-MME (long split), and a custom video needle benchmark where a TextVQA image replaces a single frame in videos up to 2,025 frames long.
  • Images (Evidence Localization): RefCOCOg and TextVQA (evaluating spatial grounding against AnswerMap).

Key Insights and Ideas

  • Prompting strategies can be compiled into attention masks: Realizing that multi-prompt aggregation is just "attention in disguise" bridges black-box prompting and white-box KV-cache serving. Emulated attention is best for closed APIs or tiny memory budgets; native attention wins on open weights and multi-turn speed.
  • The "strided approximation" barely hurts: In FCA, strided columns gather blocks that were originally encoded alongside their row neighbors, not their column neighbors. Ablations show this tiny approximation leaves local spans nearly identical to grid probing, and re-reading the top-$K$ selected blocks recovers almost any lost accuracy.
  • Geometry tames RoPE: The stair position schedule is a wonderfully clean mathematical trick—turning a 2D grid into 1D contiguous steps along both axes simultaneously so frozen positional encodings don't break on 500k+ token inputs.

Key Results

Across frozen models (Qwen3, Llama-3.1, InternVL3.5, Qwen3-VL), FCA matches grid probing's accuracy and reach at a fraction of the compute:

Figure 3. Accuracy against time, one panel per model. Time is the mean per question, where a read that reuses its encoding of a context (FCA, the monolithic and XAttention) pays for that encoding once. The dashed link gives the speed-up of FCA over the emulated read.
  • Big accuracy boosts over monolithic reads: FCA gains ~10 percentage points on LongVideoBench (56.3% vs. 46.4% on InternVL3.5-2B) and 9 to 14 points on long novels in InfiniteBench En.MC (e.g., 79.0% vs. 65.5% on Qwen3-4B).
  • Massive speedups on follow-up questions: Because the context is encoded once, answering subsequent questions on a novel takes 1/10th to 1/7th the time of Periscope (e.g., 1.1s warm TTFT vs. 16.6s on Llama-3.1-8B), and multi-turn SCBench answers arrive 5–7$\times$ faster.
  • Reading 4$\times$ past the context window: On Llama-3.1-8B (131k window), monolithic reads miss most needles past the prefix (36.4%), while FCA hits 98.5% accuracy on texts up to 512k tokens—and finds single-frame needles in 2,025-frame videos where monolithic InternVL drops by ~17 points.

Limitations and Future Work

FCA has three clear trade-offs:

  1. Requires open models: Unlike prompt-level grid probing, FCA modifies attention masks and position IDs, so it cannot run on closed-source APIs.
  2. Memory footprint: It stores the KV cache of the entire input in GPU memory (around 42 GB for InfiniteBench novels, compared to 12–20 GB for single-span probing).
  3. Approximate strided spans: Column blocks don't attend to each other during encoding (fixing this requires a second encoding pass, doubling prefill cost).

For future work, the authors suggest training models natively with the FCA pattern, translating other prompting workflows into native attention masks, and exploiting the fact that FCA's rows are completely independent—allowing the KV cache to grow seamlessly with streaming data or be sharded effortlessly across multiple GPUs.

Summary updated

Abstract

Models read a book, an hour of video, or an image in one forward pass. As the context grows, this pass slows down, loses accuracy, and stops at the context window. Sparse attention is efficient, but keeps the other two limitations. Grid probing, a recent training-free method, recovers the accuracy and extends the reach by asking a frozen model the same question about short local and strided spans of the input, but every question repeats the whole computation, since each span is encoded again. Our insight is that grid probing is emulated attention, an attention pattern reproduced from outside the model through prompts, since each probe only restricts which part of the input the question can see. We introduce Factorized Context Attention (FCA), a training-free block-sparse attention that runs the same pattern natively, as the attention of the model itself. FCA encodes the input once into a KV cache, reads all spans as masked sequences in one batched forward, and uses a stair position schedule to keep every span inside the trained position range. Across long video understanding, long-context text inference and image grounding, FCA matches the accuracy and the reach of grid probing at a fraction of its cost. It gains about 10 points over the single pass on long video and 9 to 14 points on long novels, finds needles in videos of over a thousand frames and in texts four times the length of the window, and answers a later question about the same input in as little as a tenth of the time of grid probing. Native attention thus keeps what emulated attention gains without its cost, all with existing frozen language and vision-language models.
BibTeX
@misc{eltahir2026factorized,
  author = {Mohamed Eltahir and Manar Eyad and Yara Alzahrani and Fatimah Albesher and Duaa M. Tahir and Tanveer Hussain and Naeemullah Khan},
  title = {{Factorized Context Attention: From Emulated to Native Grid Probing}},
  year = {2026},
  eprint = {2611.32423},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.32423},
}

Loading related content...

Figure