---
title: Recursive Residual Searching (RRS)
url: https://www.emergentmind.com/topics/recursive-residual-searching-rrs
type: topic
---

# Recursive Residual Searching (RRS)

Recursive Residual Searching (RRS) is a class of recursive, data-driven or data-free algorithms for iteratively decomposing function outputs, residuals, or embeddings into interpretable, structured components or paths. Prominent applications of RRS span semantic indexing for large language models, jet expansions for residual computation in deep networks, and hybrid linear/nonlinear time-series forecasting. RRS is united by its recursive structure: at each stage, it evaluates multiple candidate expansions/decompositions, scores or prioritizes based on domain-specific criteria, and prunes or selects to efficiently identify dominant, unique, or interpretable contributions in complex models [2509.16446][2410.06024][2410.17159].

## 1. Formal Definitions and Mathematical Foundations

In the context of semantic indexing, RRS operates on an embedding $e \in \mathbb{R}^d$, which is recursively quantized at each of $L$ levels. At each level $l$, a candidate set of $k_l$ nearest centroids in a codebook $\mathcal{C}^{(l)}$ is identified, producing a residual vector via
$$
r^{(l+1)} = r^{(l)}(e) - c^{(l)}_{r},\ \text{with}\ r^{(1)}(e) := e,
$$
where $c^{(l)}_{r}$ denotes the chosen centroid at level $l$ [2509.16446]. The overall goal is to construct an $L$-token code (ID) for $e$ such that all assignments in a dataset are unique, avoiding ID conflicts without breaking semantic fidelity by adding non-semantic tokens.

In neural network interpretability, RRS is formalized via jet expansions, where the functional output of a residual network $q: \mathbb{Z} \to \mathbb{R}^c$ is expanded as a sum over polynomial “jet paths.” This yields an explicit sum over all $2^L$ computational paths in a depth-$L$ residual net, with each path corresponding to a sequence of skip/take decisions at each block [2410.06024]. The expansion is:
$$
q(z) = \sum_{e \in \Xi_L} U \cdot e(\cdot, w) + \delta_L(\cdot, w),
$$
where $U$ is the unembedding, $e$ denotes each jet path polynomial, and $\delta_L$ captures the remainder.

In time-series forecasting, RRS underlies frameworks such as LiNo, alternating recursive extraction of linear (LiBlock) and nonlinear (NoBlock) components at each step:
$$
\begin{align*}
R^{(0)} &= \text{input embedding}, \\
L^{(k)} &= \text{LiBlock}(R^{(k-1)}), \\
N^{(k)} &= \text{NoBlock}(R^{(k-1)}), \\
R^{(k)} &= R^{(k-1)} - L^{(k)} - N^{(k)}.
\end{align*}
$$
As $K \to \infty$, $R^{(K)} \to 0$, reflecting full decomposition of the original signal [2410.17159].

## 2. Core Algorithmic Procedures

The essential mechanism in RRS is a recursive, beam- or depth-first search through possible expansions at each level. The following table summarizes the RRS procedures in three domains:

| Application Domain                            | RRS Step                                      | Key Decision Criterion                 |
|------------------------------------------------|-----------------------------------------------|----------------------------------------|
| Semantic Indexing [2509.16446]                | Recursively select among $k_l$ nearest centroids at each level, backtracking on conflict | Uniqueness among assigned codes        |
| Jet Expansion in Residual Nets [2410.06024]   | Recursively expand paths by “skip/take” at each residual block using jet operators      | Path contribution (polynomial norm)    |
| Time Series Decomposition (LiNo) [2410.17159] | Alternately apply linear and nonlinear extraction, recurse on residuals                 | Minimize residual energy (implicitly)  |

In semantic indexing, for embedding set $\mathcal{E}$, RRS maintains a global set of assigned codes and recursively attempts to build a unique $L$-level ID for each $e \in \mathcal{E}$, always starting with the locally closest centroids and backtracking upon conflict. In jet expansion, RRS explores the exponentially many computational paths efficiently, scoring partial paths and prioritizing those with greatest effect on output. In time series, RRS is realized as a fixed-depth cascade, updating residuals at each step.

## 3. Theoretical Guarantees and Structural Properties

RRS algorithms guarantee uniqueness of assignments in indexing tasks, since a code is only accepted if not in the set of assigned IDs. Jet expansion RRS is exact for linear residual networks (remainder term vanishes for $k\geq1$) and approximate for nonlinear networks with explicit, controllable error [2410.06024]. In LiNo, by construction $R^{(K)} \to 0$ as $K\to\infty$, ensuring that all information is captured in the extracted components [2410.17159].

A key property in jet-based RRS is (super-)exponential path growth: for depth $L$ and truncation order $k$, the number of unique monomials in the expansion is $\sum_{\ell=0}^L {L \choose \ell} {\ell+k \choose k}$, which scales as $2^L L^{O(1)}$ for fixed $k$, and super-exponentially if $k$ scales with $L$.

## 4. Empirical Behavior and Benchmarks

RRS in semantic indexing delivers strong empirical improvements in both overall and cold-start scenarios. For instance, Recall@5 on Amazon-Sports (RQ-VAE indexer) improved from 0.0124 to 0.0133 (+7.3%), and cold-start Recall@5 on Amazon-Toys increased by 25% [2509.16446]. In some domains, RRS yields even higher accuracy than exhaustive, globally optimal approaches (ECM), particularly where the latent space is structured and code conflicts are sparse.

In jet expansion, RRS enables identification and ranking of the most influential “jet paths,” allowing efficient interpretability without exhaustive enumeration of all $2^L$ paths. In recursive time-series decomposition, models leveraging RRS with more recursion depths outperform shallow decompositions, especially in data with multi-periodicities [2410.17159].

## 5. Computational Complexity and Practical Scalability

RRS exhibits favorable scaling in practice compared to exhaustive approaches:
- In semantic indexing, in the best case (low conflicts), RRS requires $O(N\sum_l k_l)$ distance computations versus $O(N\prod_l k_l)$ for ECM, where $N$ is the number of embeddings and $k_l$ is the candidate count per level [2509.16446].
- In jet expansion, the number of active “centers” (paths) doubles at each depth, but pruning strategies or beam search restrict computational cost, as only the highest-contributing paths are expanded [2410.06024].
- In LiNo, recursion depth $K$ is typically small (2–4), and each block (Li/No) is realized via fast convolutional or transformer layers [2410.17159].

Caching of intermediate Jacobians or Hessians (in jet expansions), candidate pruning, and limiting depth/candidate counts are all used in practice to limit memory and computation.

## 6. Limitations and Open Research Directions

While effective, RRS is fundamentally greedy. It does not guarantee global optimality with respect to the total residual norm in the presence of heavy code conflicts (semantic indexing) or complex nonlinear interactions (jet/path expansions). Tuning candidate widths $k_l$ is required for balancing efficacy and efficiency, and runtime can increase substantially in high-conflict regimes [2509.16446].

Open questions include:
- Adaptive tuning of $k_l$ per level based on observed conflicts.
- Integration of lightweight global scoring into the DFS branch ordering of RRS.
- Extension to variable-length codes (hierarchical trees) or to structured model families.
- Formal approximation bounds versus exhaustive globally-optimal solutions.

A plausible implication is that as models and datasets become more heterogeneous, hybrid methods dynamically combining RRS and ECM or other heuristics may be necessary for optimal trade-offs.

## 7. Connections to Broader Methodologies

RRS subsumes and extends earlier approaches:
- In network interpretability, zeroth-order ($k=0$) jets recover logit-lens and early-exit methods, showing that jet expansion RRS forms a strict generalization [2410.06024].
- In time series, RRS overcomes limitations of one-shot “trend+season” decomposition by recursively alternating linear/nonlinear extraction, improving robustness to diverse data [2410.17159].

By operating directly on model functionals or representations without the need for auxiliary data, retraining, or sampling, RRS provides a unified, scalable paradigm for analysis and indexing in high-dimensional, multi-stage systems.

Source: https://www.emergentmind.com/topics/recursive-residual-searching-rrs