Benchmarks

April 30, 2026 · View on GitHub

Quality and speed benchmarks for semble.

Main results

Quality and speed across all methods.

MethodNDCG@10IndexQuery p50
CodeRankEmbed Hybrid0.86257 s16 ms
semble0.854263 ms1.5 ms
CodeRankEmbed0.76557 s16 ms
ColGREP0.6935.8 s124 ms
BM250.673263 ms0.02 ms
grepai0.56135 s48 ms
probe0.387207 ms
ripgrep0.12612 ms
Speed vs quality (cold)Speed vs quality (warm)
Time to first result (index + query) vs NDCG@10Query latency on a warm index vs NDCG@10

The 137M-param CodeRankEmbed Hybrid wins NDCG@10 by 0.008. semble wins index time by 218x and query latency by 11x.

NDCG@10 is averaged across all queries. Speed numbers use one repo per language, CPU only: cold-start index time and warm query p50 (median across 5 consecutive runs).

Token efficiency

Coding agents (Claude Code, OpenCode, etc.) typically find code by running grep on keywords and reading the matched files. We model that workflow and compare it against semble's chunk retrieval across our full benchmark of 1251 queries.

Token efficiency: recall vs. retrieved tokens

Expected tokens per query

For each query: tokens consumed at first relevant hit, or 32k if the method never finds anything. Averaged across all 1251 queries.

MethodExpected tokensSavings
ripgrep + read file45,692baseline
semble56698% fewer

Recall at fixed token budgets

A relevant file is "covered" once any retrieved unit comes from it.

Method5001k2k4k8k16k32k
semble0.6850.8490.9380.9760.9910.9960.996
ripgrep + read file0.0010.0080.0370.0880.2120.3790.583
Methodology

semble returns the top-50 ranked chunks. ripgrep+read splits the query into keywords (dropping stopwords and short words), runs rg --fixed-strings --ignore-case for each keyword, then reads matched files in full ranked by how many distinct keywords they contain. Both methods search the same set of file types and ignored directories. Tokens are counted with cl100k_base via tiktoken. A relevant file is "covered" once any retrieved unit overlaps its annotated span.

By language

NDCG@10 per language, sorted by CodeRankEmbed Hybrid (CRE in the table). Best score per row is bolded.

LanguagesembleCRE HybridCREColGREPgrepaiproberipgrep
scala0.9090.9220.8450.7650.3300.3920.180
cpp0.9150.9130.8460.6260.7310.3750.126
ruby0.9090.9090.7690.7080.6430.3820.230
elixir0.8940.9050.8690.8080.6690.4120.134
javascript0.9170.9030.9200.8230.6750.5880.176
zig0.9130.9010.8070.4740.7550.3690.000
csharp0.8850.8890.7430.6140.2770.3920.117
go0.8950.8840.6760.7850.7220.4100.133
python0.8670.8800.7940.7770.6340.4880.202
php0.8580.8740.7580.6630.4020.3400.123
swift0.8600.8730.7210.7100.4290.2800.160
bash0.8250.8520.8920.7060.7230.2260.000
lua0.8230.8470.8030.7980.6990.3360.000
java0.8490.8410.7060.6410.3860.5360.198
kotlin0.8210.8300.6700.6370.4780.3350.166
rust0.8560.8270.6270.6620.5190.2420.162
c0.7410.8060.7060.6760.5550.3840.000
haskell0.7650.7710.7760.6830.4830.3130.000
typescript0.7060.7080.5450.4300.3940.3540.128
overall0.8540.8620.7650.6930.5610.3870.126

Ablations

raw returns retrieval scores directly; + ranking feeds them through semble's hybrid ranker.

RetrievalRaw+ ranking
BM250.6750.834
potion-code-16M0.6500.821
BM25 + potion-code-16M0.854
By query category
ModeArchitectureSemanticSymbol
BM25 raw0.6280.6760.719
potion-code-16M raw0.6260.6660.629
semble BM25 (+ ranking)0.7700.8190.957
semble potion-code-16M (+ ranking)0.7570.8080.943
semble hybrid0.8020.8460.958

Dataset

~1,250 queries over 63 repositories in 19 languages, grouped into three categories:

CategoryQueriesWhat it tests
semantic711Code that implements a specific behavior or concept
architecture343Design decisions, module boundaries, structural patterns
symbol204Named entity lookup (function, class, type, variable)
Notes

Languages: three repos per language (nine for Python): bash, C, C++, C#, Elixir, Go, Haskell, Java, JavaScript, Kotlin, Lua, PHP, Python, Ruby, Rust, Scala, Swift, TypeScript, Zig. Repos are pinned by revision in repos.json.

How the benchmark was built: queries and ground-truth relevance labels are generated by Claude Sonnet 4.6. The same model is used as LLM-as-judge to verify label quality.

Methods

  • ripgrep: fast regex search over files, included as a raw keyword-match baseline.
  • probe: BM25 keyword ranking backed by tree-sitter parse trees. No persistent index; scans on the fly.
  • ColGREP: late-interaction code retrieval built on next-plaid with the LateOn-Code-edge model.
  • grepai: semantic search using nomic-embed-text (137M params) via a local Ollama daemon.
  • CodeRankEmbed: 137M-param transformer embedding model for code retrieval. CodeRankEmbed Hybrid fuses its dense scores with BM25.
  • semble: this library. potion-code-16M static embeddings + BM25 + the semble reranking stack.

Excluded methods

Two tools were considered but not included in the benchmark:

  • codanna: symbol-level semantic search with fastembed. Excluded because it does not support Haskell, Bash, Zig, Scala, Elixir, or Ruby (6 of the 19 benchmark languages, covering 20 of 63 repos (~38% of tasks)).
  • claude-context: retrieval-augmented code search using OpenAI embeddings and a vector database. Excluded because it requires a paid OpenAI API key and a running vector-DB service.

Running the benchmarks

Repos are pinned in repos.json and cloned into ~/.cache/semble-bench:

uv run python -m benchmarks.sync_repos          # clone / update
uv run python -m benchmarks.sync_repos --check  # verify only

All tools run CPU-only. semble uses minishlab/potion-code-16M; CodeRankEmbed uses nomic-ai/CodeRankEmbed (137M params). The speed benchmark touches one repo per language with a cold-start index and 5 query runs per repo.

semble
uv run python -m benchmarks.run_benchmark
uv run python -m benchmarks.run_benchmark --repo fastapi --repo axios
uv run python -m benchmarks.run_benchmark --language python

Full runs write to benchmarks/results/semble-hybrid-<sha12>.json.

Speed benchmark
uv run python -m benchmarks.speed_benchmark

Writes to benchmarks/results/speed-<sha12>.json.

Ablations
uv run python -m benchmarks.baselines.ablations
uv run python -m benchmarks.baselines.ablations --mode bm25
uv run python -m benchmarks.baselines.ablations --mode semble-semantic
probe

Needs probe on $PATH (npm install -g @buger/probe).

uv run python -m benchmarks.baselines.probe
uv run python -m benchmarks.baselines.probe --repo fastapi --repo axios
grepai

Needs grepai on $PATH and Ollama running with nomic-embed-text pulled:

ollama pull nomic-embed-text
uv run python -m benchmarks.baselines.grepai
uv run python -m benchmarks.baselines.grepai --repo fastapi --repo axios

Large repos take several minutes to index. Use --timeout <seconds> (default 120) for repos with many files:

uv run python -m benchmarks.baselines.grepai --timeout 1800 --output results.json

The --output flag enables resume mode: already-completed repos are skipped on restart.

ripgrep

Needs rg on $PATH (brew install ripgrep / apt install ripgrep).

uv run python -m benchmarks.baselines.ripgrep
uv run python -m benchmarks.baselines.ripgrep --no-fixed-strings
ColGREP

Needs the colgrep binary on $PATH.

uv run python -m benchmarks.baselines.colgrep
uv run python -m benchmarks.baselines.colgrep --repo fastapi --repo axios

Runs with --code-only everywhere except bash repos (bash-it, bats-core, nvm), which use --no-code-only because ColGREP's code filter excludes .sh/.bash files.

CodeRankEmbed

Requires the benchmark extra (uv sync --extra benchmark).

uv run python -m benchmarks.baselines.coderankembed
uv run python -m benchmarks.baselines.coderankembed --mode semantic
Context-efficiency benchmark

Requires the benchmark extra (uv sync --extra benchmark) and rg on $PATH.

# Recall vs. token-budget across all queries; plots automatically.
uv run python -m benchmarks.token_efficiency recall
uv run python -m benchmarks.token_efficiency recall --repo fastapi

# Regenerate the plot from a saved recall payload.
uv run python -m benchmarks.token_efficiency plot

Writes benchmarks/results/token-efficiency-<sha12>.json and assets/images/token_efficiency.png.

Plots
uv run python -m benchmarks.plot

Writes speed_vs_ndcg_cold.png and speed_vs_ndcg_warm.png to assets/images/.