Nectar: Neural Estimation of Cached-Token Attention via Regression
Jo\~ao Monteiro, Michal Klein, Pierre Ablin, Marco Cuturi

TL;DR
Nectar introduces neural networks to efficiently approximate cached-token attention, significantly reducing inference costs for long-context models while maintaining accuracy.
Contribution
It presents a novel neural estimation method that replaces traditional attention over caches with compact networks, enabling faster inference in large language models.
Findings
Nectar reduces attention computation from O(n) to constant time per query.
The approximation error correlates with next-token prediction accuracy.
Models with Nectar generate semantically similar text to full attention models.
Abstract
Evaluating softmax attention over a fixed long context requires reading every cached key-value pair for each new query token. For a given context (a book, a manual, a legal corpus) the attention output is a deterministic function of the query. We propose Nectar, which fits a compact neural network to this function for queries drawn from a task-relevant distribution. Nectar fits two networks per layer and KV-head: a target network that predicts the attention output and a score network that predicts the log-normalizer. The pair plugs into the standard masked self-attention at inference time, replacing the attention over the cache with a forward pass whose cost does not depend on . Each module carries on the order of parameters per layer and KV-head, typically much smaller than the KV-cache footprint at the same granularity. We report experiments on models from…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
