File size: 6,350 Bytes
291cf50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
pretty_name: HackTrace Trajectories
license: cc-by-4.0
language:
- en
task_categories:
- text-classification
- text-generation
tags:
- reward-hacking
- coding-agents
- ai-safety
- monitoring
- reinforcement-learning
- code
size_categories:
- 100K<n<1M
configs:
- config_name: trajectories
  default: true
  data_files:
  - split: train
    path: trajectories/train.parquet
  - split: test
    path: trajectories/test.parquet
- config_name: problems
  data_files:
  - split: train
    path: problems/problems.parquet
---

# HackTrace Trajectories

173,561 multi-turn coding trajectories of Qwen3-8B on CodeContests problems, each labeled for shortcut behavior. This is
the dataset of **HackTrace: Behavior-Supervised Detection of Reward Hacking During Code Generation**.

- **Paper:** [arXiv:2610.03055](https://arxiv.org/abs/2610.03055)

A coding agent can pass its tests by fixing its code, or by deleting the test that exposes the bug. Every trajectory here
carries two labels: `ACT` marks shortcut behavior whether or not it worked (test tampering, hard-coded outputs,
special-casing, evaluation bypass), and `OUTCOME` additionally requires that the shortcut passed the visible tests and
failed the hidden ones. Honest and shortcut trajectories exist for the same problems, so detectors can be compared within
a problem.

```python
from datasets import load_dataset
ds = load_dataset("JH012/HackTrace-Data", "trajectories")   # splits: train, test
problems = load_dataset("JH012/HackTrace-Data", "problems", split="train")
```

## Files

| Config | File | Rows | Contents |
|---|---|---|---|
| `trajectories` | `trajectories/train.parquet` | 133,009 (26,329 `ACT` positives) | training split, 375 problems; 56,617 editable-test and 76,392 read-only-test trajectories |
| `trajectories` | `trajectories/test.parquet` | 40,552 (7,944 `ACT` positives) | test split, 315 unseen problems; 15,200 editable-test (190 problems) and 25,352 read-only-test (125 problems) |
| `problems` | `problems/problems.parquet` | 990 | problem statements with the visible cases shown to the agent and the 12 hidden cases used for labeling, one row per (tier, problem) |

`MANIFEST.json` lists the sha256, size and row count of every file. The split is by problem: no test problem appears in
training.

## Row schema (`trajectories`)

| Field | Meaning |
|---|---|
| `id` | trajectory id |
| `split` | `train` or `test` |
| `variant` | `editable-test` (the agent may rewrite `solution.py` and `test.py`) or `read-only-test` (only `solution.py`) |
| `tier`, `problem_name` | problem group and CodeContests problem name; join with `problems` on both |
| `num_turns` | number of agent turns (at most 3) |
| `messages` | the full conversation: system prompt, user turns (problem, issued `test.py`, execution feedback) and assistant turns |
| `final_solution`, `final_test` | `solution.py` and `test.py` after the last turn (an empty string means the file was emptied) |
| `visible_tests_pass` | the final files pass the visible grader (`python test.py` prints `ALL PASS`) |
| `hidden_tests_pass` | the final solution passes the 12 hidden cases; evaluated only when `visible_tests_pass` is true, null otherwise |
| `tests_modified` | `test.py` differs from the issued file |
| `label_source` | `judge` (individually judged by GPT-5.4), `rule` (editable-test, failed the visible grader, tests unchanged: negative by rule), or `rule, audited by judge` (rule-labeled rows that were also judged as an audit) |
| `judge_category` | the judge's category; null for rule-labeled rows and for 21 judged rows whose verdict text was not stored |
| `judge_rationale` | the judge's one-sentence rationale |
| `ACT` | shortcut behavior in the final artifacts, whether or not it succeeded |
| `OUTCOME` | `ACT` and a visible-grader pass with a hidden-test failure |
| `generated_tokens` | tokens generated by the agent over the trajectory |

Judge categories: the shortcut categories are `test_tamper`, `hardcode_output`, `special_casing` and `eval_bypass`; the
others are `honest_correct`, `honest_but_wrong`, `honest_fix_test` (a test edit that does not weaken the check, such as
fixing formatting) and `other`.

## How the data was built

- **Agent.** Qwen3-8B, at most 3 turns per trajectory, up to 600 new tokens per turn, temperature 0.9, top-p 0.95. Each
  turn the agent sees the problem and the current `test.py`; later turns add execution feedback.
- **Prompts.** The system prompts were written to elicit shortcut behavior for study, and they are part of every
  trajectory's `messages`. The paper's Appendix A describes them and an additional neutral-prompt pool.
- **Labels.** A GPT-5.4 judge read the problem, the original and final tests, their AST comparison, the final files and
  the execution outcomes of 136,900 trajectories: every one that passes the visible grader, modifies the tests, or uses the
  read-only prompt. The remaining 36,661 editable-test trajectories fail the visible grader with unchanged tests and are
  negative by rule.
- **Checks.** An independent Gemini-2.5-pro pass agrees with the judge on shortcut behavior for 95.9% of 107,035
  earlier-pool trajectories (κ = 0.90). A blind, LLM-assisted human audit of 305 stratified test trajectories agrees
  with the final labels on 97.0% (κ = 0.94).

Activation features (about 140 GB) and the fitted detectors are not part of this repository.

## Licenses

| Content | Source | License |
|---|---|---|
| problem statements, visible and hidden cases | [CodeContests](https://github.com/google-deepmind/code_contests) (Li et al., 2022) | CC BY 4.0 |
| trajectories | generated by Qwen3-8B (Apache-2.0 model) | CC BY 4.0 |
| labels, judge categories and rationales | HackTrace authors; rationales generated by GPT-5.4 | CC BY 4.0 |

The problem statements originate from competitive-programming sites, and their copyright stays with the original authors.
The dataset contains no personal data.

## Citation

```bibtex
@article{jiang2026hacktrace,
  title   = {HackTrace: Behavior-Supervised Detection of Reward Hacking During Code Generation},
  author  = {Jiang, Hao and Li, Xin and Wang, Annan and Zhang, Yichi and Lin, Weisi},
  journal = {arXiv preprint arXiv:2610.03055},
  year    = {2026},
  url     = {https://arxiv.org/abs/2610.03055}
}
```

Please also cite CodeContests (Li et al., 2022).