import React, { useState } from 'react'; import { Search, Zap, Layers, Sparkles } from 'lucide-react'; export const MathInspectorTab: React.FC = () => { const [selectedParadigm, setSelectedParadigm] = useState<'sparse' | 'dense' | 'learned-sparse' | 'cross-encoder'>('dense'); return (
{/* Overview Card */}

The Unified Inner-Product Formulation

Lin et al. (2021)

Modern information retrieval maps both lexical and neural models to a unified mathematical objective: Maximum Inner Product Search (MIPS) over vector spaces. Sparse, dense, and learned sparse methods differ primarily in dimensionality, sparsity, and indexing data structures.

{/* Math Equation */}
Score(q, d) = ⟨ EQ(q), ED(d) ⟩ = ∑i EQ(q)i · ED(d)i
{/* Paradigm Tabs */}
{/* Details Box */}
{selectedParadigm === 'sparse' && (

Unsupervised Sparse Retrieval (BM25)

Dimensionality: |V| ≈ 30,000+ words
Sparsity: > 99.9% zeros
Index Structure: Inverted Posting Lists (Lucene)

In BM25, query and document vectors lie in high-dimensional lexical vocabulary space. Only non-zero entries correspond to tokens present in the document. The dot product is evaluated via inverted posting lists without scanning non-matching documents.

E_Q(q)_i = 1 (if token i ∈ q, else 0)
E_D(d)_i = IDF(i) · [ TF(i,d)·(k₁+1) / (TF(i,d) + k₁·(1 - b + b·|D|/avgdl)) ]
)} {selectedParadigm === 'dense' && (

Supervised Dense Retrieval (Bi-Encoder)

Dimensionality: d = 768 continuous floats
Sparsity: 0% zeros (fully dense)
Index Structure: HNSW Proximity Graph (Faiss)

Dense retrieval projects text into low-dimensional semantic vector spaces via dual transformers: E_Q(q) = Transformer_Q(q) and E_D(d) = Transformer_D(d). Because all coordinates are non-zero, inverted lists cannot be used. Instead, approximate nearest neighbor (ANN) search algorithms like HNSW traverse multi-layer proximity graphs in logarithmic time.

)} {selectedParadigm === 'learned-sparse' && (

Learned Sparse Representations (SPLADE)

Dimensionality: |V| = 30,522 (WordPiece Vocab)
Sparsity: ~95% zeros (regularized)
Index Structure: Lucene Impact Index

SPLADE combines the efficiency of inverted indexes with deep contextual vocabulary expansion. A masked language model predicts non-negative weights over the full vocabulary, expanding terms with synonyms and related concepts. In Anserini, floating-point weights are quantized to integers and indexed directly in Lucene as synthetic term frequencies.

)} {selectedParadigm === 'cross-encoder' && (

Cross-Encoder Listwise Reranking (RankLLM / monoT5)

Architecture: Joint Full Attention (q × d)
Complexity: O((|q| + |d|)² · L) per document
Index Structure: None (2nd-stage reranker on Top-K)

Unlike bi-encoders which compute independent representations, cross-encoders concatenate query and passage into a single transformer context. Every token attends directly to every other token, capturing nuanced nuances, negation, and syntactic dependencies at higher inference cost.

)}
); };