File size: 5,398 Bytes
780ecbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
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`.