Multi-Vector Retrieval (C++ Implementation)
This page documents the C++ implementation of multi-vector retrieval and evaluation in the VectorSearch system.
Overview
We implemented multi-vector aggregation in C++ to improve retrieval robustness when a query is represented by multiple semantically similar vectors.
How It Works
🔹 Query Aggregation
A set of query vectors (e.g., ID 0–4) is treated as one logical query. Each base vector is scored based on the average L2 distance to these multiple queries.
for (int i = 0; i < prep.data.N; ++i) {
float total_dist = 0.0f;
for (const auto& qvec : multi_query) {
total_dist += cal_distSqrt(qvec.data(), prep.data.val[i], prep.data.dim);
}
score_all[i] = { total_dist / multi_query.size(), i };
}