This is a more technical part of https://rkochanowski.com/article/embedding-benchmark/ sharing source code allowing you to verify and run it yourself. It contains all code snippets and detailed descriptions of all cases.
This benchmark evaluates how well an embedding model detects duplicated code. It focuses on code that does the same thing but is written differently. This is similarity detection, not retrieval.
Models are evaluated on how good they are at separating duplicated code from not duplicated, including adversarial cases.
config.yaml: Configuration of models, cases, and comparisons between two related cases (case_diff).env.example: Template of .env file containing environment variables for API keys for providers used in benchmarkGets embeddings and calculates cosine similarity for case pairs. Writes result/similarities.csv containing similarities for every pair of every case for every model.
uv run bench embed
It supports resume. When interrupted, you can safely re-run to continue. You can also add a new model keeping all previous data unchanged. Models are uniquely identified by label property.
Reads similarities.csv and generates gaps.csv, averages.csv, deviations.csv. The order of cases and models is determined by config.yaml.
uv run bench report
Each case directory contains case.yaml with a list of pairs and case description. Each pair has two files: side a and b as referenced in descriptions.
2 commits
Python
15.5%
Java
13.3%
C#
12.8%
TypeScript
11.6%
Rust
9.2%
JavaScript
8.7%
Kotlin
8.3%
Go
6.8%
PHP
4.7%
Elixir
4.5%
Hack
4.2%
This is a more technical part of https://rkochanowski.com/article/embedding-benchmark/ sharing source code allowing you to verify and run it yourself. It contains all code snippets and detailed descriptions of all cases.
This benchmark evaluates how well an embedding model detects duplicated code. It focuses on code that does the same thing but is written differently. This is similarity detection, not retrieval.
Models are evaluated on how good they are at separating duplicated code from not duplicated, including adversarial cases.
config.yaml: Configuration of models, cases, and comparisons between two related cases (case_diff).env.example: Template of .env file containing environment variables for API keys for providers used in benchmarkGets embeddings and calculates cosine similarity for case pairs. Writes result/similarities.csv containing similarities for every pair of every case for every model.
uv run bench embed
It supports resume. When interrupted, you can safely re-run to continue. You can also add a new model keeping all previous data unchanged. Models are uniquely identified by label property.
Reads similarities.csv and generates gaps.csv, averages.csv, deviations.csv. The order of cases and models is determined by config.yaml.
uv run bench report
Each case directory contains case.yaml with a list of pairs and case description. Each pair has two files: side a and b as referenced in descriptions.
2 commits
Python
15.5%
Java
13.3%
C#
12.8%
TypeScript
11.6%
Rust
9.2%
JavaScript
8.7%
Kotlin
8.3%
Go
6.8%
PHP
4.7%
Elixir
4.5%
Hack
4.2%