We present AutoIndex, a framework for learning representation programs: executable transformations that map raw documents into the representations exposed to a retrieval system. Rather than tuning retrievers, rerankers, or a small set of preprocessing hyperparameters, AutoIndex searches over programs that slice, enrich, normalize, reweight, or reorganize documents before indexing. At each iteration, agents diagnose failures of the current program and synthesize candidate updates, retaining only updates that improve retrieval quality under the resulting index. We evaluate on CRUMB, a benchmark of heterogeneous retrieval tasks, with BM25 held fixed across all experiments. The learned programs improve recall on all 8 tasks, with average gains of +8.4% Recall@100 and +8.3% nDCG@10, and largest gains of +30.5% and +43.6%. These results suggest that document representation should not be treated as a fixed preprocessing choice made before retrieval begins, but as an explicit optimization target.
Section 1 · Method
Each iteration diagnoses where retrieval is failing, synthesizes candidate document-representation programs, rebuilds the index, and keeps only what improves validation Recall@100.
Inspects why queries fail and writes a grounded summary.
Proposes executable programs that transform documents, stripping noise, reweighting sections, re-chunking.
Only real improvements on held-out validation survive.
Section 2 · Results
We evaluate on CRUMB, eight complex retrieval tasks with long documents and heterogeneous evidence, holding BM25 fixed throughout. Bars show relative Recall@100 improvement over a full-document BM25 baseline, for both code-generation backbones. Hover any bar for its exact gain and underlying scores.
Cite
@misc{onuallain2026autoindex, title = {{AutoIndex}: Learning Representation Programs for Retrieval}, author = {Sam O'Nuallain and Nithya Rajkumar and Ramya Narayanasamy and Hanna Jiang and Shreyas Chaudhari and Andrew Drozdov}, year = {2026}, eprint = {2607.18603}, archivePrefix = {arXiv}, primaryClass = {cs.IR}, url = {https://arxiv.org/abs/2607.18603} }