File size: 9,726 Bytes
fbe2f72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874b9f6
 
 
 
fbe2f72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
825c7f3
fbe2f72
825c7f3
fbe2f72
874b9f6
3330b5f
09f212a
874b9f6
fbe2f72
 
 
 
 
 
 
 
 
 
 
 
874b9f6
fbe2f72
 
 
 
 
 
 
 
825c7f3
fbe2f72
 
 
 
 
 
09f212a
 
fbe2f72
09f212a
 
 
 
 
 
4607bec
 
fbe2f72
 
 
09f212a
 
 
 
 
 
 
fbe2f72
874b9f6
 
 
 
 
 
 
 
 
 
 
 
fbe2f72
 
 
 
 
 
 
 
 
874b9f6
fbe2f72
 
 
 
 
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
---
pretty_name: Training · Magicoder OSS-Instruct
license: mit
language:
- en
multilinguality:
- monolingual
task_categories:
- text-retrieval
task_ids:
- document-retrieval
tags:
- train
- retrieval
- code
configs:
- config_name: corpus
  data_files:
  - split: train
    path: corpus/train-*.parquet
- config_name: hard-negatives
  data_files:
  - split: train
    path: hard-negatives/train-*.parquet
- config_name: judgments
  data_files:
  - split: train
    path: judgments/train-*.parquet
- config_name: qrels
  data_files:
  - split: train
    path: qrels/train-*.parquet
- config_name: queries
  data_files:
  - split: train
    path: queries/train-*.parquet
- config_name: teacher-scores
  data_files:
  - split: train
    path: teacher-scores/train-*.parquet
---
# Magicoder OSS-Instruct — Training, unified schema

A seeded sample of [`ise-uiuc/Magicoder-OSS-Instruct-75K`](https://huggingface.co/datasets/ise-uiuc/Magicoder-OSS-Instruct-75K/tree/5f839b1f368a76b161028bb9edff055db34022b2), made into retrieval **training** pairs and reshaped into the strict schema shared by every dataset in this collection. One of the 15 domain sources (code, medical, science, finance, legal) added to the collection's general sources.

|  |  |
|---|---|
| Source | [`ise-uiuc/Magicoder-OSS-Instruct-75K`](https://huggingface.co/datasets/ise-uiuc/Magicoder-OSS-Instruct-75K/tree/5f839b1f368a76b161028bb9edff055db34022b2) @ `5f839b1f368a` |
| Task | coding problem → solution |
| Domain · languages | code · eng |
| Queries / documents / qrels | 59,997 / 59,999 / 59,997 |
| Qrels per query | min 1 · mean 1.0 · max 1 |
| Score values | 2 ×59,997 (2: the first positive, 1: any other) |
| Layout | `queries` · `corpus` · `qrels` · `hard-negatives` · `teacher-scores`, split `train` |
| Splits | `corpus`: train · `hard-negatives`: train · `judgments`: train · `qrels`: train · `queries`: train · `teacher-scores`: train |
| Hard negatives | sources: `dense` · 5,939,734 rows |
| Teacher scores | `jinaai/jina-reranker-v3.5` · 5,999,731 rows (positives included) |
| Judgments | `judgments`: `typesafe/jev-1.13.0` · 844,202 rows |
| Ids | `sha1(text)[:20]`; identical texts collapse to one document / query |
| License | `mit` |

## Schema

| config | columns | rules |
|---|---|---|
| `queries` | `id: string`, `text: string` | ids unique and non-empty; every query has ≥ 1 qrel |
| `corpus` | `id: string`, `title: string`, `text: string` | `title` is always present (`""` when the source has none) |
| `qrels` | `query-id: string`, `corpus-id: string`, `score: int32` | referential integrity to both tables; no duplicate pairs; no floats |
| `hard-negatives` | `query-id: string`, `corpus-id: string`, `rank: int32`, `source: string` | one row per negative; `(query-id, corpus-id, source)` unique; never a labelled positive of the same query |
| `teacher-scores` | `query-id: string`, `corpus-id: string`, `teacher: string`, `score: float32` | one row per scored pair (positives included); a row *means* scored — never a placeholder |
| `judgments` | `query-id: string`, `corpus-id: string`, `judge: string`, `role: string`, `p_yes: float64`, `round: int32` | one row per judged pair; `role` is `positive` (the training positive) or `candidate` (a mined candidate, never a labelled positive or a labelled negative); `p_yes` in [0, 1]; `round` 0 the first request, 1.. the top-ups |

Files are Parquet, sorted by id, zstd-compressed, sharded at 500 MB. Every rule above is checked before publishing; `provenance.json` records the source revision, what changed, and the output file hashes.

## What changed from the source

- **sampled**: a seeded random sample (seed 1) of up to 60,000 pairs
- **reshaped**: the coding problem (`problem`) is the query, its solution (`solution`) the document
- **decontaminated (exact)**: a pair was dropped when its normalised query equals any evaluation query, or a positive equals a document of a test or dev corpus; a repeated query keeps its first pair
- **decontaminated (near-duplicates)**: 1 passages that nearly copy an evaluation document some evaluation query judges relevant, and 2 queries that nearly copy an evaluation query (word 13-grams for passages, 8-grams for queries; at least half shared with one text of the 23 test sets (BEIR, RTEB, LitSearch) or the 6 dev sets) were removed, and with them 3 queries in total; near copies of evaluation-corpus documents that no evaluation query judges relevant were kept
- **text**: leading and trailing whitespace stripped; otherwise as converted above
- **ids** re-keyed to `sha1(text)[:20]`: 0 documents and 0 queries collapsed into identical texts
- added a `title` column filled with `""` (the source has none)

## Hard negatives and teacher scores

Filled by the owner's annotation pipeline (`annotation=jina35-u2`) for the `train` split of the
query set(s) below; queries without a labelled positive are left out.

- **Candidates**: dense retrieval with `jinaai/jina-embeddings-v5-text-small` over the full corpus to depth 1,000;
  100 candidates per query drawn from the rank windows 1–30 (30), 31–100 (30), 101–300 (20), 301–1000 (20), the query's labelled positives excluded.
  `rank` is the dense rank; `source` is `dense` for a mined row and `dataset` for a negative the source labels itself
  (those are kept for every query of the split, sampled or not).
- **Teacher**: `jinaai/jina-reranker-v3.5`, listwise: a query's positive and all of its candidates are scored together in one
  context of up to 32,768 tokens. `score` is the raw cosine score, one row per (query, positive) and per
  (query, candidate); a labelled negative that was also mined is scored once. Every document was cut to its first
  1,024 reranker tokens before scoring (`max_doc_tokens=1024`). No filtering is applied to the tables.

| configs | queries | hard negatives | teacher scores |
|---|---:|---:|---:|
| `hard-negatives` · `teacher-scores` | 59,997 (all) | 5,939,734 (5,939,734 dense) | 5,999,731 |

```python
from datasets import load_dataset
negatives = load_dataset("Hyukkyu/train-magicoder", "hard-negatives", split="train")
scores    = load_dataset("Hyukkyu/train-magicoder", "teacher-scores", split="train")
```

## Jev judgments

`judgments` holds, for every query of the training sample (the queries with teacher scores), whether [TypeSafe](https://typesafe.ai)'s Jev (`jev-1.13.0`) judged its training positive and its mined candidates relevant: `p_yes` is Jev's P(yes) for the source's question (e.g. *does the passage answer the query?*). They locate the false negatives among the mined candidates and the mislabelled positives.

- **Requests.** One request per query (`round` 0): its training positive, its candidates whose teacher score taken as (cos + 1) / 2 is at least 0.85 × the positive's (at most 12, the highest scores) and 4 random candidates below that, shuffled under neutral ids, one yes/no question per passage. Queries left with fewer than 10 candidates under their source's cutoff got their next hardest unjudged candidates in rounds 1–8 (8 per request), those still under 10 in rounds 9–10 (24 per request). The dataset's own labelled negatives were never sent. Texts were cut to 512 (query) and 512 (passage) tokens of the `jina-embeddings-v5` small tokenizer. Jev answers a request's passages in one context, so P(yes) is calibrated to these groups: the thresholds below apply to this table, not to single-pair calls.
- **Accuracy** (an audit of 1237 pairs from the pilot's first requests (100 queries per source; the five long-query sources re-piloted at 512-token queries), labelled blind by an LLM (Claude), at the pilot's fixed thresholds 0.35 and 0.15): a candidate at P(yes) ≥ 0.35 was relevant 67% of the time inside the band (n = 350) and 45% below it (n = 87); one under 0.35 was relevant 6% (band, n = 387) and 1% (below the band, n = 210) of the time. A positive under 0.15 was mislabelled 100% of the time (n = 20) in the sources that keep the check; in dom-casehold, dom-clerc, dom-cornstack-py, dom-finqa10k, dom-gerlayqa, dom-investopedia, dom-lawse, dom-magicoder, dom-medmcqa, dom-pubmedqa, dom-s2orc, dom-tatqa, Jev's flags were right less often (0%–57% in this audit), under the 70% the check needs, so their positives are not checked.
- **Use** (the SPARSE loader, `annotation.filter.judge`): a candidate at P(yes) ≥ its source's cutoff (below; fitted on 1,521 labelled pairs) is never a negative; a positive under 0.15 is replaced by the candidate Jev scores highest if that is ≥ 0.8, else the query is dropped; a candidate at ≥ 0.9 can become an extra positive. Compare `p_yes` as a float64 (it is stored as one).

| config | queries | rows | candidates per query | top-up rows | candidate cutoff | positive check |
|---|---:|---:|---:|---:|---:|---|
| `judgments` | 59,997 | 844,202 | 13.1 | 523,425 | 0.32 | skipped |

## Load it

```python
from datasets import load_dataset
queries   = load_dataset("Hyukkyu/train-magicoder", "queries", split="train")
corpus    = load_dataset("Hyukkyu/train-magicoder", "corpus", split="train")
qrels     = load_dataset("Hyukkyu/train-magicoder", "qrels", split="train")
negatives = load_dataset("Hyukkyu/train-magicoder", "hard-negatives", split="train")
scores    = load_dataset("Hyukkyu/train-magicoder", "teacher-scores", split="train")
judgments = load_dataset("Hyukkyu/train-magicoder", "judgments", split="train")
```

## License and attribution

The data is redistributed under the source's terms — `mit`. All credit belongs to the original authors; see the source repository (https://huggingface.co/datasets/ise-uiuc/Magicoder-OSS-Instruct-75K). This repository is an independent repackaging.