Apple researchers presented a paper at ICML 2026 describing two small neural network approaches that speed up maximum inner product search (MIPS) for retrieval-augmented generation (RAG). The work, Amortizing Maximum Inner Product Search with Learned Support Functions, trains networks offline on a fixed database of keys, then uses them at inference time to route queries toward their best match faster than centroid-based methods.
Support Functions as a Learning Target
MIPS systems compare a query vector against millions of candidate key vectors to find the best match. Exhaustive comparison becomes costly as keys grow to millions and dimensions reach thousands. Typical approximate methods cluster keys and compare queries to centroids, but this ignores the query distribution. In RAG, queries are short user questions while keys are long curated passages, so the two sets differ substantially.
The researchers observed that the function mapping a query to the largest inner product with any key is the support function of that set, a convex object from convex analysis. Its gradient returns the best-matching key. They train neural networks to mimic this support function or its gradient directly, using regression on precomputed query-key pairs.
Two architectures emerged. SupportNet learns the support function using input convex neural networks (ICNNs), which align with the convex structure of the problem. KeyNet learns to output the best-matching key vector directly, with a consistency loss derived from Euler's theorem for homogeneous functions keeping predictions geometrically grounded.
Learned Routing Replaces Centroids
SupportNet learns the support functions of each cluster jointly, outputting k scores at once. Instead of comparing a query to centroids, the router uses the largest of these k scores to decide which clusters to probe. This answers a more useful question: how good is the best key inside this cluster for this query.
On the Natural Questions benchmark with roughly 2.6 million passages partitioned into 128 clusters, SupportNets of increasing sizes (XS, S, M, L, corresponding to 1%, 5%, 10%, 20% of database size) were trained. The small model hit 95% routing recall about 1.9 times faster than centroid routing, at 1.74 ms versus 3.36 ms per query. The large model reached 97% recall in 1.74 ms. These figures include the compute overhead of running the networks.
At a fixed budget of explored clusters, learned routers found the correct partition more often. Scanning just 5% of the database, they recovered the true partition 90 to 93% of the time, up to 92.6% for the mid-size model, versus 87.5% for the centroid baseline.
KeyNet as a Query Rewriter
KeyNet works differently: it keeps the existing inverted file index (IVF) system unchanged and feeds it a modified query. The network predicts where the best match is likely to be in embedding space, then the IVF system searches there instead of starting from the original query. This makes the search easier because the transformed query is closer to its target.
KeyNets of the same size family were evaluated on recall-cost tradeoffs. Reaching 99% recall took up to about 8 times less time with the largest model compared to the baseline, at 0.2 ms per query. Both approaches are trained on examples drawn from the relevant query distribution, with ground-truth best matches computed once via exhaustive search and stored as a supervised dataset.
Sources & references
Apple: Faster Retrieval for Better, More Efficient RAG ↗Source consulted: 2026-11-11



