rag_embedding_search

mediumruntimePython
results

Measured by wall-clock runtime in seconds — lower is better.

40.0s2.5s

Usage

Run the reference answer to verify your environment is set up correctly

$ harbor run -p tasks/rag_embedding_search

Test model

$ harbor run -p tasks/rag_embedding_search \
  -a claude-code -m claude-opus-4-6

Description

Given a pre-computed embedding matrix of 500,000 documents (768-D, float32) and 1,000 query embeddings, find the top-10 documents by cosine similarity for each query. The baseline normalizes and loops over queries one at a time with full dot-product search. The reference uses batched matmul with pre-normalized embeddings, int8 coarse scoring with float32 re-ranking of top candidates.

Files

path
permission
/app/solve.py✎ Edit
/app/main.pyRead-only
/app/corpus_embeddings.npyRead-only

Rules

  • 01Edit /app/solve.py only.
  • 02Allowed imports: numpy only. No faiss, sklearn, or compiled extensions.
  • 03Top-10 results per query must match reference exactly. Wrong results score 0.

Tags

RAGembeddingsimilarity-searchMIPSretrievalLLM