Skip to content

ColBERTScores

ColBERT contrastive scoring.

Takes (Q_query, Qt, H) queries and (Q_doc, N, Dt, H) stacked per-query document groups and returns the full (Q_query, Q_doc * N) score matrix with query-major ordering: scores[i, j*N + k] is the score of query i against the i-th entry of doc group j's k-th slot. When called with matched Q_query == Q_doc, the positive for query i sits at column i*N.

The document dimension is iterated group-by-group internally so that only one (Q_query, Q_doc, Qt, Dt) intermediate is live at a time.

Methods

call

Call self as a function.

Parameters

  • queries_embeddings ('list | np.ndarray | torch.Tensor')
  • documents_embeddings ('list | np.ndarray | torch.Tensor')
  • queries_mask ('torch.Tensor | None') – defaults to None
  • documents_mask ('torch.Tensor | None') – defaults to None