A Dense Representation Framework for Lexical and Semantic Matching

Sheng-Chieh Lin, Jimmy Lin · DOI

In the world of information retrieval, there has long been a divide between two worlds: lexical matching (finding exact keyword overlaps like BM25) and semantic matching (finding meaning-based similarities using dense embeddings like BERT). While hybrid systems that combine both are the gold standard for accuracy, they usually require maintaining two entirely different "software stacks"—an inverted index for keywords and a vector database for embeddings.

A new paper from researchers at the University of Waterloo, "A Dense Representation Framework for Lexical and Semantic Matching," proposes a way to bridge this gap. They introduce a method to "densify" lexical information, allowing both keyword and semantic search to live harmoniously within a single, high-performance vector-based framework.

TL;DR

The authors propose Low-dimensional Dense Lexical Representations (DLRs), which compress high-dimensional keyword data into compact vectors that can be searched using a novel Gated Inner Product (GIP). By combining these with semantic embeddings into Dense Hybrid Representations (DHRs), they achieve state-of-the-art retrieval accuracy using a single, unified GPU-accelerated index that is faster and smaller than existing hybrid systems.

What Problem Does This Paper Address?

Traditional search systems are messy. If you want the best results, you typically run a keyword search (using Lucene/Elasticsearch) and a semantic search (using Faiss/HNSW) in parallel, then fuse their scores. This "two-stack" approach is a headache for engineers: you have to keep two indexes in sync, manage different hardware requirements, and deal with the high latency of merging results.

Furthermore, while sparse lexical models (like SPLADE) are great, they are designed for CPU-based inverted indexes. Making them work efficiently on GPUs—where modern AI models live—is difficult because GPUs prefer dense, fixed-width data over sparse, variable-length lists.

Methods

The core innovation is a two-step process to turn sparse keywords into dense vectors:

  1. Representation Slicing & Sliced Pooling: Imagine a 30,000-dimensional keyword vector. The authors divide it into $M$ slices (e.g., 768). For each slice, they record only the maximum value and the index (position) where that maximum occurred. This results in two compact vectors: a Value vector (floats) and an Index vector (integers).
  2. Gated Inner Product (GIP): To score a query against a document, they use a "gated" dot product. A dimension only contributes to the score if the "Index" values for the query and document match in that slice. This effectively mimics exact keyword matching within a dense vector space.
  3. DeLADE (Dense Lexical AnD Expansion): The authors modified the popular SPLADE model to be "denser" by design, using a softmax activation instead of ReLU, making it more robust to the densification process.
  4. Joint Training: Unlike previous work that simply glues two models together, the authors jointly train the lexical (DLR) and semantic (standard BERT [CLS] embeddings) components so they learn to complement each other's weaknesses.

Datasets

The researchers evaluated their framework on:

  • MS MARCO: The industry-standard passage ranking dataset (8.8M passages).
  • TREC Deep Learning (2019/2020): Evaluation sets with fine-grained human labels.
  • BEIR: A benchmark of 13 different datasets (like BioASQ or SciFact) used to test how well the model generalizes to new domains without further training ("zero-shot").

Key Insights and Ideas

  • Lexical Matching is Compressible: The most surprising finding is that you can compress a 3.5-million-dimensional lexical vector (like DeepImpact) into just 768 dimensions with less than a 1% drop in effectiveness.
  • The Power of the "Gate": By using the Index vector as a gate, the model retains the interpretability and precision of keyword matching while benefiting from the speed of dense vector operations.
  • Synergy through Joint Training: When trained together, the semantic component learns to handle broad context while the lexical component focuses on specific "hard" keywords. This joint model (DHR) outperformed both individual components and even beat complex multi-vector models like ColBERT in zero-shot settings.
  • GPU-First Retrieval: Because the representations are dense, the entire retrieval process can happen in PyTorch on a GPU, bypassing the need for traditional CPU-based inverted indexes entirely.

Key Results

  • Efficiency: The DHR model is significantly faster than traditional hybrids. For example, it achieved a latency of 33ms per query on MS MARCO, compared to 475ms for a standard SPLADE implementation.
  • Storage: The framework is highly memory-efficient. A 768-dimensional DHR index for MS MARCO takes up about 22 GB, whereas the multi-vector ColBERT model requires 154 GB.
  • Accuracy: On the MS MARCO leaderboard, the DHR model (jointly trained) achieved an MRR@10 of 0.357, making it competitive with state-of-the-art retrievers while being much easier to deploy.
  • Generalization: On the BEIR benchmark, the DHR model showed superior "out-of-the-box" performance compared to pure semantic models, proving that lexical signals are crucial for domain adaptation.

Limitations and Future Work

While the framework is powerful, the authors note a few areas for improvement:

  • Computational Overhead: The GIP operation requires roughly 4x more operations than a standard inner product. To mitigate this, the authors use a "two-stage" approach (approximate search followed by exact reranking), which adds some complexity to the retrieval logic.
  • Information Loss: Sliced max-pooling is a "lossy" compression. If two important keywords fall into the same slice, one is lost. Future work could explore more sophisticated pooling or "multi-head" DLRs.
  • Training Costs: While the model is efficient at inference, joint training of lexical and semantic components requires careful hyperparameter tuning and significant compute.

Overall, this work provides a compelling blueprint for the next generation of search engines: a single, unified, and incredibly fast "dense" stack that doesn't sacrifice the precision of the keywords we've relied on for decades.

Summary updated

BibTeX
@article{lin2023dense,
  author = {Sheng-Chieh Lin and Jimmy Lin},
  title = {{A Dense Representation Framework for Lexical and Semantic Matching}},
  journal = {ACM Trans. Information Systems},
  year = {2023},
  doi = {10.1145/3582426},
}
Figure