On the Computational Complexity of Retrieval-Augmented Generation

Retrieval-augmented generation (RAG) combines stochastic document retrieval with conditional answer generation. We investigate the global complexity of exactly fitting a finite stochastic document-mixture model to a rational query--answer probability table. Unrestricted exact fitting is complete for the existential theory of the reals, by an explicit normalization-preserving equivalence with exact nonnegative matrix factorization. Under corpus-constrained retrieval, fitting remains NP-complete when each query mixes at most two documents; this holds with only three answer classes and strictly positive probabilities. In contrast, one-document retrieval, two freely learned document components, and two-document retrieval with fixed component distributions admit polynomial-time solutions. We derive closed-form optimal mixing weights, an exact binary linear formulation for corpus selection, and monotone conditional optimization updates. The hardness classifications also persist for a restricted query-conditioned generator with a frozen language-model distribution and a fixed, query-dependent evidence decoder. We relate these abstractions to normalized top-K document marginalization, score-based retrieval, and finite-answer probability models, while explicitly distinguishing them from unrestricted transformer generation. The results identify global fitting barriers in a mathematically specified RAG family without claiming hardness of ordinary inference or arbitrary generative architectures.

Authors

Publication Details

Journal
Preprints.org
Published
2026-11-25
DOI
https://doi.org/10.20944/preprints202611.2579.v1
Primary Topic
Topic Modeling
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

On the Computational Complexity of Retrieval-Augmented Generation

Angshul Majumdar
Preprints.org
Topic Modeling
preprint

On the Computational Complexity of Retrieval-Augmented Generation

Angshul Majumdar
preprint en

Abstract

Retrieval-augmented generation (RAG) combines stochastic document retrieval with conditional answer generation. We investigate the global complexity of exactly fitting a finite stochastic document-mixture model to a rational query--answer probability table. Unrestricted exact fitting is complete for the existential theory of the reals, by an explicit normalization-preserving equivalence with exact nonnegative matrix factorization. Under corpus-constrained retrieval, fitting remains NP-complete when each query mixes at most two documents; this holds with only three answer classes and strictly positive probabilities. In contrast, one-document retrieval, two freely learned document components, and two-document retrieval with fixed component distributions admit polynomial-time solutions. We derive closed-form optimal mixing weights, an exact binary linear formulation for corpus selection, and monotone conditional optimization updates. The hardness classifications also persist for a restricted query-conditioned generator with a frozen language-model distribution and a fixed, query-dependent evidence decoder. We relate these abstractions to normalized top-K document marginalization, score-based retrieval, and finite-answer probability models, while explicitly distinguishing them from unrestricted transformer generation. The results identify global fitting barriers in a mathematically specified RAG family without claiming hardness of ordinary inference or arbitrary generative architectures.

Preprints.org
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon