File size: 24,598 Bytes
c8483f3
58bd84c
 
 
 
 
 
 
 
 
 
 
fb9aa22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8483f3
 
58bd84c
c8483f3
0f22e5d
 
58bd84c
 
6fe2932
58bd84c
c8483f3
58bd84c
 
 
 
 
 
 
 
 
 
 
ee061c9
58bd84c
 
 
 
 
 
 
6fe2932
 
 
58bd84c
 
6fe2932
 
a40973a
 
58bd84c
 
 
 
 
 
 
6fe2932
58bd84c
 
 
ee061c9
 
 
95f577d
 
ee061c9
95f577d
 
c8483f3
 
 
58bd84c
 
 
 
c8483f3
 
58bd84c
c8483f3
 
 
 
31fc514
 
 
 
 
 
1ae1e96
 
 
 
31fc514
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66d4bd2
 
ee061c9
 
 
 
 
 
c7d9207
1ae1e96
 
 
 
cee7f4f
 
1ae1e96
cee7f4f
1ae1e96
 
cee7f4f
b5125d0
1ae1e96
 
 
 
 
b5125d0
1bc5693
 
 
315cf45
 
 
 
6fe2932
 
 
 
 
 
 
 
 
 
e750293
a40973a
 
 
e750293
31fc514
 
 
 
 
 
 
58bd84c
c8483f3
 
 
 
 
 
31fc514
c8483f3
 
 
 
 
58bd84c
c8483f3
 
 
 
 
31fc514
 
 
 
 
 
 
 
c7d9207
 
 
1ae1e96
 
 
 
 
 
 
cee7f4f
 
 
 
 
 
 
 
 
 
 
b5125d0
 
 
 
 
 
315cf45
 
 
 
 
6fe2932
 
 
 
 
 
1bc5693
 
 
 
e750293
a40973a
e750293
c7d9207
 
 
 
 
 
 
c8483f3
a40973a
 
 
 
 
e750293
a40973a
e750293
 
 
c8483f3
 
 
 
 
 
 
 
 
 
 
1ae1e96
c8483f3
 
 
 
 
 
 
fe0827e
 
c8483f3
 
31fc514
 
c7d9207
 
c8483f3
1ae1e96
 
cee7f4f
 
b5125d0
 
315cf45
 
6fe2932
 
1bc5693
 
c8483f3
 
 
 
 
1ae1e96
 
 
 
 
e750293
a40973a
e750293
1ae1e96
e750293
c8483f3
 
 
58bd84c
 
 
 
 
 
 
 
c8483f3
 
58bd84c
c8483f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6fe2932
 
 
 
 
 
 
c8483f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58bd84c
 
 
c8483f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58bd84c
 
 
 
 
ee061c9
58bd84c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
---
language:
- en
license: cc-by-4.0
task_categories:
- text-generation
pretty_name: SWE-rebench-V2-Filtered-Verified
tags:
- software-engineering
- code
- swe
- rl
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
dataset_info:
  features:
  - name: base_commit
    dtype: string
  - name: created_at
    dtype: string
  - name: image_name
    dtype: string
  - name: instance_id
    dtype: string
  - name: interface
    dtype: string
  - name: language
    dtype: string
  - name: license
    dtype: string
  - name: patch
    dtype: string
  - name: pr_description
    dtype: string
  - name: problem_statement
    dtype: string
  - name: repo
    dtype: string
  - name: test_patch
    dtype: string
  - name: FAIL_TO_PASS
    list: string
  - name: PASS_TO_PASS
    list: string
  - name: install_config
    struct:
    - name: base_image_name
      dtype: string
    - name: docker_specs
      struct:
      - name: _variant
        dtype: string
      - name: bazel_version
        dtype: string
      - name: bun_version
        dtype: string
      - name: cargo_version
        dtype: string
      - name: deno_version
        dtype: string
      - name: docker_version
        dtype: string
      - name: erlang_version
        dtype: string
      - name: gcc_version
        dtype: string
      - name: go_version
        dtype: string
      - name: helm_version
        dtype: string
      - name: java_version
        dtype: string
      - name: jdk_version
        dtype: string
      - name: llvm_version
        dtype: string
      - name: lua_version
        dtype: string
      - name: luajit_version
        dtype: string
      - name: neovim_version
        dtype: string
      - name: node_version
        dtype: string
      - name: npm_version
        dtype: string
      - name: nvim_version
        dtype: string
      - name: pnpm_version
        dtype: string
      - name: python_image
        dtype: string
      - name: python_version
        dtype: string
      - name: redis_version
        dtype: string
      - name: ruby_version
        dtype: string
      - name: rust_version
        dtype: string
      - name: rustc_version
        dtype: string
      - name: solana_version
        dtype: string
      - name: sqlite_version
        dtype: string
    - name: install
      list: string
    - name: log_parser
      dtype: string
    - name: test_cmd
      dtype: string
  - name: meta
    struct:
    - name: llm_metadata
      struct:
      - name: code
        dtype: string
      - name: confidence
        dtype: float64
      - name: detected_issues
        struct:
        - name: B1
          dtype: bool
        - name: B2
          dtype: bool
        - name: B3
          dtype: bool
        - name: B4
          dtype: bool
        - name: B5
          dtype: bool
        - name: B6
          dtype: bool
      - name: difficulty
        dtype: string
      - name: external_urls
        list: string
      - name: intent_completeness
        dtype: string
      - name: pr_categories
        list: string
      - name: reasoning
        dtype: string
      - name: test_alignment_issues
        list: string
    - name: num_modified_files
      dtype: int64
    - name: num_modified_lines
      dtype: int64
    - name: pr_author
      dtype: string
    - name: pr_labels
      list: string
    - name: pr_url
      dtype: string
  splits:
  - name: train
    num_bytes: 276137448
    num_examples: 6272
  download_size: 226272977
  dataset_size: 276137448
---

# SWE-rebench-V2-Filtered-Verified

[![GitHub](https://img.shields.io/badge/research--environments-swerebench__v2__v1-181717?logo=github)](https://github.com/PrimeIntellect-ai/research-environments/tree/main/environments/swe/swerebench_v2_v1)

Filtered and gold-patch-verified subset of Nebius's
[SWE-rebench-V2](https://huggingface.co/datasets/nebius/SWE-rebench-V2)
([paper](https://arxiv.org/abs/2602.23866)): **6,272 / 32,079** freshly-mined GitHub PR tasks
across 17 languages. Default dataset of the `swerebench_v2_v1` taskset.

## Changes vs upstream

**Filtered** (selection — the bulk of the cut):

* Upstream's own per-row LLM-judge metadata: `difficulty` labeled easy/medium/hard, judge grade
  `code == "A"` (clearly solvable), `intent_completeness == "complete"`, no `detected_issues`,
  judge `confidence ≥ 0.95`.
* Leak hygiene: `external_urls == []`, plus a regex scrub dropping rows whose problem statement
  contains inline `#1234` / `gh-1234` / `/pull/1234`-style references (the fixing PR is
  look-up-able otherwise).
* Wholesale language drops — Julia, C++, Clojure images are broken for scoring (missing
  runtimes / wholesale-failing suites); a manual image blocklist (including 29 C#/Go images that deterministically fail Prime sandbox-image conversion, so every kept row has a runnable public Prime-registry image); a `statamic/cms` repo drop
  (its tasks run unrelated JS suites, scoring 1.0 without the fix).

**Verified** (our passes, the final gate):

* Gold-patch validation pass 1 via SolveEnv — reward 1.0 required.
* Independent pass 2 — flaky rows removed.
* No-edit pass — rows solvable with zero edits removed.
* RL always-fail audit (2026-07) — instances that scored 0.0 in every 16-rollout group across
  independent GLM-5.2 RL samplings were re-gold-validated twice; 2 deterministically
  unresolvable + 1 flaky removed.

Per-row outcomes ship with this repo (`swe-rebench-v2-validation.jsonl`,
`swe-rebench-v2-flaky-instances.json`, `swe-rebench-v2-no-edit-pass-exclusions.jsonl`,
`swe-rebench-v2-rl-alwaysfail-exclusions.json`).
`image_name` is rewritten to the public Prime image registry (`prime/primeintellect/...`) so
sandbox rollouts avoid Docker Hub rate limits and get fast pulls. Schema is otherwise unchanged.

License mirrors upstream: CC-BY-4.0.

## Splits

| Split | Rows |
|---|---:|
| `train` | 6,272 |

## How to use

Install the [`swerebench_v2_v1`](https://github.com/PrimeIntellect-ai/research-environments/tree/main/environments/swe/swerebench_v2_v1) taskset from
[research-environments](https://github.com/PrimeIntellect-ai/research-environments), then run it
end-to-end with [verifiers](https://github.com/PrimeIntellect-ai/verifiers):

```bash
uv pip install --prerelease=allow "git+https://github.com/PrimeIntellect-ai/research-environments.git#subdirectory=environments/swe/swerebench_v2_v1"
uv run eval --taskset.id swerebench_v2_v1 -m <your-model> -n 100 -r 4
```

## Generation

<details>
<summary>Reproduction script — <code>swe-rebench-v2-filtered-verified.py</code></summary>

This dataset was created by running:

````bash
uv run datasets/swe-rebench-v2-filtered-verified.py -H
````

````python
# swe-rebench-v2-clean.py
"""Filter `nebius/SWE-rebench-V2` (32k) to a clean RL-trainable subset.

Filters (all applied conjunctively against `meta.llm_metadata`, which Nebius
populates per row using the `meta_info.j2` LLM-judge rubric — see
https://github.com/SWE-rebench/SWE-rebench-V2/blob/main/prompts/annotations/meta_info.j2):

  * `difficulty in {"easy", "medium", "hard"}` — drops only ``null`` /
    unannotated rows. Each difficulty is validated independently below;
    ``meta.llm_metadata.difficulty`` remains on every row so downstream
    consumers can still partition by difficulty if they want.
  * `code == "A"` — judge graded the instance SOLVABLE (problem clearly
    specified, tests align with stated requirements). B1–B6 grades flag
    test-suite coupling, implicit naming, missing external-URL info,
    ambiguous spec, patch artifacts, or implicit domain knowledge.
  * `intent_completeness == "complete"` — problem statement provides
    sufficient detail (vs. partial / insufficient).
  * `detected_issues` all false — no B1–B6 environment/spec problems detected.
  * `confidence >= --min-confidence` (default 0.95) — judge classification
    certainty.
  * `external_urls == []` — judge extracted no referenced URLs from the
    issue text. B3 already drops cases where the URL info is *essential*
    and missing; this extra filter drops cases where any URL is present
    (paranoid, since the V2 problem_statement is the raw GitHub issue body
    and incidental URLs there are still a solvability risk).

Plus one regex pass on `problem_statement` itself, since `external_urls`
is URL-only and misses inline GitHub-style issue/PR references like
`#1234`, `gh-1234`, `PR #1234`, `/issues/1234`, `/pull/1234`. Any such
reference drops the row.

Plus a manually-curated image blocklist at
``swe-rebench-v2-exclude-images.json`` (sibling of this file) — drops
rows whose ``image_name`` matches. This includes 29 C#/Go images
(microsoft-kiota, devlooped-moq, microsoft-typescript-go,
asynkron-protoactor-dotnet, btcpayserver, spectreconsole) whose Docker Hub
images deterministically fail Prime platform sandbox-image conversion
(3 independent attempts, 2026-07) — excluded so every kept row has a
runnable public image in the Prime registry.

Plus a wholesale lang drop (``_DROP_LANGS``: julia, cpp, clojure):
SolveEnv pass-1 found these were 0/N because Nebius's images for these
langs miss the runtime / have wholesale-broken test setups.

Plus a SolveEnv gold-patch validation gate: only instances where applying
the gold patch and running the upstream ``test_cmd`` yields reward 1.0
are kept. Per-row outcomes (reward, reason, elapsed, test_output_tail tail)
live in ``swe-rebench-v2-validation.jsonl`` for posterity / reproducibility.
The file is the union of two passes (one over the hard+medium split, one
over the easy split).

Plus a flaky-instance blocklist at ``swe-rebench-v2-flaky-instances.json``:
instances that passed pass 1 but failed an independent re-validation. The
hard/medium half of the list is conservative (only ``test_failed`` /
``gold_apply_failed`` reasons retained); the easy half includes all
non-passing reasons including infra-noise (sandbox_error, timeout, None)
plus one explicit hang row (``brazilian-utils__brutils-python-126``).

Plus a manual repo blocklist (``_DROP_REPOS``) for repositories discovered to
have systematically non-discriminating tests after validation.

Plus a no-edit pass blocklist at
``swe-rebench-v2-no-edit-pass-exclusions.jsonl``: instances where the no-edit
debugger got reward 1.0, meaning the tests pass without applying any agent edit.

Plus an RL always-fail audit blocklist at
``swe-rebench-v2-rl-alwaysfail-exclusions.json``: instances flagged during
GLM-5.2 RL training (every 16-rollout group scored 0.0 across independent
samplings) and then gold-validated twice via the ``swerebench_v2_v1`` taskset's
``validate`` hook (2026-07-17). Two are deterministically unresolvable under
the current verifier (graded FAIL_TO_PASS tests the row's ``test_cmd`` never
runs, or tests needing JDK toolchains absent from the image) and one is flaky
(2,422 all-or-nothing tests spawning servers/ports). Per-row verdicts and
reasons live in the file.

After filtering, ``image_name`` is rewritten from
``docker.io/swerebenchv2/<name>:<tag>`` to the public Prime image registry at
``prime/primeintellect/<name>:<tag>`` (the ``swerebenchv2/`` namespace is
stripped) so sandbox rollouts avoid Docker Hub rate limits and get fast pulls.

Field source notes:
  * `problem_statement` (V2) is the raw GitHub issue body.
  * `pr_description` (V2) is the raw merged PR description (NOT LLM-rewritten —
    contrary to what one might assume from `pr_description.j2`, which is what
    Nebius uses to generate the `problem_statement` of the *separate* 126k
    `nebius/SWE-rebench-V2-PRs` release, not V2's pr_description).
"""

# /// script
# requires-python = ">=3.12"
# dependencies = ["datasets>=4.0.0", "jinja2"]
# ///
import argparse
import json
import re
import sys
import time
from pathlib import Path
from typing import cast

from huggingface_hub import create_repo, upload_file, whoami

from datasets import Dataset, load_dataset

SOURCE_REPO = "nebius/SWE-rebench-V2"

# Inline GitHub issue/PR references not captured by `external_urls`
# (which is URL-only). Catches `#1234`, `gh-1234`, `PR #1234`,
# `issue #1234`, `/issues/1234`, `/pull/1234`.
_RE_ISSUE_REF = re.compile(
    r"(#\d{2,}|gh-\d+|PR\s*#?\d+|issue\s*#?\d+|/issues/\d+|/pull/\d+|/pulls/\d+)",
    re.IGNORECASE,
)

_EXCLUDE_IMAGES_PATH = Path(__file__).parent / "swe-rebench-v2-exclude-images.json"
_EXCLUDE_IMAGES = frozenset(json.loads(_EXCLUDE_IMAGES_PATH.read_text()))

# Wholesale-drop languages that had 0/N pass rate in SolveEnv pass-1
# validation (Nebius's images for these langs are missing the runtime
# or have wholesale-broken test setups). Verified across the easy split;
# applied to all difficulties uniformly since the underlying images are
# shared across difficulties.
_DROP_LANGS = frozenset({"julia", "cpp", "clojure"})

# SolveEnv gold-patch validation outcomes, one row per instance_id. Built by
# running `vf-eval solve_swe -a '{"task_type":"swerebench-v2",...}' -m none`
# over the prior post-filter set; kept here for reproducibility / posterity.
# Only instances with reward == 1.0 are retained downstream.
_VALIDATION_PATH = Path(__file__).parent / "swe-rebench-v2-validation.jsonl"
_VALIDATION_PASSING = frozenset(
    json.loads(line)["instance_id"]
    for line in _VALIDATION_PATH.read_text().splitlines()
    if json.loads(line).get("reward") == 1.0
)

# Flaky instances: passed gold-patch validation in pass 1 but failed (or hung)
# in an independent pass 2 with the same args, no retries. Removed downstream
# so training rollouts don't see noisy reward signal.
_FLAKY_PATH = Path(__file__).parent / "swe-rebench-v2-flaky-instances.json"
_FLAKY = frozenset(entry["instance_id"] for entry in json.loads(_FLAKY_PATH.read_text()))

_NO_EDIT_PASS_PATH = Path(__file__).parent / "swe-rebench-v2-no-edit-pass-exclusions.jsonl"
_NO_EDIT_PASSING = frozenset(
    json.loads(line)["instance_id"] for line in _NO_EDIT_PASS_PATH.read_text(encoding="utf-8").splitlines() if line
)

# RL always-fail audit exclusions: instances whose reward was 0.0 in every
# 16-rollout group across independent GLM-5.2 RL samplings, then gold-validated
# twice (2026-07-17) — two deterministically unresolvable, one flaky.
_RL_ALWAYSFAIL_PATH = Path(__file__).parent / "swe-rebench-v2-rl-alwaysfail-exclusions.json"
_RL_ALWAYSFAIL = frozenset(entry["instance_id"] for entry in json.loads(_RL_ALWAYSFAIL_PATH.read_text()))

# statamic/cms rows add PHP tests but run unrelated JS suites, so base +
# test_patch can score reward 1.0 without the issue fix.
_DROP_REPOS = frozenset({"statamic/cms"})

_DOCKERHUB_PREFIX = "docker.io/swerebenchv2/"
_PRIME_PREFIX = "prime/primeintellect/"


def _normalize_image(image_name: str) -> str:
    # Dataset rows carry e.g. ``docker.io/swerebenchv2/foo-bar:tag``; the
    # exclusion list omits the ``docker.io/`` prefix. Strip it for comparison.
    prefix = "docker.io/"
    return image_name[len(prefix) :] if image_name.startswith(prefix) else image_name


def _rewrite_image_to_prime_registry(image_name: str) -> str:
    # Subset images are re-transferred as PUBLIC images to the Prime platform
    # registry under ``prime/primeintellect/`` (the Docker Hub ``swerebenchv2/``
    # namespace is stripped); pulls from there avoid Docker Hub rate limits and
    # are much faster from sandbox hosts.
    if image_name.startswith(_DOCKERHUB_PREFIX):
        return _PRIME_PREFIX + image_name[len(_DOCKERHUB_PREFIX) :]
    return image_name


def _coerce_llm_metadata(meta: dict) -> dict:
    # `meta.llm_metadata` is a dict in the current revision; tolerate JSON-string variants too.
    llm = meta.get("llm_metadata")
    if isinstance(llm, str):
        return json.loads(llm)
    assert isinstance(llm, dict), f"unexpected llm_metadata type: {type(llm).__name__}"
    return llm


def _passes_filter(example: dict, min_confidence: float) -> bool:
    llm = _coerce_llm_metadata(example["meta"])
    if llm.get("difficulty") not in ("easy", "medium", "hard"):
        return False
    if llm.get("code") != "A":
        return False
    if llm.get("intent_completeness") != "complete":
        return False
    if any(llm.get("detected_issues", {}).values()):
        return False
    if llm.get("external_urls"):
        return False
    confidence = llm.get("confidence")
    if confidence is None or confidence < min_confidence:
        return False
    if _RE_ISSUE_REF.search(example.get("problem_statement") or ""):
        return False
    if _normalize_image(example.get("image_name") or "") in _EXCLUDE_IMAGES:
        return False
    if example.get("language") in _DROP_LANGS:
        return False
    if example.get("instance_id") not in _VALIDATION_PASSING:
        return False
    if example.get("instance_id") in _FLAKY:
        return False
    if example.get("instance_id") in _NO_EDIT_PASSING:
        return False
    if example.get("instance_id") in _RL_ALWAYSFAIL:
        return False
    if (example.get("repo") or "").lower() in _DROP_REPOS:
        return False
    return True


def prepare_data(min_confidence: float) -> Dataset:
    ds = cast(Dataset, load_dataset(SOURCE_REPO, split="train"))
    filtered = ds.filter(
        lambda ex: _passes_filter(ex, min_confidence),
        num_proc=8,
        load_from_cache_file=False,
    )
    filtered = filtered.map(
        lambda ex: {"image_name": _rewrite_image_to_prime_registry(ex["image_name"])},
        num_proc=8,
        load_from_cache_file=False,
    )
    return filtered


def _swe_card(key: str):
    """Build this dataset's card from the shared SWE card registry (swe_cards.py)."""
    sys.path.insert(0, str(Path(__file__).resolve().parent))
    from swe_cards import build_card

    return build_card(key)


def push_card_to_hub(repo_name: str, push_to_hub: bool):
    _, dataset_name = repo_name.split("/")
    card = _swe_card("swe-rebench-v2-filtered-verified")

    if push_to_hub:
        print(f"Pushing card to `{repo_name}`")
        card.push_to_hub(repo_name, repo_type="dataset")
        print(f"✅ Pushed card to `{repo_name}` to HF Hub")
    else:
        print("ℹ️  Skipped pushing card to HF Hub. To push, use the `--push-to-hub` or `-H` flag.")


def main(repo_name: str, push_to_hub: bool, private: bool, min_confidence: float, also_report_090: bool):
    print(f"⚙️ Filtering {SOURCE_REPO} (confidence >= {min_confidence})")
    start_time = time.time()
    dataset = prepare_data(min_confidence)
    elapsed = time.time() - start_time
    print(f"✅ Filtered to {len(dataset):,} rows in {elapsed:.2f} seconds")

    if also_report_090 and len(dataset) < 50:
        print("ℹ️  <50 rows at confidence >= 0.95; also reporting confidence >= 0.90")
        start_time = time.time()
        dataset_090 = prepare_data(0.90)
        elapsed = time.time() - start_time
        print(f"✅ At confidence >= 0.90: {len(dataset_090):,} rows in {elapsed:.2f} seconds")

    if push_to_hub:
        create_repo(repo_name, private=private, repo_type="dataset", exist_ok=True)
        push_card_to_hub(repo_name, push_to_hub)
        dataset.push_to_hub(repo_name, private=private)
        for sidecar in (_NO_EDIT_PASS_PATH, _RL_ALWAYSFAIL_PATH):
            upload_file(
                path_or_fileobj=str(sidecar),
                path_in_repo=sidecar.name,
                repo_id=repo_name,
                repo_type="dataset",
            )
        print(f"✅ Pushed dataset to https://huggingface.co/datasets/{repo_name}")


def check_write_access(org: str):
    is_authed = False
    try:
        info = whoami()
        token = info["auth"]["accessToken"]["displayName"]
        for entity in info["auth"]["accessToken"]["fineGrained"]["scoped"]:
            if entity["entity"]["name"] == org and "repo.write" in entity["permissions"]:
                is_authed = True
    except Exception:
        raise ValueError("❌ You are not logged in. Please run `hf auth login` or `export HF_TOKEN=...`")
    if not is_authed:
        raise ValueError(f"❌ Your current token `{token}` does not have write access to `{org}`")
    print(f"✅ Confirmed write access with token `{token}` to `{org}`")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--username", "-U", default="PrimeIntellect", type=str, help="The username to push the dataset to."
    )
    parser.add_argument(
        "--dataset-name", "-D", default="SWE-rebench-V2-Filtered-Verified", type=str, help="The dataset name."
    )
    parser.add_argument("--dataset-private", "-p", action="store_true", help="Whether to make the dataset private.")
    parser.add_argument("--push-to-hub", "-H", action="store_true", help="Whether to push the dataset to the hub.")
    parser.add_argument(
        "--min-confidence", "-c", default=0.95, type=float, help="Minimum llm_metadata.confidence to keep."
    )
    parser.add_argument(
        "--also-report-090",
        action="store_true",
        default=True,
        help="If <50 rows at the chosen confidence, also report the count at >= 0.90.",
    )
    args = parser.parse_args()

    assert len(args.dataset_name.split("/")) == 1, "Dataset name must not include the username"
    if args.push_to_hub:
        check_write_access(args.username)

    main(
        repo_name=f"{args.username}/{args.dataset_name}",
        push_to_hub=args.push_to_hub,
        private=args.dataset_private,
        min_confidence=args.min_confidence,
        also_report_090=args.also_report_090,
    )

````

</details>



## Original Dataset Card

Snapshot of the [`nebius/SWE-rebench-V2`](https://huggingface.co/datasets/nebius/SWE-rebench-V2)
card at card-build time — see the live card for updates.

<details>
<summary>Original <code>nebius/SWE-rebench-V2</code> dataset card</summary>

# SWE-rebench-V2

## Dataset Summary

SWE-rebench-V2 is a curated dataset of software-engineering tasks derived from real GitHub issues and pull requests. The dataset contains 32,079 samples covering Python, Go, TypeScript, JavaScript, Rust, Java, PHP, Kotlin, Julia, Elixir, Scala, Swift, Dart, C, C++, C#, R, Clojure, OCaml, and Lua.
For log parser functions, base Dockerfiles, and the prompts used, please see https://github.com/SWE-rebench/SWE-rebench-V2  
The detailed technical report is available at [“SWE-rebench V2: Language-Agnostic SWE Task Collection at Scale”](https://arxiv.org/abs/2602.23866).

## Quick Start

```python
from datasets import load_dataset

ds = load_dataset("nebius/SWE-rebench-V2", split="train")
print(len(ds))  # 32079
```

## Dataset Structure

| Field | Type | Description |
|---|---|---|
| `instance_id` | `string` | Unique identifier for the instance |
| `repo` | `string` | GitHub repository in `owner/repo` format |
| `base_commit` | `string` | Git commit SHA of the base before the fix |
| `patch` | `string` | The gold patch that resolves the issue |
| `test_patch` | `string` | Diff adding or modifying tests that verify the fix |
| `problem_statement` | `string` | Issue description the patch addresses |
| `pr_description` | `string` | Full pull request description |
| `created_at` | `int64` | Unix timestamp (milliseconds) of the issue/PR creation |
| `image_name` | `string` | Docker image name used for the evaluation environment |
| `language` | `string` | Primary programming language of the repository |
| `interface` | `string` | Description of the code interface changed by the patch |
| `license` | `string` | SPDX license identifier of the repository |
| `FAIL_TO_PASS` | `list[string]` | Test IDs that fail before the patch and pass after |
| `PASS_TO_PASS` | `list[string]` | Test IDs that pass both before and after the patch |
| `install_config` | `struct` | Configuration needed to reproduce the test environment |
| `meta` | `struct` | Metadata and LLM-generated quality annotations |

# License
The dataset is licensed under the Creative Commons Attribution 4.0 license. However, please respect the license of each specific repository on which a particular instance is based. To facilitate this, the license of each repository at the time of the commit is provided for every instance.


# Citation

```bibtex
@misc{badertdinov2026swerebenchv2languageagnosticswe,
      title={SWE-rebench V2: Language-Agnostic SWE Task Collection at Scale}, 
      author={Ibragim Badertdinov and Maksim Nekrashevich and Anton Shevtsov and Alexander Golubev},
      year={2026},
      eprint={2602.23866},
      archivePrefix={arXiv},
      primaryClass={cs.SE},
      url={https://arxiv.org/abs/2602.23866}, 
}

</details>