Making Transformer Decoders Better Differentiable Indexers

Wuchao Li, Kai Zheng, Defu Lian, Qi Liu, Wentian Bao, Enyun Yu, Yang Song, Han Li, Kun Gai

TL;DR

The URI (Unified framework for Retrieval and Indexing) framework transforms Transformer decoders from passive memorizers of pre-built indices into active, differentiable indexers. By unifying index construction and retrieval training into a single end-to-end process, URI achieves massive performance gains—improving Recall@10 by up to 83.7% over existing state-of-the-art generative retrieval methods.

The Bottleneck in Generative Retrieval

In large-scale search and recommendation, the primary goal is to retrieve the "top-k" most relevant items from a pool of millions. Traditionally, this is achieved using Dual-Tower models, where queries and items are encoded into dense vectors, and retrieval relies on Approximate Nearest Neighbor (ANN) search.

Recently, Generative Retrieval has emerged as a powerful alternative. Instead of relying on vector distances, items are represented as sequences of tokens (acting as a "semantic ID"). A Transformer decoder is then trained autoregressively to "generate" the exact ID of the correct item given a user query.

However, current generative methods suffer from a critical "decoupling" problem. They operate in a disjointed, two-stage pipeline:

  1. Static Indexing: Items are clustered (usually via K-means in Euclidean space) to create their hierarchical IDs before the retrieval model is even trained.
  2. Memorization: The retrieval model is then forced to memorize these pre-defined, static IDs.

The authors argue this paradigm is fundamentally suboptimal. Euclidean distance is often too simplistic to capture complex, real-world query-item relationships. Furthermore, the model's overall capacity is artificially limited because it cannot influence how the index is structured to better suit its own retrieval logic.

The URI Solution: Unifying Retrieval and Indexing

To address this decoupling, the authors propose URI (Unified framework for Retrieval and Indexing). The core philosophy of URI is that the index should be built within the interactive space between queries and items, rather than in an isolated, one-sided item-representation space.

Architecture of the Unified framework for Retrieval and Indexing (URI).

Key technical components of the URI framework include:

  • Differentiable Indexing: URI uses the same Transformer decoder to both build the index and perform retrieval. It simulates an Expectation-Maximization (EM) algorithm where the model iteratively refines which "bucket" (token) an item belongs to based on active query interactions.
  • Novel Loss Functions: The framework employs specific loss functions to guide the indexing. A commit loss encourages an item to "commit" to a specific token (approaching a one-hot distribution), while a balance loss ensures items are distributed evenly across buckets to prevent "index collapse" (a scenario where all items end up assigned to the same ID).
  • Layer-by-Layer Training: Because the optimal tokens for the next level of a hierarchical index aren't known until the current level is established, URI trains the index one layer at a time. This ensures semantic consistency down the tree.
  • Average Partition Entropy (APE): The authors introduce a new, model-independent metric to measure how well an index concentrates relevant items into the same buckets, proving URI's superiority in creating "pure" clusters.

Key Insights: The "Interactive Space" Advantage

Traditional indexing only looks at item-to-item similarity. URI, however, looks at query-to-item similarity. By clustering items based on which queries they actually satisfy, the resulting index is naturally more "retrievable."

Furthermore, URI demonstrates remarkable Index Portability. One of the most striking findings in the paper is that if you extract the index built by URI and use it to train other baseline models (like DSI or NCI), those models also experience a performance boost. This proves that URI doesn't just train a better model; it creates a fundamentally superior, universally applicable indexing structure.

Experimental Results

The researchers evaluated URI on three distinct real-world tasks: KuaiSAR (short-video search), Amazon Beauty (general recommendation), and Amazon Toys and Games (sequential recommendation). These datasets represent a robust mix of text-heavy search and behavior-based recommendation.

Performance comparison of URI against baseline models across three datasets.

URI significantly outperformed all baselines (including DSI, NCI, TIGER, and RecForest) across all datasets:

  • Massive Gains: On the KuaiSAR dataset, URI improved Recall@10 by an impressive 83.7% over the best-performing baseline.
  • Consistent SOTA: It achieved state-of-the-art results on all three datasets, proving its versatility across different retrieval paradigms.
  • Indexing Efficiency: The APE metric confirmed that URI's indices are much more "pure"—meaning relevant items for a specific query are significantly more likely to be grouped together in the same bucket compared to traditional K-means or VQ-VAE methods.

Limitations and Future Work

While URI offers a massive leap in performance, it does come with increased training complexity. Because URI requires layer-by-layer training to build the hierarchy, it introduces a constant overhead (roughly $2L$ times the complexity of a single pass, where $L$ is the number of layers). While the authors argue this computational cost is acceptable given the drastic performance gains, it is inherently slower than one-stage training pipelines.

For future work, the authors aim to develop methods that allow URI to generate multi-level tokens simultaneously (end-to-end across all layers) to accelerate the training process without sacrificing the quality of the differentiable index.

Summary updated

BibTeX
@inproceedings{li2025making,
  author = {Wuchao Li and Kai Zheng and Defu Lian and Qi Liu and Wentian Bao and Enyun Yu and Yang Song and Han Li and Kun Gai},
  title = {{Making Transformer Decoders Better Differentiable Indexers}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=bePaRx0otZ},
}
Figure