Muninn / README.md
jbellis-brokk's picture
Publish Muninn v1
81b9ccb verified
|
Raw
History Blame Contribute Delete
5.41 kB
metadata
license: apache-2.0
library_name: sentence-transformers
pipeline_tag: sentence-similarity
base_model: voyageai/voyage-4-nano
tags:
  - sentence-transformers
  - code-retrieval
  - multilingual
  - matryoshka
datasets:
  - BrokkAI/Quarry

Muninn

Muninn is a 346M-parameter multilingual retriever for natural-language-query → code-function retrieval, with an 8,192-token serving context and 2,048-dimensional embeddings.

It is trained from voyageai/voyage-4-nano and uses a bidirectional Qwen3 encoder. Muninn supports Matryoshka truncation at 512, 1,024, 1,536, and 2,048 dimensions. We recommend 2,048 dimensions: that is the native evaluation setting, and truncating to 512 cost roughly two recall points at depth on Quarry.

Usage

Muninn requires trust_remote_code=True because this repository includes the custom Qwen3BidirectionalModel implementation.

from sentence_transformers import SentenceTransformer

model = SentenceTransformer(
    "BrokkAI/Muninn",
    trust_remote_code=True,
    truncate_dim=2048,
)
model.max_seq_length = 8192

queries = ["Where is retry backoff calculated for failed HTTP requests?"]
documents = [
    "src/net/client.py/HttpClient/retry_delay\n"
    "class HttpClient:def retry_delay(self, attempt):\n"
    "    return min(60, 2 ** attempt)"
]

query_embeddings = model.encode(queries, prompt_name="query", normalize_embeddings=True)
document_embeddings = model.encode(
    documents, prompt_name="document", normalize_embeddings=True
)
scores = model.similarity(query_embeddings, document_embeddings)
print(scores)

The exact inference prompts are:

query:    Represent the query for retrieving supporting documents: 
document: Represent the document for retrieval: 

Document format

Quarry results use the header format produced by swerank_document_text() before the document prompt is applied. For a free function:

{path}/{function_name}
{source}

For a class method:

{path}/{ClassName}/{function_name}
class {ClassName}:{source}

The worked usage example above is therefore the exact representation of a method named HttpClient.retry_delay in src/net/client.py. Preserve this shape when comparing against reported results.

Quarry results

Quarry contains 6,525 synthetic behavioral queries over real repository revisions. The metric is strict all-gold micro recall@k: for each query, |gold ∩ top-k| / |gold|, followed by a flat mean over queries. Models use their native dimensions and the header document format above.

We measured every row ourselves with the Quarry harness. Muninn leads a field that includes much larger open models and commercial APIs.

Model Params recall@5 recall@20 recall@50
Muninn 346M 61.4 82.6 90.7
voyage-code-3 API 59.1 81.8 90.4
voyage-4 API 59.0 80.8 90.0
SweRank-Large 7B 58.5 80.6 89.6
Nemotron-3-Embed-1B 1B 58.3 79.9 88.7
bge-code-v1 1.5B 58.2 79.8 88.7
voyage-4-nano (base) 346M 57.5 79.7 89.0
voyage-4-lite API 57.3 79.6 89.0
Qwen3-Embedding-8B 8B 56.0 78.2 88.1
SweRank-Small 137M 53.5 74.6 83.9
Muninn-small 47M 52.3 74.6 84.7
text-embedding-3-large API 51.7 74.3 85.0
Qwen3-Embedding-0.6B 0.6B 50.9 72.8 83.8
granite-embedding-small-english-r2 (Muninn-small base) 47M 47.7 69.7 80.5

Other benchmarks

† marks published numbers (SweRank paper for the localization benchmarks; the CoIR leaderboard and the Qwen3-Embedding paper elsewhere). Unmarked rows are our measurements on the same protocol as the corresponding published numbers.

SWE-Bench-Lite localization — 274 Python issues, function-level accuracy:

Model Acc@5 Acc@10
Muninn (346M) 73.4 79.6
SweRank-Large (7B)† 71.9 82.1
SweRank-Small (137M)† 63.1 74.5
Muninn-small (47M) 48.5 61.0

LocBench — 560 Python issues, function-level accuracy:

Model Acc@10 Acc@15
SweRank-Large (7B)† 63.2 67.3
Muninn (346M) 60.2 65.7
SweRank-Small (137M)† 58.6 63.4
Muninn-small (47M) 46.4 51.6

CoIR text-to-code — NDCG@10:

Model APPS CosQA
bge-code-v1 (1.5B)† 98.1 46.7
voyage-code-3 (API)† 93.6 34.5
Qwen3-Embedding-8B† 91.1 38.0
Muninn (346M) 77.4 31.3
Qwen3-Embedding-0.6B† 75.3 36.5
Muninn-small (47M) 12.4 35.1

CodeSearchNet — mean NDCG@10 over six languages (Python, JavaScript, Go, Ruby, Java, PHP; 1,000 queries per language):

Model Mean NDCG@10
Qwen3-Embedding-8B† 92.7
Qwen3-Embedding-0.6B† 91.0
Muninn (346M) 90.1
SweRank-Small (137M) 87.9
SweRank-Large (7B) 85.0
Muninn-small (47M) 77.8

Languages

C, C++, C#, Go, Java, JavaScript, PHP, Python, Rust, Scala, and TypeScript.

License and attribution

Muninn is released under the Apache License 2.0. It is derived from voyageai/voyage-4-nano, also released under Apache-2.0. See LICENSE for the full license text.