-
-
Notifications
You must be signed in to change notification settings - Fork 7
Memory Colbert
For queries requiring maximum precision, Spector implements a native, hardware-accelerated ColBERT v2 reranking layer. By executing token-level late-interaction calculations directly in cache-aligned memory, Spector avoids the latency and complexity of traditional cross-encoder neural rerankers.
Unlike single-vector embedding models (which compress a whole document into a single vector) or cross-encoders (which feed the query and document together into an LLM), ColBERT generates a separate vector for every single token in the query and document.
At query time, the similarity is calculated using the MaxSim operator:
[Score(Q, D) = \sum_{i=1}^{|Q|} \max_{j=1}^{|D|} \left( q_i \cdot d_j^T \right)]
Where:
-
$q_i$ is the embedding vector for the$i$ -th query token. -
$d_j$ is the embedding vector for the$j$ -th document token. -
$q_i \cdot d_j^T$ is the cosine similarity (or dot product) between the query token vector and the document token vector.
Query Tokens Document Tokens
[Where] ───────┐ [The]
├──Max── [flight] (highest similarity dot-product)
[is] ───────┼──Max── [status]
[my] ───────┼──Max── [is]
[flight] ───────┼──Max── [delayed]
[status] ───────┘
│
▼ (Sum over query tokens)
Final Score
Late interaction preserves fine-grained token-level associations. This allows Spector to identify documents where specific words align correctly, achieving cross-encoder accuracy with a fraction of the computational overhead.
To execute late-interaction scoring at microsecond speeds, Spector employs two major optimizations:
Spector parallelizes the MaxSim dot-product search loop using hardware SIMD registers (such as AVX2 or AVX-512). The scoring kernel processes multiple query and document tokens concurrently in registers, evaluating millions of token comparisons in under 200 microseconds per candidate list.
Generating token embeddings for documents on every search is highly expensive. Spector's ingestion pipeline extracts token vectors and caches them in contiguous memory blocks. At search time, Spector reads these token vectors directly without creating garbage collection pressure or serialization overhead.
ColBERT reranking is configured globally or requested for individual queries.
spector:
memory:
colbert-enabled: true # Toggle native ColBERT capabilityConfigure ColBERT via query-level options:
-
enableReranker: Set totrueto activate ColBERT reranking on the candidate set. Defaults tofalse(opt-in for cost/latency trade-offs). -
rerankerDepth: The number of top candidates pre-fetched by first-stage retrievers to pass to the reranker (typically10to50). -
textSearchMode: Setting this toCOLBERT_RERANKorFULL_STACKautomatically enables first-stage hybrid search combined with late-interaction ColBERT reranking.
- Home
- Getting Started
-
Cognitive Memory
- Overview
- Getting Started
- Use Cases & Configuration
- API Reference
- Architecture
- The 6-Phase Scoring Pipeline
- Retrieval Stack
- Cognitive Profiles
- Salience & Importance
-
Biological Systems
- Overview
- Cortex — Tier Stores
- Hippocampus — Sleep Consolidation
- Synapse — Tags & Scoring
- Dopamine — Surprise Detection
- Amygdala — Emotional Valence
- 4-Layer Cognitive Graph
- Habituation — Anti-Filter Bubble
- Inhibition — Suppression
- Interference — Deduplication
- Prospective — Future Intents
- Metamemory — Self-Reflection
- Sync — Persistence & Replication
- Performance & Internals
- Cognitive Evaluation
- Synapse & Cortex
- Architecture
-
Community
- Contributing
- FAQ
- Roadmap
- 🔬 Labs