File size: 3,948 Bytes
f618540
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
tags:
  - synthetic
  - rl
  - multi-agent
  - cuda
  - triton
  - inference
  - kernel-optimization
---

# kernelswarm — multi-agent kernel-optimization episodes (RL)

Synthetic dataset of **multi-agent long-horizon optimization campaigns** on
AI-inference kernels. Each row is one whole episode: a lead orchestrator plus
2–20 specialist agents split the work, exchange dispatches/statuses/handoffs,
submit full kernel candidates, and receive simulated compile/verify/bench
feedback — with a reward attached to every environment result.

**Inference-focused only.** All ops are inference primitives (decode/prefill
attention, quantized GEMM/GEMV, sampling, norms, KV-cache, MoE, Mamba).

> ⚠️ All benchmarks, compiles and correctness checks are **simulated
> analytically** — no kernel was ever compiled or executed on a real GPU.

## Row format (one row = one episode)

```json
{
  "episode_id": "flash_decode_h100_B=8,..._dispatch_74",
  "scenario": "dispatch",            // dispatch | parallel_sweep | pipeline | campaign
  "n_agents": 6,
  "op": "flash_decode", "impl": "cuda",
  "gpu": "h100", "arch": "sm_90a", "dtype": "fp16",
  "shape": {...}, "baseline_ms": 0.42, "best_ms": 0.006,
  "speedup": 66.4, "elapsed_s": 17335,
  "agents": [{"id": "a01", "role": "worker", "skill": 0.9,
              "tries": 8, "kept": 5, "best_ms": 0.008}, ...],
  "num_messages": 74,
  "messages": [ ... ]
}
```

## Message kinds

| kind        | role            | meaning                                        |
|-------------|-----------------|------------------------------------------------|
| `plan`      | lead            | campaign split strategy                        |
| `dispatch`  | lead            | subtask assignment (`to`, `subtask`)           |
| `candidate` | agent           | **full kernel source** + `params`              |
| `result`    | env             | compile/verify/bench outcome + `reward`        |
| `status`    | agent           | terse progress report                          |
| `review`    | reviewer        | pass/fail verdict                              |
| `verify`    | verifier        | correctness check report                       |
| `leaderboard` | env           | ranked agent best-times                        |
| `merge`     | lead            | pick winner, update shared best                |
| `redirect`  | lead            | re-assign agent to winner's variant/region     |
| `handoff`   | agent           | pass artifact to another agent                 |
| `verdict`   | lead            | final outcome + terminal reward                |

## Rewards

- `result` msgs: `min(1, log2(prev_best / new))` on kept improvement;
  `-0.05` no-improvement, `-0.1` compile error, `-0.3` wrong result,
  `-0.05` unsupported arch.
- `verdict` msg: `log2(speedup) / 4` terminal bonus.

## Scenarios

- **dispatch** — lead splits variants across workers, merges, redirects losers (2–8 agents)
- **parallel_sweep** — N workers each own a cfg slice of one variant; leaderboard + top-2 refine (4–20)
- **pipeline** — proposer → reviewer → verifier → tuner chain over variants (3–6)
- **campaign** — fleet dispatch over variant×cfg space + verifier rebench (5–20)

## Coverage

- 17 ops (14 CUDA + 3 Triton impls): flash_decode, swa_decode, gemm_fp16,
  int8_gemm, fp8_gemm, int4_gemv, rmsnorm, rope, swiglu_act, topk_sample,
  nucleus_sample, mamba_scan, moe_scatter, kv_append, fused_qkv_rope,
  triton_flash_decode, triton_rmsnorm
- GPUs: h100, h200, a100, a10, rtx_a6000, rtx_5090 (arch features gated:
  wgmma/tma/fp8/fp4/cp.async)
- 2400 episodes · ~170k messages · avg 71 msgs/episode · avg 8.6 agents
- Simulated horizon: 1–5 h per episode

## Files

- `batches/batch_*.jsonl` — 24 shards × 100 episodes
- `episodes.jsonl` — all episodes concatenated
- `tasks_holdout.jsonl` — (op, gpu, shape) task specs for eval
- `stats.json` — aggregate stats