Quarry / README.md
jbellis-brokk's picture
Publish Quarry v1
780ecbf verified
|
Raw
History Blame Contribute Delete
5.4 kB
---
license: cc-by-4.0
task_categories:
- text-retrieval
language:
- code
size_categories:
- 1K<n<10K
tags:
- code-retrieval
- benchmark
- multilingual
configs:
- config_name: queries
default: true
data_files:
- split: test
path: data/queries.jsonl
- config_name: tasks
data_files:
- split: test
path: data/tasks.jsonl
- config_name: gold_preimage
data_files:
- split: test
path: data/gold-preimage.jsonl
- config_name: gold_postimage
data_files:
- split: test
path: data/gold-postimage.jsonl
---
# Quarry
Quarry is a **natural-language-query → code-function retrieval** benchmark. Its queries
are synthetic behavioral descriptions generated without access to the diff or gold labels.
They are **not raw issue text**, and Quarry is **not a patch-localization benchmark**.
Version 1.0 contains 6,525 queries and function-level gold over 3,411 tasks at real code
revisions in 11 languages: C, C++, C#, Go, Java, JavaScript, PHP, Python, Rust, Scala, and
TypeScript. This release merges two disjoint collection tranches into one `test` split.
Quarry ships labels and repository references, not source code. Users check out the named
upstream repositories and revisions, so all referenced code remains under its upstream
license.
## Load the data
The repository exposes four configurations because the release artifacts have distinct
schemas:
```python
from datasets import load_dataset
queries = load_dataset("BrokkAI/Quarry", "queries", split="test")
tasks = load_dataset("BrokkAI/Quarry", "tasks", split="test")
gold = load_dataset("BrokkAI/Quarry", "gold_preimage", split="test")
```
Join records with `(repo, task_id)` or `(repo, task_id, query_id)` as appropriate.
| configuration | rows | purpose |
|---|---:|---|
| `queries` | 6,525 | Behavioral query text and retrieval revision |
| `tasks` | 3,411 | Task metadata, language, revision, and associated query IDs |
| `gold_preimage` | 6,525 | Function-level labels at the retrieval revision |
| `gold_postimage` | 6,525 | Companion postimage records retained from collection |
The function-level labels in `positive_units` include repository, revision, path, symbol or
fully qualified method name, and line range. `positive_chunk_ids` is empty in the portable
release because chunk IDs are assigned when the corpus is built locally.
## Evaluation protocol
The headline metric is strict all-gold micro recall@{5,10,20,50}. For query `q` at depth
`k`, recall is:
```text
|gold(q) ∩ top_k(q)| / |gold(q)|
```
The published aggregate is the flat mean over all 6,525 queries. The harness also reports
the three-stage query → task → repository → language macro aggregate. Published model rows
use each model's native embedding dimension, an 8,192-token context, and the header document
shape below.
For a free function:
```text
{path}/{function_name}
{source}
```
For a class method, the exact `swerank_document_text()` renderer is:
```text
{path}/{ClassName}/{function_name}
class {ClassName}:{source}
```
## Reproduce the benchmark
The evaluator and its local dependencies are included in this repository. Building the
corpus requires local clones plus the Bifrost chunker used by `localize_sft_data.py`; Bifrost
is imported lazily and is not needed merely to inspect the data or evaluator CLI.
1. Clone every `repo` under a directory using its Quarry name (`owner__repository`).
2. Build per-repository chunk databases at the exact retrieval revisions:
```bash
python harness/build_tranche_db.py \
--release-dir data \
--clones-dir /path/to/clones \
--db-dir /path/to/quarry-db \
--worktree-tmp-root /path/to/worktrees
```
3. Create an evaluation release directory and resolve portable unit labels to local chunk
IDs:
```bash
mkdir -p /path/to/quarry-final
cp data/queries.jsonl data/tasks.jsonl /path/to/quarry-final/
python harness/canonicalize_gold.py \
--input data/gold-preimage.jsonl \
--output /path/to/quarry-final/gold-preimage.jsonl \
--db-dir /path/to/quarry-db
```
4. Evaluate Muninn at its published 2,048-dimensional setting:
```bash
python quarry_eval.py \
--model BrokkAI/Muninn \
--model-profile voyage \
--model-tag muninn-2048 \
--final-dir /path/to/quarry-final \
--db-dir /path/to/quarry-db \
--output-dir /path/to/results/muninn \
--vector-cache /path/to/vector-cache/muninn \
--devices cuda:0 \
--truncate-dim 2048
```
The Quarry-specific evaluator defaults to `--document-shape swerank`, `--alpha 1.0`, and
`--max-seq-length 8192`. For Muninn-small, use `--model BrokkAI/Muninn-small`,
`--model-profile granite`, a distinct model tag/cache, and omit `--truncate-dim`.
## Results
**TODO:** Competitive results are being rerun and will be added when the complete comparison
is finalized.
## Licenses
Quarry's queries and labels are released under
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Attribute the dataset to
BrokkAI and link this repository. Referenced source code is not redistributed and retains
the license of each upstream repository.
`quarry_eval.py` and all Python source under `harness/` are released under the Apache
License 2.0; see `LICENSE-CODE`. The CC BY 4.0 dataset license does not apply to those code
files.
Checksums, row counts, version, and source-tranche identifiers are recorded in
`RELEASE_MANIFEST.json`.