File size: 44,409 Bytes
99e41a8
 
 
 
 
 
caa90b0
99e41a8
 
caa90b0
 
 
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b2ead12
99e41a8
 
 
 
 
caa90b0
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
caa90b0
 
 
 
 
 
 
 
 
 
 
 
 
 
f4fdc38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
caa90b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4fdc38
caa90b0
f4fdc38
caa90b0
f4fdc38
 
 
caa90b0
 
 
f4fdc38
caa90b0
 
 
 
 
f4fdc38
 
caa90b0
 
f4fdc38
caa90b0
 
 
 
 
 
 
 
b2ead12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4fdc38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b2ead12
caa90b0
 
 
 
 
 
 
f4fdc38
caa90b0
 
b2ead12
 
 
 
 
caa90b0
b2ead12
 
 
 
 
 
 
caa90b0
 
f4fdc38
 
 
 
b2ead12
f4fdc38
b2ead12
 
 
caa90b0
b2ead12
 
 
caa90b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4432cde
caa90b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5de05c
 
 
 
 
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5de05c
99e41a8
c5de05c
99e41a8
c5de05c
654707f
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
caa90b0
f4fdc38
 
 
99e41a8
 
 
 
 
 
 
caa90b0
f4fdc38
caa90b0
99e41a8
 
 
 
 
 
 
 
c5de05c
 
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
b2ead12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
caa90b0
 
f4fdc38
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
caa90b0
 
99e41a8
 
caa90b0
99e41a8
 
 
 
 
 
 
 
 
 
f4fdc38
caa90b0
f4fdc38
caa90b0
f4fdc38
 
 
 
 
caa90b0
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4432cde
 
 
 
 
 
 
 
99e41a8
 
 
 
 
caa90b0
 
 
 
4432cde
99e41a8
4432cde
 
99e41a8
b2ead12
99e41a8
 
 
 
caa90b0
 
f4fdc38
 
99e41a8
 
 
 
 
 
b5c7329
99e41a8
f4fdc38
 
99e41a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
639
640
641
642
643
644
645
646
647
#!/usr/bin/env python3
"""Generate README.md from results/leaderboard.json, so every number in the README is computed, not typed.

  python scripts/run_benchmark.py && python scripts/make_figures.py && python scripts/make_readme.py
"""
import json
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent))
import racenet_report  # noqa: E402

LB = json.loads(Path("results/leaderboard.json").read_text())


def pct(x, d=1):
    return "–" if x is None or x != x else f"{100 * x:.{d}f}"


def row(track, method):
    return next((r for r in LB.get(track, []) if r["method"] == method), None)


def best(track, pred):
    rs = [r for r in LB.get(track, []) if pred(r["method"]) and not r["method"].startswith("REF")]
    return max(rs, key=lambda r: r["mean_acc"]) if rs else None


def lb_table(track, n=8):
    rs = LB.get(track, [])
    out = ["| rank (90% CI) | method | mean | clean | liars < 50% | liars ≥ 50% | worst cell |",
           "|---|---|---:|---:|---:|---:|---:|"]
    for r in rs[:n] + [r for r in rs[n:] if r["method"].startswith("REF")]:
        rk = f"**{r['rank']:.0f}** ({r['rank_lo']}–{r['rank_hi']})" if "rank" in r else "ref"
        nm = f"**{r['method']}**" if ("new" in r["method"] or r["method"].startswith(("race_c", "race_map", "race_net_m"))) else r["method"]
        out.append(f"| {rk} | {nm} | **{pct(r['mean_acc'])}** | {pct(r['clean'])} | {pct(r['minority_liars'])} | "
                   f"{pct(r['majority_liars'])} | {pct(r['worst_cell'])} |")
    return "\n".join(out)


MY_TESTS = sorted(str(p) for p in Path("tests").glob("test_*.py"))


def n_tests():
    import subprocess
    import sys
    out = subprocess.run([sys.executable, "-m", "pytest", "--collect-only", "-q", "-p", "no:cacheprovider", *MY_TESTS],
                         capture_output=True, text=True).stdout
    return sum(1 for line in out.splitlines() if "::" in line)


def main():
    nt = n_tests()
    rep = LB.get("ERQA_reproduction", {})
    rep768 = LB.get("ERQA_reproduction_768")
    sw = LB.get("ERQA_swarm", {})
    swt = {t["system"]: t for t in sw.get("table", [])}
    singles = [t for t in sw.get("table", []) if not t["system"].startswith("swarm")]
    best_single = max(singles, key=lambda t: t["acc"]) if singles else None
    swarms = [t for t in sw.get("table", []) if t["system"].startswith("swarm")]
    best_swarm = max(swarms, key=lambda t: t["acc"]) if swarms else None
    cga = swt.get("swarm: RACE CGA · receiver = Cosmos-Reason2-2B (CPU, ours)")
    cosmos_alone = swt.get("Cosmos-Reason2-2B (CPU, ours)")
    so_c = swt.get("swarm: RACE sign-only anchor · receiver = Cosmos-Reason2-2B (CPU, ours)")
    erqa_att = {r["method"]: r for r in LB.get("ERQA_attack_cosmos", [])}
    pb = LB.get("PlanBench", {})
    pbt = {t["system"]: t for t in pb.get("table", [])}
    A = {r["method"]: r for r in LB.get("A", [])}
    a_best = best("A", lambda m: True)
    a_rec, a_maj = A.get("receiver_only"), A.get("majority")
    B = {r["method"]: r for r in LB.get("B", [])}
    csys = {r["system"]: r for r in LB.get("C_systems", [])}
    zs = [r for n, r in csys.items() if n.endswith("zero-shot") and not n.startswith("swarm")]
    en = [r for n, r in csys.items() if n.endswith("engineered") and not n.startswith(("swarm", "small"))]
    zs_mean = sum(r["acc"] for r in zs) / max(1, len(zs))
    en_mean = sum(r["acc"] for r in en) / max(1, len(en))
    flash = (csys.get("gemini-3.1-flash-lite [gemini] zero-shot"), csys.get("gemini-3.1-flash-lite [gemini] engineered"))

    if rep768:
        mv448, mv768 = rep.get("by_type", {}).get("Multi-view Reasoning"), rep768["by_type"].get("Multi-view Reasoning")
        sig = rep768["mv_mcnemar_p"] < 0.05
        res_text = (f"**Resolution ablation (≤768² px):** {pct(rep768['acc'])}% overall. Only {pct(rep768['frac_affected'])}% of "
                    f"questions contain an image larger than 448², and {rep768['n_changed_answers']} of 400 answers change. "
                    f"Multi-view rises from {pct(mv448)}% to {pct(mv768)}% ({rep768['mv_gain']} gained vs {rep768['mv_loss']} lost "
                    f"of {rep768['mv_n']}; exact McNemar p = {rep768['mv_mcnemar_p']:.2f}). "
                    + ("Higher resolution helps multi-view questions significantly." if sig else
                       f"The direction suggests resolution matters for multi-view matching, but the effect is not significant "
                       f"at n = {rep768['mv_n']}, and most of the weakness remains a capability limit of the 2B model."))
    else:
        res_text = "A ≤768² px resolution ablation is in progress (`scripts/erqa_cosmos.py 768`)."
    # ---------------- new in this release: Panda replication, RACE-Net, Track D, LLM mazes, published context, Kaggle
    AP = {r["method"]: r for r in LB.get("AP", [])}
    A0 = {r["method"]: r for r in LB.get("A0", [])}
    D = {r["method"]: r for r in LB.get("D", [])}
    dsucc = LB.get("D_success", {})
    ap_best = best("AP", lambda m: True)
    net = "race_net (new, learned)"

    def cell(tab, m, key="mean_acc"):
        return pct(tab[m][key]) if m in tab else "–"
    kag_p = Path("results/kaggle/replication.json")
    kag = json.loads(kag_p.read_text()) if kag_p.exists() else None
    cfg_p = Path("models/racenet/config.json")
    cfg = json.loads(cfg_p.read_text()) if cfg_p.exists() else {}
    AH = {k: {r["method"]: r for r in LB.get(k, [])} for k in ("AH_so101", "AH_panda")}
    a_net_rank = f"{A[net]['rank']:.0f}" if net in A and "rank" in A[net] else "–"
    hold_row, hold_md = "", ""
    fr_p = Path("results/holdout/FREEZE.json")
    if AH["AH_so101"] and AH["AH_panda"] and fr_p.exists():
        fr = json.loads(fr_p.read_text())
        hs, hp = AH["AH_so101"], AH["AH_panda"]
        ours = [m for m in (net, "race_pool (new)", "race_s_online (new)", "race_online (new)") if m in hs]
        hbest = max(ours, key=lambda m: hs[m]["mean_acc"] + hp[m]["mean_acc"])
        hold_row = (f"| **Hold-out** (new episodes, both arms, evaluated after the freeze) | same protocol, nothing tuned on it | "
                    f"receiver alone {cell(hs, 'receiver_only')} / {cell(hp, 'receiver_only')} · majority {cell(hs, 'majority')} / {cell(hp, 'majority')} | "
                    f"RACE-S online **{cell(hs, 'race_s_online (new)')}** / **{cell(hp, 'race_s_online (new)')}** · RACE-Pool **{cell(hs, 'race_pool (new)')}** / "
                    f"**{cell(hp, 'race_pool (new)')}** · RACE-Net-V {cell(hs, net)} / {cell(hp, net)} |\n")
        rk = lambda t, m: f"{t[m]['rank']:.0f}" if m in t and "rank" in t[m] else "–"  # noqa: E731
        hold_verdict = f"""**Reading.** On data nothing was tuned on, the receiver-anchored family keeps its margin over every literature baseline
(majority {cell(hs, 'majority')} / {cell(hp, 'majority')}, Dawid–Skene (crowd-kit) {cell(hs, 'DS (crowd-kit)')} / {cell(hp, 'DS (crowd-kit)')}, receiver alone
{cell(hs, 'receiver_only')} / {cell(hp, 'receiver_only')}). Among our own methods the EM-based ones are ahead: RACE-S online is rank {rk(hs, 'race_s_online (new)')} on SO-101
and RACE-Pool is rank {rk(hp, 'race_pool (new)')} on the Panda. The learned **RACE-Net-V is rank {rk(hs, net)} and {rk(hp, net)}**
({cell(hs, net)} / {cell(hp, net)}); its first place on the SO-101 test track ({cell(A, net)}) does **not** replicate here. For camera swarms
the recommendation is therefore RACE-S online or RACE-Pool. RACE-Net-V is within 1 to 4 points of them, which is the honest size of the gap between
learning the inference from simulated swarms and fitting it on the window at hand."""

        def prow(key, title):
            pj = LB.get(key + "_paired") or []
            return "\n".join(f"| {title} | {r['a'].replace(' (new)', '').replace(' (new, learned)', '')} − {r['b'].replace(' (new)', '')} | {100 * r['diff']:+.1f} | "
                             f"{100 * r['lo']:+.1f} … {100 * r['hi']:+.1f} | {r['wins']} / {r['losses']} |" for r in pj[:3])
        hold_md = f"""### Hold-out — a test nothing was tuned on

Both earlier test tracks were looked at while RACE-Net-V was being developed. For a clean final number, **{sum(fr['holdout_views_scored'].values()):,} new camera
views** were generated with new seeds for both arms (60 history + 110 evaluation episodes each). The views were scored by the frozen Cosmos-Reason2
pipeline, and no fusion method was run on them until commit [`{fr['frozen_commit'][:7]}`](https://github.com/Hisernberg/robotics/commit/{fr['frozen_commit']}) had frozen every model,
rule and threshold (`results/holdout/FREEZE.json`; `run_benchmark.py` refuses to evaluate the hold-out without that record).

<table><tr><td width="50%">

**SO-101 hold-out**

{lb_table('AH_so101', n=7)}

</td><td width="50%">

**Franka Panda hold-out**

{lb_table('AH_panda', n=7)}

</td></tr></table>

| hold-out | comparison | difference | 95% CI (cells) | better / worse |
|---|---|---:|---|---:|
{prow('AH_so101', 'SO-101')}
{prow('AH_panda', 'Panda')}

{hold_verdict}
"""
    panda_md = ""
    if AP:
        panda_md = f"""### Track A-Panda — does it replicate on a different robot?

Every method and hyper-parameter was frozen (and pushed) before this data existed. The same tasks, cameras, failure modes and
physics-based labels were then generated with a **Franka Panda** (7-DOF, MuJoCo Menagerie): 220 new episodes, 1,100 new Cosmos-Reason2 views.

<p align="center"><img src="media/videos/panda_rollouts.gif" width="960"><br><sub>Franka Panda rollouts with the camera swarm's verdicts. <a href="media/videos/panda_rollouts.mp4">MP4</a></sub></p>

{lb_table('AP')}

<table><tr><td width="50%"><img src="media/figures/cross_embodiment.png"></td><td width="50%"><img src="media/figures/panda_gallery.png"></td></tr></table>

The best method on the Panda is **{ap_best['method']}** ({pct(ap_best['mean_acc'])}; liar-majority cells {pct(ap_best['majority_liars'])} vs
majority vote {cell(AP, 'majority', 'majority_liars')}). The left panel plots every method's mean accuracy on the SO-101 against the Panda.

<details><summary><b>Full Track A-Panda bar chart (all methods)</b></summary>
<p align="center"><img src="media/figures/trackAP_leaderboard.png" width="760"></p>
</details>
"""
    net_md = ""
    if net in A or net in AP:
        net_md = f"""### RACE-Net-V — the learned verification model

RACE and RACE-S run a hand-specified EM on every window. **RACE-Net-V** is a {cfg.get('n_params', 213889):,}-parameter axial set transformer that has
*learned* the same receiver-anchored inference: it reads a whole window of unlabelled swarm reports, knows only which column is the receiver,
and outputs P(success) for every episode. It is trained **only on synthetic swarms** (no benchmark data, labels or agent outputs)
and then applied unchanged to the real Cosmos-Reason2 camera swarms.{' The released checkpoint is the EM-refinement variant: it also receives the RACE-S and RACE estimates of the window and learns to refine them.' if cfg.get('advisors') else ''}
**RACE-Pool** is the AIP-style pool of RACE-Net-V, RACE-S and RACE ([design](docs/MODELS.md)).

<table><tr><td width="42%"><img src="media/architecture/racenet.png"></td><td width="58%"><img src="media/figures/racenet.png"></td></tr></table>

| mean accuracy over all attack cells | A0 procedural (development) | SO-101 (test) | Franka Panda (test) |
|---|---:|---:|---:|
| majority vote | {cell(A0, 'majority')} | {cell(A, 'majority')} | {cell(AP, 'majority')} |
| Dawid–Skene (crowd-kit) | {cell(A0, 'DS (crowd-kit)')} | {cell(A, 'DS (crowd-kit)')} | {cell(AP, 'DS (crowd-kit)')} |
| RACE online | {cell(A0, 'race_online (new)')} | {cell(A, 'race_online (new)')} | {cell(AP, 'race_online (new)')} |
| RACE-S online | {cell(A0, 'race_s_online (new)')} | {cell(A, 'race_s_online (new)')} | {cell(AP, 'race_s_online (new)')} |
| **RACE-Net-V (learned, zero-shot)** | **{cell(A0, net)}** | **{cell(A, net)}** | **{cell(AP, net)}** |
| **RACE-Pool (RACE-Net-V + RACE-S + RACE)** | **{cell(A0, 'race_pool (new)')}** | **{cell(A, 'race_pool (new)')}** | **{cell(AP, 'race_pool (new)')}** |
| *labelled stacker (reference)* | {cell(A0, 'REF stack_lr (labelled)')} | {cell(A, 'REF stack_lr (labelled)')} | {cell(AP, 'REF stack_lr (labelled)')} |

Liar-majority cells: RACE-Net-V {cell(A, net, 'majority_liars')} on SO-101 and {cell(AP, net, 'majority_liars')} on the Panda
(RACE-S online: {cell(A, 'race_s_online (new)', 'majority_liars')} / {cell(AP, 'race_s_online (new)', 'majority_liars')}).
Weights, config and a standalone inference file are in [`models/racenet`](models/racenet) and on the Hub:
[🤗 Nabidnur/RoboRACE-Net](https://huggingface.co/Nabidnur/RoboRACE-Net).

{racenet_report.selection_md()}
{racenet_report.scaling_md()}"""
    d_md = ""
    if D:
        dn, dr, dm = cell(D, "race_net_m"), cell(D, "race_net_m + reach-repair"), cell(D, "race_map")
        drows = json.loads(Path("results/trackD/rows.json").read_text())

        def datk(m, a):
            v = [r["acc"] for r in drows if r["method"] == m and r["attack"] == a]
            return pct(sum(v) / len(v)) if v else "–"
        best_base = max((r for r in D.values() if r["method"] in ("wmsr_trim", "reputation", "eigentrust", "dawid_skene", "majority", "trust_all", "solo")),
                        key=lambda r: r["mean_acc"])
        abl = LB.get("D_repair_ablation") or []
        abl_rows = "\n".join(f"| {r['fusion']} | {r['standard']:.1f} | {r['repair']:.1f} | {r['collude_standard']:.1f} → {r['collude_repair']:.1f} | "
                             f"{r['false_walls_standard']:.1f} → {r['false_walls_repair']:.1f} |" for r in abl)
        mab = json.loads(Path("results/racenet_m/ablation.json").read_text()) if Path("results/racenet_m/ablation.json").exists() else None
        mab_md = ""
        if mab:
            mab_rows = "\n".join(f"| {r['model']} | {pct(r['val_cell_acc'])} | {pct(r['by_liars']['3'][0])} | {pct(r['by_liars']['5'][0])} |" for r in mab["rows"])
            b0 = mab["rows"][0]
            mab_md = f"""
Belief quality on held-out mazes (accuracy on cells a peer reported and the receiver has not sensed; 6,111 snapshots):

| model | all | 3 of 5 peers lie | 5 of 5 peers lie |
|---|---:|---:|---:|
| `race_map` (hand-written Bayesian rule) | {pct(b0['val_cell_acc_bma'])} | {pct(b0['by_liars']['3'][1])} | {pct(b0['by_liars']['5'][1])} |
{mab_rows}
"""
        msc_p = Path("results/racenet_m/scaling.json")
        msc_md = ""
        if msc_p.exists():
            msc = json.loads(msc_p.read_text())
            mrows = "\n".join(f"| {c['label']} | {c['liars']} | {pct(c['spl']['reputation'])} | {pct(c['spl']['wmsr_trim'])} | {pct(c['spl']['race_map'])} | "
                              f"**{pct(c['spl']['race_net_m + reach-repair'])}** | {pct(c['spl']['REF oracle'])} |" for c in msc["configs"])
            msc_md = f"""**Other swarm and map sizes.** The model was trained on 6 robots in 12×12-cell mazes. Unchanged, with half of the robots lying
({msc['mazes']} new mazes × {len(msc['attacks'])} attacks per row; computed in a Kaggle CPU notebook):

<p align="center"><img src="media/figures/racenet_m_scaling.png" width="960"></p>

| setting | liars | beta-reputation | W-MSR trimming | race_map | RACE-Net-M + repair | oracle |
|---|---:|---:|---:|---:|---:|---:|
{mrows}

In small mazes (8×8) every rule is within a few points of the others: there is little to gain from peers. The gap grows with the map and the swarm.
"""
        d_md = f"""### Track D — maze exploration with lying robots

Six mobile robots must each reach a goal in an unknown maze. Each senses its 8 neighbouring cells, broadcasts what it sensed, and re-plans every
step on its fused belief map. Up to four robots corrupt their broadcasts (false walls, false openings, full inversion, random, a colluding bloc
that walls off the goal, sleepers). Score = SPL (success weighted by path length) of the honest robots.

<p align="center"><img src="media/videos/maze_swarm.gif" width="960"><br><sub>Three of six robots invert their reports. Majority map fusion believes the false walls (red);
RACE-Net-M verifies each peer against cells the robot sensed itself and <b>inverts</b> the liars. This is the maze with the largest gap between the
two rules; averages are in the table. <a href="media/videos/maze_swarm.mp4">MP4</a></sub></p>

**RACE-Net-M** is the learned map-fusion model ([design](docs/MODELS.md)): 44,837 parameters, trained on simulated maze swarms with *random* two-coin liars.
The benchmark's attack names never appear in its training, and the colluding ring attack is outside that family. It is compared with six rules from the
literature and with our hand-written `race_map` on 20 fresh mazes × 25 conditions.

{lb_table('D', n=11)}

- **Rank 1.** RACE-Net-M scores {dn} ({dr} with reachability repair), against {dm} for the hand-written `race_map` and {pct(best_base['mean_acc'])} for the best
  literature baseline ({best_base['method']}). The oracle that knows who lies scores {cell(D, 'REF oracle')}.
- **Goal reached in time:** RACE-Net-M + repair {pct(dsucc.get('race_net_m + reach-repair'))}%, RACE-Net-M {pct(dsucc.get('race_net_m'))}%, `race_map` {pct(dsucc.get('race_map'))}%,
  W-MSR trimming {pct(dsucc.get('wmsr_trim'))}%, beta-reputation {pct(dsucc.get('reputation'))}%, majority {pct(dsucc.get('majority'))}% (oracle {pct(dsucc.get('REF oracle'))}%).
- **Wall-inventing liars**, the weak spot of `race_map` ({datk('race_map', 'false_walls')}), are handled: RACE-Net-M {datk('race_net_m', 'false_walls')}.
- **Still open:** the colluding ring ({datk('race_net_m + reach-repair', 'collude')} with repair, oracle {datk('REF oracle', 'collude')}). The liars are honest everywhere
  else, so their channel looks reliable until a robot stands next to the goal.

<p align="center"><img src="media/figures/trackD_vs_liars.png" width="980"></p>

<p align="center"><img src="media/videos/maze_false_walls.gif" width="960"><br><sub>Three of six robots invent walls. Beta-reputation believes dozens of them;
RACE-Net-M learns that these peers' wall reports are worthless while their "free" reports are true, and keeps only the latter.
<a href="media/videos/maze_false_walls.mp4">MP4</a></sub></p>
{mab_md}
{msc_md}
**Reachability repair** (planner ablation, same 500 cells). When the fused map says the goal cannot be reached, the standard planner drops every peer;
the repair un-believes only the claimed walls that enclose the goal. It helps every rule against the colluding ring, but it hurts rules whose map is
already polluted with false walls, so it only pays off on top of an accurate fusion model:

| fusion rule | standard fallback | + reach-repair | collude: standard → repair | false_walls: standard → repair |
|---|---:|---:|---:|---:|
{abl_rows}

<details><summary><b>More Track D figures</b></summary>
<p align="center"><img src="media/figures/trackD_leaderboard.png" width="640"></p>
<p align="center"><img src="media/figures/trackD_heatmap.png" width="720"></p>
</details>
"""
    mz = LB.get("maze_llm") or []
    mz_md = ""
    if mz:
        sz = lambda r, k: f"{pct(r['modulo_' + k])} (n={r['n_' + k]})" if r.get("n_" + k) else "–"  # noqa: E731
        mz_rows = "\n".join(f"| {r['agent']} | {r['n']} | {pct(r['oneshot'])} | **{pct(r['modulo'])}** | {sz(r, '4')} | {sz(r, '6')} | {r['calls']:.2f} |"
                            for r in mz)
        mz_md = f"""### LLM agents in text mazes

The same mazes as ASCII text: the agent answers with a move string and an exact simulator returns the first illegal move (LLM-Modulo, ≤3 repairs).
All 40 shortest paths validate (`tests/test_maze.py`). Free-tier quotas cut some agents short, so `n` differs per agent: compare one-shot with Modulo within a row, not rows with each other.

<table><tr><td width="55%"><img src="media/figures/maze_llm.png"></td><td width="45%">

| agent | n | one-shot | Modulo | 4×4 | 6×6 | calls |
|---|---:|---:|---:|---:|---:|---:|
{mz_rows}

</td></tr></table>
"""
    pub_md = ""
    if LB.get("published"):
        pub_md = """## Part III — how this compares with published numbers

<p align="center"><img src="media/figures/published_context.png" width="1000"></p>

Grey bars are copied from the cited papers' own tables (ERQA: Gemini Robotics report, Feb 2025, and the NVIDIA Cosmos-Reason2 model card;
PlanBench: Valmeekam et al. 2024, 600 instances). Teal bars are measured in this repo. They are **context, not same-condition comparisons**:
the models are newer, hosted agents were run on quota-limited subsets with a brief-reasoning prompt, and our PlanBench numbers use a seeded
100-instance subset. The full tables with sources and confidence intervals are in the [leaderboard](results/LEADERBOARD.md#part-iii--context-published-numbers-next-to-ours).

---
"""
    kag_md = ""
    if kag:
        same = (f"{kag['n_identical']:,} identical, {kag['n_differing']} differ by at most {kag['max_abs_diff']:.5f} ({kag['note'].split(':')[0].replace('All differing values belong to ', '')})"
                if kag.get("n_differing") else f"max abs difference {kag['max_abs_diff']:.4f}")
        kag_md = (f"| independent replication on Kaggle CPU | a Kaggle notebook ({kag['cpu']}) re-ran the tests ({kag['tests'].split(' in ')[0]}) and recomputed every track, "
                  f"the hold-out included, from the public Hugging Face copy ({kag.get('hf_snapshot', '')}) in {kag.get('benchmark_minutes', 0):.0f} min: "
                  f"{kag['n_values']:,} leaderboard values compared, {same} |\n")
    pb_rows = []
    for a in pb.get("agents", []):
        o, m = pbt.get(f"{a} · one-shot"), pbt.get(f"{a} · LLM-Modulo (≤3 repairs)")
        if o and m:
            pb_rows.append(f"| {a} | {pct(o['acc'])} | **{pct(m['acc'])}** | +{pct(m['acc'] - o['acc'])} | {m['calls']:.2f} |")
    for n, t in pbt.items():
        if n.startswith("swarm"):
            pb_rows.append(f"| {n} | – | **{pct(t['acc'])}** | | {t['calls']:.2f} |")

    erqa_rows = [f"| {t['system'].replace('swarm: ', '⊕ ')} | **{pct(t['acc'])}** | {pct(t['lo'])}–{pct(t['hi'])} | "
                 f"{pct(t['reweighted'])} |" for t in sw.get("table", [])]
    ss = sw.get("sota_subset") or {}

    text = f"""<div align="center">

# RoboRACE

### Byzantine-robust multi-agent robotics — when some of your robots, cameras or AI agents are wrong on purpose

**CPU-only · 2 public benchmarks (ERQA, PlanBench) + 5 RoboRACE tracks · two robot arms, a mobile-robot maze swarm, real VLMs and LLMs · two learned models on one design (RACE-Net-V, RACE-Net-M) · a hold-out evaluated after a recorded freeze · every number regenerated from cached outputs**

[Leaderboard](results/LEADERBOARD.md) · [Protocol](docs/BENCHMARK.md) · [Models](docs/MODELS.md) · [Plan](docs/PLAN.md) · [Architecture](#architecture) · [Videos](media/videos) · [Figures](media/figures)

[🤗 Dataset · full work](https://huggingface.co/datasets/Nabidnur/RoboRACE-Bench) · [🤗 Model · RACE-Net-V](https://huggingface.co/Nabidnur/RoboRACE-Net) · [🤗 Model · RACE-Net-M](https://huggingface.co/Nabidnur/RoboRACE-Net-M) · [🤗 Space · showcase](https://huggingface.co/spaces/Nabidnur/RoboRACE) · [🤗 Space · liar playground](https://huggingface.co/spaces/Nabidnur/RoboRACE-Playground)

<img src="media/videos/robot_rollouts.gif" width="960" alt="SO-101 arm rollouts seen by five camera agents; three cameras lie; majority vote flips, RACE-S stays correct">

<sub>A MuJoCo SO-101 arm (Menagerie model) runs pick-and-place; ground truth is the final physics state. Five camera agents judge success with
Cosmos-Reason2-2B on a CPU. Then 3 of 5 cameras invert their reports: majority vote flips, <b>RACE-S</b> learns negative weights for the liars without labels and stays correct.
The GIF is a 12-second highlight; the full 43-second film (3 episodes) is the <a href="media/videos/robot_rollouts.mp4">MP4 (1280×720, 30 fps)</a>.</sub>

</div>

---

## Headline results

| benchmark | what is measured | strongest baseline | **ours** |
|---|---|---|---|
| **ERQA** (Gemini Robotics team, 400 Q) | reproduce Cosmos-Reason2-2B on CPU | NVIDIA reports {pct(rep.get('published'), 2)} | **{pct(rep.get('acc'))}** (95% CI {pct(rep.get('lo'))}–{pct(rep.get('hi'))}) ✓ inside |
| **ERQA** multi-agent | {len(sw.get('agents', []))} VLM agents, {sw.get('n_questions', '–')} shared Q | best single agent {pct(best_single['acc']) if best_single else '–'} | best swarm **{pct(best_swarm['acc']) if best_swarm else '–'}** · robot's own model {pct(cosmos_alone['acc']) if cosmos_alone else '–'} → **{pct(cga['acc']) if cga else '–'}** with CGA |
| **PlanBench** Blocksworld | plan generation, {pb.get('n_instances', '–')} instances | official one-shot prompt | LLM-Modulo + swarm cascade: see [table](#planbench-blocksworld--the-validator-is-the-planner) |
| **Track A** SO-101 camera swarm | success verification under 7 attacks | receiver alone {pct(a_rec['mean_acc']) if a_rec else '–'} · majority {pct(a_maj['mean_acc']) if a_maj else '–'} | **{pct(a_best['mean_acc']) if a_best else '–'}** {a_best['method'] if a_best else ''} (rank {a_best.get('rank', 0):.0f}) |
| **Track A-Panda** cross-embodiment | same protocol on a Franka Panda, methods frozen | receiver alone {cell(AP, 'receiver_only')} · majority {cell(AP, 'majority')} | **{pct(ap_best['mean_acc']) if ap_best else '–'}** {ap_best['method'] if ap_best else ''} |
| **RACE-Net-V** (our model, 0.2 M params) | learned fusion, zero-shot on real camera swarms | RACE-S online {cell(A, 'race_s_online (new)')} / {cell(AP, 'race_s_online (new)')} | **{cell(A, net)}** SO-101 (rank {a_net_rank}) / **{cell(AP, net)}** Panda · RACE-Pool **{cell(A, 'race_pool (new)')}** / **{cell(AP, 'race_pool (new)')}** |
{hold_row}| **Track B** 12-robot rendezvous | mission success, up to 5 Byzantine robots | W-MSR {pct(B['wmsr']['mean_acc']) if 'wmsr' in B else '–'} | **{pct(B['race_c+wmsr']['mean_acc']) if 'race_c+wmsr' in B else '–'}** RACE-C + W-MSR (rank 1) |
| **Track D** maze swarm · **RACE-Net-M** (our model, 45 K params) | SPL under 6 attacks, 10 fusion rules | W-MSR trimming {cell(D, 'wmsr_trim')} · beta-reputation {cell(D, 'reputation')} · EigenTrust {cell(D, 'eigentrust')} | **{cell(D, 'race_net_m + reach-repair')}** RACE-Net-M (rank 1; oracle {cell(D, 'REF oracle')}) · hand-written RACE map {cell(D, 'race_map')} |
| **Track C** LLM planners | exact-plan accuracy | zero-shot mean {pct(zs_mean)} | engineered mean **{pct(en_mean)}** · flash-lite {pct(flash[0]['acc']) if flash[0] else '–'} → **{pct(flash[1]['acc']) if flash[1] else '–'}** |

<p align="center"><img src="media/figures/overview.png" width="920"></p>

**Videos** (GIF previews play inline below; full-quality 1280×720 MP4s):
[SO-101 camera swarm](media/videos/robot_rollouts.mp4) ·
[Byzantine rendezvous](media/videos/swarm_rendezvous.mp4) ·
[PlanBench LLM-Modulo replay](media/videos/planbench_modulo.mp4) ·
[maze swarm](media/videos/maze_swarm.mp4) · [maze, wall-inventing liars](media/videos/maze_false_walls.mp4) ·
[Franka Panda camera swarm](media/videos/panda_rollouts.mp4)

## The idea in one paragraph

A robot team fuses evidence from many agents. Some of them are broken, biased, colluding or adversarial. Majority vote and classical
crowdsourcing (Dawid–Skene, GLAD, MACE) fail once liars are the majority, because the latent-truth model becomes symmetric. **RACE**
(from the *Liars Are Information* program) breaks the symmetry with an **anchor**: each receiver knows it is honest. Peers then get *signed*
channel weights: positive means trust, negative means **invert**, near zero means discard. A consistent liar carries information. This repo adds
**RACE-S** (score level), **online** variants (against sleepers), **confidence-gated anchoring (CGA)** (a measured compromise between robustness and
clean-data gains), **RACE-C + W-MSR** (continuous robot consensus), an **engineered / LLM-Modulo** planning layer, and two **learned** versions of the idea:
**RACE-Net-V** for camera swarms and **RACE-Net-M** for map fusion, plus **RACE-Pool**, an AIP-style pool of anchored experts.

## Architecture

<table><tr>
<td width="52%"><img src="media/architecture/cosmos_reason2_verifier.png"></td>
<td width="48%"><img src="media/architecture/race_s.png"><br><img src="media/architecture/roborace_system.png"></td>
</tr></table>

<p align="center"><img src="media/architecture/plotnn/cosmos_verifier_plotnn.png" width="900"><br>
<sub>Same verifier as a <a href="https://github.com/HarisIqbal88/PlotNeuralNet">PlotNeuralNet</a> tensor diagram (one 448×448 view → 196 image tokens → P(yes)).
Exact numbers come from the checkpoint: 2.44 B parameters (LLM decoder 1,409 M, embeddings 311 M, untied head 311 M, ViT 302 M, merger + DeepStack 101 M).
Vector version: <a href="media/architecture/plotnn/cosmos_verifier_plotnn.pdf">PDF</a> (LaTeX source alongside). Diagrams are drawn by <code>scripts/make_architecture.py</code> in the style of Sebastian Raschka's LLM architecture figures.</sub></p>

### Our two models: one design

<table><tr>
<td width="50%"><img src="media/architecture/racenet.png"></td>
<td width="50%"><img src="media/architecture/racenet_m.png"></td>
</tr></table>

| | **RACE-Net-V** · pick-and-place | **RACE-Net-M** · maze |
|---|---|---|
| question | did the arm succeed? (camera swarm) | which cells are walls? (robot swarm) |
| receiver's anchor | its own score for every episode | its own exact sensing of some cells |
| structure | axial set transformer over agents × episodes | anchored channel encoder → peer transformer → signed read-out, 3 refinement rounds |
| shared design | anchor on the receiver · estimate each peer's channel in context · **invert** consistent liars · sets, not sequences · synthetic training only |
| size · training | 213,889 parameters · synthetic swarms | 44,837 parameters · simulated mazes with random liars |

Both come from RACE and AIP in the *Liars Are Information* program: RACE supplies the anchored, signed channel estimation; AIP supplies the pooling of
experts (RACE-Pool). The full description is in [docs/MODELS.md](docs/MODELS.md).

---

## Part I — public benchmarks

### ERQA — embodied reasoning

<p align="center"><img src="media/figures/erqa_results.png" width="980"></p>

**Reproduction.** Cosmos-Reason2-2B on 4 CPU cores (bf16, ≤448² px, option letter = argmax of next-token logits): **{pct(rep.get('acc'))}%**
(95% CI {pct(rep.get('lo'))}–{pct(rep.get('hi'))}, n = {rep.get('n', '–')}, {rep.get('median_latency_s', 0):.1f} s per question). NVIDIA reports
{pct(rep.get('published'), 2)}%, which is inside our CI. Multi-view questions are the weakest category ({pct(rep.get('by_type', {}).get('Multi-view Reasoning'))}%).
{res_text}

**Multi-agent swarm** ({', '.join(sw.get('agents', []))}; {sw.get('n_questions', '–')} questions answered by every agent, seeded random order):

| system | accuracy | 95% CI | category-reweighted |
|---|---:|---|---:|
{chr(10).join(erqa_rows)}

{f"Gemini Robotics-ER 2, the SOTA reference, could only be queried on {ss.get('n')} shared questions before its free-tier daily quota ran out. On that subset it scores {pct(ss.get('Gemini Robotics-ER 2'))}%." if ss else ''}

<details><summary><b>Cosmos-Reason2-2B as a success verifier</b> (calibration study on held-out scenes)</summary>
<p align="center"><img src="media/figures/verifier_calibration.png" width="820"><br>
<sub>The model's P(yes) is biased toward "yes": the naive 0.5 threshold accepts almost everything. A threshold chosen on a calibration split
lifts held-out accuracy from 56% to 83% (AUROC 0.925); <code>scripts/eval_verifier.py</code>.</sub></p>
</details>

<p align="center"><img src="media/figures/erqa_pareto_cga.png" width="560"></p>

**Robustness vs usefulness.** With the robot's own CPU model as the receiver, the strong RACE anchor is the only rule whose worst
attacked cell never drops below the robot alone ({pct(erqa_att.get('race (anchored)', {}).get('worst_cell'))} vs {pct(erqa_att.get('receiver_only', {}).get('worst_cell'))}), but it gains nothing on clean data.
The sign-only anchor and Dawid–Skene gain a lot on clean data ({pct(erqa_att.get('race sign-only anchor (ablation)', {}).get('clean'))} / {pct(erqa_att.get('one-coin DS (= RACE unanchored)', {}).get('clean'))})
and collapse under coherent liars (worst cell {pct(erqa_att.get('race sign-only anchor (ablation)', {}).get('worst_cell'))}).
**CGA** sits in between: clean {pct(erqa_att.get('race CGA (new)', {}).get('clean'))} and worst cell {pct(erqa_att.get('race CGA (new)', {}).get('worst_cell'))}.
On an earlier 136-question subset its worst cell matched the receiver. On the full 220-question set and on Track A
({pct(A.get('race CGA (new)', {}).get('worst_cell'))} vs {pct(a_rec['worst_cell']) if a_rec else '–'}) it does **not**, so we report CGA as a compromise point, not a dominating method.

### PlanBench Blocksworld — the validator is the planner

<table><tr><td width="55%"><img src="media/figures/planbench.png"></td>
<td width="45%"><img src="media/videos/planbench_modulo.gif"><br><sub>A real cached LLM plan: the simulator rejects step 11 ("the red block is not clear");
the error message is fed back, and the repaired plan reaches the goal. <a href="media/videos/planbench_modulo.mp4">MP4</a></sub></td></tr></table>

Our exact Blocksworld simulator accepts **all 500 official ground-truth plans** (`tests/test_blocksworld.py`), so it can replace VAL on this domain.
Results on {pb.get('n_instances', '–')} instances that every listed agent answered:

| agent / strategy | one-shot (official prompt) | **LLM-Modulo** (≤3 repairs) | gain | LLM calls / task |
|---|---:|---:|---:|---:|
{chr(10).join(pb_rows)}

The same Qwen3.8-27B weights behave very differently on two providers (Groq vs Cerebras). That is a reproducibility hazard worth reporting in its own right.

---

## Part II — RoboRACE-Bench

### Track A — SO-101 camera swarm

<p align="center"><img src="media/figures/so101_gallery.png" width="900"></p>

220 physics rollouts (110 unlabelled history, 110 evaluation, balanced). Failures are real physics: missed grasps, drops in transit,
near-miss placements and wrong objects. Each of 5 cameras is an agent (Cosmos-Reason2-2B). Every camera takes a turn as the receiver.

{lb_table('A')}

<p align="center"><img src="media/figures/trackA_vs_liars.png" width="980"></p>
<details><summary><b>More Track A figures</b>: per-camera quality, method leaderboard, accuracy by attack</summary>
<p align="center"><img src="media/figures/trackA_cameras.png" width="900"></p>
<p align="center"><img src="media/figures/trackA_leaderboard.png" width="720"></p>
<p align="center"><img src="media/figures/trackA_heatmap.png" width="820"></p>
</details>

<p align="center"><img src="media/figures/race_s_weights.jpg" width="600"><br><sub>RACE-S signed weights, learned without labels: inverted cameras get <b>negative</b> weight (their reports are reused), noisy or stuck cameras get ≈0.</sub></p>

{panda_md}
{net_md}
{hold_md}
### Track B — rendezvous with Byzantine robots

<p align="center"><img src="media/videos/swarm_rendezvous.gif" width="960"><br><sub><a href="media/videos/swarm_rendezvous.mp4">MP4</a> · same robots, same lies, three consensus rules; red dashed = link isolated online by RACE-C.</sub></p>

{lb_table('B')}

<p align="center"><img src="media/figures/trackB_vs_liars.png" width="980"></p>

<details><summary><b>More Track B figures</b>: method leaderboard, mission success by attack</summary>
<p align="center"><img src="media/figures/trackB_leaderboard.png" width="640"></p>
<p align="center"><img src="media/figures/trackB_heatmap.png" width="720"></p>
</details>

### Track C — LLM planners: same models, better plumbing

<p align="center"><img src="media/figures/trackC_systems.png" width="760"></p>

<details><summary><b>Track C swarm leaderboard</b> (real LLM saboteurs, every agent as receiver)</summary>
<p align="center"><img src="media/figures/trackC_leaderboard.png" width="720"></p>
<sub>After engineering, every receiver is ~98% accurate on its own, so fusion can only cost accuracy; RACE costs the least. Full table: <a href="results/LEADERBOARD.md">leaderboard</a>.</sub>
</details>

<details><summary><b>Track A0</b> — the first iteration (procedural tabletop scenes, kept for continuity)</summary>
<p align="center"><img src="media/videos/camera_swarm.gif" width="720"><br>
<sub>Procedural MuJoCo scenes judged by the same five-camera Cosmos swarm; superseded by the SO-101 physics rollouts above.
<a href="media/videos/camera_swarm.mp4">MP4</a> · results in the <a href="results/LEADERBOARD.md">leaderboard</a> (Track A0).</sub></p>
</details>

{d_md}
{mz_md}
---

{pub_md}
## Validation — how we know the numbers are right

| claim | evidence |
|---|---|
| ERQA pipeline is faithful | reported 37.75% lies inside our 95% CI for Cosmos-Reason2-2B |
| Blocksworld validator ≡ VAL here | accepts 500 / 500 official ground-truth plans; rejects ≥95% of swapped or truncated plans |
| W-MSR implemented correctly | honest states never leave the honest hull (W-MSR safety theorem), 5 attacks × F = 1..3 |
| Dawid–Skene implemented correctly | ≥90% decision agreement with the crowd-kit reference implementation on identical data |
| RACE-S calibration is rank-invariant | a cubic distortion of one agent changes ≤2% of decisions |
| SO-101 labels are physical | labels read from the simulator after settling; replay of a cached seed must reproduce its label |
| no test-set tuning | RACE-S hyper-parameters fixed on synthetic data; CGA / sign-only reported as ablations on *every* benchmark; Track D tuned on separate development mazes; both RACE-Net models trained on simulated swarms only and selected on development data |
| findings replicate on a new robot | all methods frozen before the Franka Panda data was generated (Track A-Panda) |
| RACE-Net-V and RACE-Net-M are set functions | outputs unchanged under any permutation of peers or items (`tests/test_racenet.py`, `tests/test_racenet_m.py`) |
| maze checker is exact | all 40 BFS-shortest paths validate with their optimal length (`tests/test_maze.py`) |
| hold-out was not peeked at | `results/holdout/FREEZE.json` records the commit that froze every model and rule; `run_benchmark.py` skips the hold-out without it |
| RACE-Net-M uses liars instead of discarding them | a full inverter alone recovers the map, a coin-flipper adds no evidence (`tests/test_racenet_m.py`) |
| literature baselines are faithful | EigenTrust drops the inverter, trimming removes F votes per cell, Dawid–Skene is right up to a global flip (`tests/test_racenet_m.py`) |
| differences are not noise | paired bootstrap intervals (over mazes for Track D) and exact sign tests in the [leaderboard](results/LEADERBOARD.md) |
| maze data hygiene | five disjoint sets of maze seeds: training, validation, development, benchmark, scaling study ([protocol](docs/BENCHMARK.md)) |
{kag_md}

`pytest` runs {nt} tests. See [docs/BENCHMARK.md](docs/BENCHMARK.md) for the full protocol and threats to validity.

## Reproduce (CPU)

```bash
bash scripts/fetch_assets.sh            # SO-101 (MuJoCo Menagerie), PlotNeuralNet, ERQA, PlanBench
```
```bash
python -m venv .venv && .venv/bin/pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision
```
```bash
.venv/bin/pip install -r requirements.txt
```
```bash
MUJOCO_GL=egl .venv/bin/python -m pytest -q
```
```bash
MUJOCO_GL=egl .venv/bin/python scripts/run_benchmark.py && .venv/bin/python scripts/make_figures.py && .venv/bin/python scripts/make_readme.py
```
Videos (need the SO-101 data and `ffmpeg`):
```bash
MUJOCO_GL=egl .venv/bin/python scripts/make_videos.py && .venv/bin/python scripts/make_gifs.py
```

RACE-Net (training about 40 min on 4 cores, then dev-only selection and the scaling study):
```bash
.venv/bin/python scripts/train_racenet.py --steps 6000 --gen v1 --out models/racenet/candidates/mine
```
```bash
.venv/bin/python scripts/select_racenet.py "mine=models/racenet/candidates/mine" "v1 local=models/racenet/candidates/v1_local" && .venv/bin/python scripts/racenet_analysis.py
```

Regenerating agent outputs needs `HF_TOKEN` (access to the gated `nvidia/Cosmos-Reason2-2B`) and LLM keys as environment variables
(`.env.example`). The scripts are `erqa_cosmos.py`, `erqa_api_agents.py`, `planbench_agents.py`, `so101_generate.py` and `so101_score_views.py`.

## Repository map
```
src/robotics/swarm/       race.py (RACE v3.1) · fusion.py (ACL, rank-Gauss, AIP, DS, RACE, RACE-S, CGA) · racenet.py (RACE-Net) · crowd.py · attacks.py
src/robotics/benchmarks/  erqa.py · blocksworld.py (exact simulator + validator) · maze_text.py
src/robotics/bench/       trackA/B/C/D · erqa_swarm · planbench_eval · leaderboard (bootstrap ranks)
src/robotics/sim/         so101_env.py · panda_env.py (IK pick-and-place, physics ground truth) · tabletop.py
models/racenet/           RACE-Net weights (safetensors), config, training log, selection.json, candidates/ (3 checkpoints)
src/robotics/vlm/         cosmos_reason.py (logit P(yes) verifier)
scripts/                  run_benchmark · train_racenet · select_racenet · racenet_analysis · make_figures · make_videos · make_gifs · make_architecture · make_plotnn · make_readme ·
                          publish_hf + make_space + make_playground (Hugging Face dataset, model, Spaces) · agents
results/                  LEADERBOARD.md · leaderboard.json · cached agent outputs
kaggle/                   the two Kaggle CPU notebooks (RACE-Net training, independent replication)
media/                    figures · videos (mp4 + gif) · architecture (Raschka-style + PlotNeuralNet)
```

## Limitations
- Track A renders are simulated. The SO-101 and Panda meshes are real, but lighting and textures are synthetic, and all cameras share one VLM.
- Track D is a grid world with exact local sensing; the 3-D view in the video is a rendering of the same run, not a physics simulation.
- RACE-Net-V is trained on a hand-written simulator of swarms. On the hold-out it is 1 to 4 points behind our EM methods (RACE-S online, RACE-Pool); its first place on the SO-101 test track did not replicate. A weak receiver (below about 60% accuracy) is still an open weakness of every score-level method here.
- RACE-Net-M is evaluated in one simulator (grid mazes, exact local sensing). A bloc that lies only around the goal still costs about 5 SPL points against the oracle.
- Online variants fit on the current unlabelled evaluation window; a deployed robot would use a sliding window.
- ERQA swarm numbers cover the questions that every hosted agent answered within free-tier quotas. Groq Qwen and Gemma-4 were throttled to near-zero coverage and are excluded.
- PlanBench uses a seeded 100-instance subset. Track C saturates after engineering.
- CGA was proposed after inspecting ERQA. It is reported on every benchmark with fixed settings, but it deserves confirmation on a fresh benchmark.

## Provenance & citation
RACE / *Liars Are Information* ([public demo Space](https://huggingface.co/spaces/Nabidnur/liars-are-information-demo); the dataset `Nabidnur/liars-are-information` is private) ·
AIP-AD ([`Nabidnur/AIP-AD`](https://huggingface.co/Nabidnur/AIP-AD)) · ERQA (Gemini Robotics team) · PlanBench (Valmeekam et al., NeurIPS 2023 D&B) ·
LLM-Modulo (Kambhampati et al., ICML 2024) · W-MSR (LeBlanc et al., IEEE JSAC 2013) · EigenTrust (Kamvar et al., WWW 2003) ·
beta-reputation (Jøsang & Ismail, 2002) · SPL (Anderson et al., 2018) · Dawid & Skene (1979) · crowd-kit (Toloka) ·
Cosmos-Reason2 (NVIDIA) · SO-101 model (MuJoCo Menagerie) · PlotNeuralNet (H. Iqbal) · diagram style after S. Raschka.

```bibtex
@misc{{roborace2026,
  title  = {{RoboRACE: Byzantine-Robust Multi-Agent Robotics with Receiver-Anchored Channel Estimation}},
  author = {{Nabidnur}},
  year   = {{2026}},
  note   = {{https://github.com/Hisernberg/robotics}}
}}
```

<sub>This README is generated by <code>scripts/make_readme.py</code> from <code>results/leaderboard.json</code>.</sub>
"""
    Path("README.md").write_text(text)
    print("README.md written", len(text), "chars")


if __name__ == "__main__":
    main()