Module maxsim

Module maxsim 

Source
Expand description

MaxSim scoring for ColBERT-style late interaction models.

MaxSim computes similarity between multi-vector embeddings by taking the maximum similarity for each query token across all document tokens:

MaxSim(Q, D) = sum_{q_i in Q} max_{d_j in D} (q_i · d_j)

This module provides:

  • maxsim - Compute MaxSim score between two multi-vectors
  • maxsim_batch - Compute MaxSim scores against multiple documents
  • MaxSimScorer - Reusable scorer with pre-computed query data
  • [MaxSimScan] - Operator for multi-vector similarity search

Structs§

MaxSimScorer
A reusable MaxSim scorer with pre-computed query data.

Functions§

distance_to_maxsim
Convert a distance back to MaxSim score.
maxsim
Compute the MaxSim score between a query and document multi-vector.
maxsim_batch
Compute MaxSim scores between a query and multiple documents.
maxsim_cosine
Compute MaxSim with normalized vectors (for cosine-like similarity).
maxsim_to_distance
Convert MaxSim score to a distance (lower is more similar).