[ci] benchmark test (#1696)

* weee test

* add it to gha

* 4gpu test

* add row for 4 x a6000 to benchamrks

* change the baseline a bit

* im not sure if we actually regressed :(

* up tolerance because massed compute suk
This commit is contained in:
Jackmin801
2026-01-31 20:13:51 -08:00
committed by GitHub
parent e5566f9819
commit b798a90d6a
5 changed files with 418 additions and 94 deletions
+4 -1
View File
@@ -65,13 +65,16 @@ jobs:
include:
- test: base
runner: vm
pytest_args: "tests/integration -m gpu --ignore=tests/integration/test_rl_lora.py --ignore=tests/integration/test_rl_multi_run_lora.py"
pytest_args: "tests/integration -m gpu --ignore=tests/integration/test_rl_lora.py --ignore=tests/integration/test_rl_multi_run_lora.py --ignore=tests/integration/test_benchmark_regression.py"
- test: rl_lora
runner: vm
pytest_args: "tests/integration/test_rl_lora.py -m gpu"
- test: rl_multi_run
runner: 4xa6000
pytest_args: "tests/integration/test_rl_multi_run_lora.py -m gpu"
- test: benchmark_regression
runner: 4xa6000
pytest_args: "tests/integration/test_benchmark_regression.py -m gpu"
steps:
- name: Install Git
run: |
@@ -7,40 +7,42 @@
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"output": "benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"ep": 1,
"cp": 1,
"docker_image": null,
"device_name": "NVIDIA RTX A6000",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:16:04.729569+00:00",
"commit_sha": "1c813485",
"timestamp": "2026-02-01T00:37:17.504432+00:00",
"success": true,
"error_reason": null,
"time_taken": 278.55358465001336
"time_taken": 276.12556480802596
},
"metrics": {
"mfu": {
"mean": 17.440641920184348,
"std": 0.024251274789467057,
"min": 17.413318182049757,
"max": 17.459612680819426
"mean": 17.08174826544651,
"std": 0.00860887294908562,
"min": 17.07595532741123,
"max": 17.091640740120457
},
"throughput": {
"mean": 2082.9043561040025,
"std": 2.8962859355307957,
"min": 2079.641131421904,
"max": 2085.1699997738997
"mean": 2040.0423352992304,
"std": 1.0281421434405753,
"min": 2039.3504951752516,
"max": 2041.2237756777045
},
"step_time": {
"mean": 61.44155622298907,
"std": 0.33102868375328043,
"min": 61.21719340299023,
"max": 61.8217413329985
"mean": 63.29752009687945,
"std": 0.1304965028229097,
"min": 63.170207182411104,
"max": 63.430982740130275
},
"peak_memory": {
"gib": 19.501953125,
"pct": 41.141803507714734
"gib": 19.50390625,
"pct": 41.029855115635286
}
}
}
}
@@ -0,0 +1,48 @@
{
"config": {
"type": "rl",
"num_gpus": 4,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"ep": 1,
"cp": 1,
"docker_image": "primeintellect/prime-rl@sha256:d3e9636af265f5ba2e56cd2555534489f5ff64e04a3f645059ca7989508de419",
"device_name": "NVIDIA RTX A6000",
"commit_sha": "5c3c5123",
"timestamp": "2026-01-31T01:13:40.536972+00:00",
"success": true,
"error_reason": null,
"time_taken": 291.91085167229176
},
"metrics": {
"mfu": {
"mean": 16.165875888064594,
"std": 0.010063094728313886,
"min": 16.154265967508614,
"max": 16.172097002189034
},
"throughput": {
"mean": 7722.645407567771,
"std": 4.80726889329249,
"min": 7717.099200218126,
"max": 7725.61731325081
},
"step_time": {
"mean": 66.21160964062437,
"std": 0.11667723461510121,
"min": 66.1170196281746,
"max": 66.34198968904093
},
"peak_memory": {
"gib": 12.35546875,
"pct": 25.99187497111044
}
}
}
+64 -73
View File
@@ -2,7 +2,7 @@
Automated benchmark results for prime-rl using `--bench` flag.
**Last Updated:** 2026-01-16 01:16 UTC
**Last Updated:** 2026-02-01 00:43 UTC
**Commit:** `unknown`
**Docker Image:** `primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6`
@@ -12,87 +12,78 @@ Automated benchmark results for prime-rl using `--bench` flag.
> :clock10: The Step Time shown is the time taken per micro batch. This differs from what gets displayed in the bench table which is the total step time.
## INTELLECT-3
| Type | SeqLen | AC | Attn | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----------|-----|-----|-----------|----------|
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 8xH200 | 19.8% | 16.69k | 7.85s | 89.7 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA3 | 8xH200 | 19.2% | 16.15k | 8.11s | 84.2 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 8xB200 | 2.5% | 4.78k | 27.45s | 90.4 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 8xH200 | 25.1% | 9.76k | 53.73s | 128.8 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA2 | 8xH200 | 16.2% | 6.30k | 83.23s | 130.3 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 8xB200 | 5.8% | 5.16k | 101.60s | 153.6 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA2 | 8xB200 | 5.7% | 5.04k | 104.10s | 131.5 GiB |
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 19.8% | 16.69k | 7.85s | 89.7 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA3 | 1 | 1 | 8xH200 | 19.2% | 16.15k | 8.11s | 84.2 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 2.5% | 4.78k | 27.45s | 90.4 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1 | 1 | 8xH200 | 25.1% | 9.76k | 53.73s | 128.8 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA2 | 1 | 1 | 8xH200 | 16.2% | 6.30k | 83.23s | 130.3 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 5.8% | 5.16k | 101.60s | 153.6 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA2 | 1 | 1 | 8xB200 | 5.7% | 5.04k | 104.10s | 131.5 GiB |
## Qwen3-0.6B
| Type | SeqLen | AC | Attn | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA3 | 1xH100 HBM3 | 11.1% | 11.90k | 1.38s | 12.5 GiB |
| RL Full | 16384 | Recompute | FA2 | 1xA6000 | 10.9% | 3.69k | 4.44s | 12.5 GiB |
| RL Full | 65536 | Recompute | FA3 | 1xH100 HBM3 | 26.8% | 10.15k | 6.46s | 19.6 GiB |
| RL Full | 65536 | Offload | FA3 | 1xH100 HBM3 | 26.4% | 9.98k | 6.57s | 16.1 GiB |
| RL Full | 65536 | Recompute | FA2 | 1xA6000 | 17.4% | 2.08k | 31.46s | 19.5 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1xH100 HBM3 | 10.9% | 13.34k | 1.23s | 5.1 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1xA6000 | 6.3% | 2.41k | 6.79s | 5.1 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1xH100 HBM3 | 25.2% | 9.97k | 6.58s | 11.5 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1xH100 HBM3 | 24.7% | 9.78k | 6.70s | 7.9 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1xA6000 | 16.0% | 1.99k | 32.85s | 11.5 GiB |
| SFT Full | 8192 | Recompute | FA3 | 1xH100 HBM3 | 16.8% | 26.01k | 0.32s | 31.7 GiB |
| SFT Full | 8192 | Recompute | FA2 | 1xA6000 | 13.5% | 6.60k | 1.24s | 31.2 GiB |
| SFT Full | 16384 | Recompute | FA3 | 1xH100 HBM3 | 23.7% | 25.49k | 0.64s | 52.8 GiB |
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 11.1% | 11.90k | 1.38s | 12.5 GiB |
| RL Full | 16384 | Recompute | FA2 | 1 | 1 | 1xA6000 | 10.9% | 3.69k | 4.44s | 12.5 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 26.8% | 10.15k | 6.46s | 19.6 GiB |
| RL Full | 65536 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 26.4% | 9.98k | 6.57s | 16.1 GiB |
| RL Full | 65536 | Recompute | FA2 | 1 | 1 | 4xA6000 | 16.2% | 7.72k | 33.94s | 12.4 GiB |
| RL Full | 65536 | Recompute | FA2 | 1 | 1 | 1xA6000 | 17.1% | 2.04k | 32.12s | 19.5 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 10.9% | 13.34k | 1.23s | 5.1 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 1xA6000 | 6.3% | 2.41k | 6.79s | 5.1 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 25.2% | 9.97k | 6.58s | 11.5 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 24.7% | 9.78k | 6.70s | 7.9 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 1xA6000 | 16.0% | 1.99k | 32.85s | 11.5 GiB |
| SFT Full | 8192 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 16.8% | 26.01k | 0.32s | 31.7 GiB |
| SFT Full | 8192 | Recompute | FA2 | 1 | 1 | 1xA6000 | 13.5% | 6.60k | 1.24s | 31.2 GiB |
| SFT Full | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 23.7% | 25.49k | 0.64s | 52.8 GiB |
## Qwen3-235B-A22B-Instruct-2507
| Type | SeqLen | AC | Attn | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----------|-----|-----|-----------|----------|
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 8xB200 | 4.2% | 4.14k | 31.69s | 161.5 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA2 | 8xB200 | 4.2% | 4.13k | 31.76s | 150.3 GiB |
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 4.2% | 4.14k | 31.69s | 161.5 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA2 | 1 | 1 | 8xB200 | 4.2% | 4.13k | 31.76s | 150.3 GiB |
## Qwen3-30B-A3B-Instruct-2507
| Type | SeqLen | AC | Attn | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA3 | 8xH100 HBM3 | 2.9% | 6.11k | 21.44s | 74.6 GiB |
| RL Full | 16384 | Recompute | FA3 | 8xH200 | 2.8% | 5.94k | 22.06s | 74.6 GiB |
| RL Full | 65536 | Recompute | FA3 | 8xH200 | 15.4% | 12.75k | 41.13s | 105.4 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 8xH200 | 17.0% | 36.77k | 3.56s | 31.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 8xH100 HBM3 | 15.3% | 33.10k | 3.96s | 31.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 8xB200 | 1.9% | 9.27k | 14.14s | 32.0 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 8xH200 | 29.2% | 24.41k | 21.48s | 63.7 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 8xH100 HBM3 | 27.9% | 23.39k | 22.42s | 63.7 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 8xB200 | 6.9% | 13.23k | 39.64s | 64.8 GiB |
| SFT Full | 16384 | Recompute | FA3 | 8xH200 | 16.6% | 35.03k | 3.74s | 106.4 GiB |
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 2.9% | 6.11k | 21.44s | 74.6 GiB |
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 2.8% | 5.94k | 22.06s | 74.6 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 15.4% | 12.75k | 41.13s | 105.4 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 17.0% | 36.77k | 3.56s | 31.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 15.3% | 33.10k | 3.96s | 31.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 1.9% | 9.27k | 14.14s | 32.0 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 29.2% | 24.41k | 21.48s | 63.7 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 27.9% | 23.39k | 22.42s | 63.7 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 6.9% | 13.23k | 39.64s | 64.8 GiB |
| SFT Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 16.6% | 35.03k | 3.74s | 106.4 GiB |
## Qwen3-4B-Instruct-2507
| Type | SeqLen | AC | Attn | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA2 | 8xB200 | 6.5% | 27.54k | 4.76s | 17.0 GiB |
| RL Full | 16384 | Recompute | FA3 | 8xH200 | 14.7% | 27.44k | 4.78s | 17.1 GiB |
| RL Full | 16384 | Recompute | FA3 | 8xH100 HBM3 | 13.9% | 26.03k | 5.04s | 17.1 GiB |
| RL Full | 65536 | Recompute | FA3 | 8xH200 | 36.1% | 29.54k | 17.75s | 36.1 GiB |
| RL Full | 65536 | Recompute | FA3 | 8xH100 HBM3 | 35.4% | 28.97k | 18.10s | 36.1 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 8xH200 | 22.8% | 52.38k | 2.50s | 10.3 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 8xH100 HBM3 | 21.2% | 48.72k | 2.69s | 10.3 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 8xB200 | 8.8% | 46.08k | 2.84s | 10.2 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1xH100 HBM3 | 21.7% | 6.23k | 2.63s | 23.3 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA3 | 1xH100 HBM3 | 20.7% | 5.95k | 2.75s | 20.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1xA6000 | 13.6% | 1.23k | 13.29s | 23.3 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 8xH200 | 37.5% | 33.43k | 15.68s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 8xH100 HBM3 | 36.8% | 32.80k | 15.98s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 8xB200 | 12.3% | 25.04k | 20.94s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1xH100 HBM3 | 37.4% | 4.16k | 15.74s | 42.0 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1xH100 HBM3 | 36.3% | 4.04k | 16.21s | 31.1 GiB |
| SFT Full | 16384 | Recompute | FA2 | 8xB200 | 16.0% | 68.36k | 1.92s | 54.6 GiB |
| SFT Full | 16384 | Recompute | FA2 | 8xH200 | 28.4% | 53.14k | 2.47s | 54.6 GiB |
| SFT Full | 16384 | Recompute | FA2 | 8xH100 HBM3 | 26.6% | 49.72k | 2.64s | 54.6 GiB |
| SFT Full | 65536 | Recompute | FA2 | 8xB200 | 14.2% | 26.39k | 19.86s | 171.5 GiB |
## Failed Benchmarks
- **Qwen/Qwen3-30B-A3B-Instruct-2507** (RL Full) on 8xB200: Non-zero exit code: 1
- **Qwen/Qwen3-0.6B** (SFT Full) on 1xH100 HBM3: [rank0]: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 37.09 GiB. GPU 0 has a total capacity of 79.18 GiB of which 34.48 GiB is free. Including non-PyTorch memory, this process has 44.
- **Qwen/Qwen3-235B-A22B-Instruct-2507** (RL LoRA(r=16)) on 8xB200: Non-zero exit code: 1
- **Qwen/Qwen3-235B-A22B-Instruct-2507** (RL LoRA(r=16)) on 8xB200: [rank4]: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 8.00 GiB. GPU 4 has a total capacity of 178.36 GiB of which 7.20 GiB is free. Including non-PyTorch memory, this process has 171.
- **Qwen/Qwen3-30B-A3B-Instruct-2507** (SFT Full) on 8xB200: Non-zero exit code: 1
- **Qwen/Qwen3-4B-Instruct-2507** (RL Full) on 8xB200: Non-zero exit code: 1
- **Qwen/Qwen3-30B-A3B-Instruct-2507** (RL Full) on 8xB200: Non-zero exit code: 1
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 6.5% | 27.54k | 4.76s | 17.0 GiB |
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 14.7% | 27.44k | 4.78s | 17.1 GiB |
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 13.9% | 26.03k | 5.04s | 17.1 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 36.1% | 29.54k | 17.75s | 36.1 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 35.4% | 28.97k | 18.10s | 36.1 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 22.8% | 52.38k | 2.50s | 10.3 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 21.2% | 48.72k | 2.69s | 10.3 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 8.8% | 46.08k | 2.84s | 10.2 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 21.7% | 6.23k | 2.63s | 23.3 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 20.7% | 5.95k | 2.75s | 20.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 1xA6000 | 13.6% | 1.23k | 13.29s | 23.3 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 37.5% | 33.43k | 15.68s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 36.8% | 32.80k | 15.98s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 12.3% | 25.04k | 20.94s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 37.4% | 4.16k | 15.74s | 42.0 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 36.3% | 4.04k | 16.21s | 31.1 GiB |
| SFT Full | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 16.0% | 68.36k | 1.92s | 54.6 GiB |
| SFT Full | 16384 | Recompute | FA2 | 1 | 1 | 8xH200 | 28.4% | 53.14k | 2.47s | 54.6 GiB |
| SFT Full | 16384 | Recompute | FA2 | 1 | 1 | 8xH100 HBM3 | 26.6% | 49.72k | 2.64s | 54.6 GiB |
| SFT Full | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 14.2% | 26.39k | 19.86s | 171.5 GiB |
@@ -0,0 +1,280 @@
"""
Integration test for benchmark regression.
This test runs the benchmark and compares results against a baseline to ensure:
- Peak memory usage is exactly the same
- Other metrics (mfu, throughput, step_time) are within 5% margin
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Callable
import pytest
from tests.conftest import ProcessResult
pytestmark = [pytest.mark.gpu, pytest.mark.slow]
TIMEOUT = 15 * 60 # 15 minutes
# Note: I would prefer 5% but massed compute A600s seem to be slower than hyperstack A600s (which is the baseline)
METRIC_TOLERANCE = 0.1 # 10% tolerance for mfu, throughput, step_time
MEMORY_TOLERANCE = 0.01 # 1% tolerance for peak memory
# Baseline files for the Qwen3-0.6B RL benchmark
BASELINE_FILE_1GPU = Path(
"benchmarks/baselines/benchmark-1xa6000-Qwen--Qwen3-0.6B-rl-full-1gpu-Recompute-flash_attention_2-65536-cp1-ep1.json"
)
BASELINE_FILE_4GPU = Path(
"benchmarks/baselines/benchmark-4xa6000-Qwen--Qwen3-0.6B-rl-full-4gpu-Recompute-flash_attention_2-65536-cp1-ep1.json"
)
@pytest.fixture(scope="module")
def baseline_metrics_1gpu() -> dict:
"""Load baseline metrics for 1-GPU benchmark."""
with open(BASELINE_FILE_1GPU) as f:
baseline = json.load(f)
return baseline["metrics"]
@pytest.fixture(scope="module")
def baseline_metrics_4gpu() -> dict:
"""Load baseline metrics for 4-GPU benchmark."""
with open(BASELINE_FILE_4GPU) as f:
baseline = json.load(f)
return baseline["metrics"]
@pytest.fixture(scope="module")
def benchmark_output_file_1gpu(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Output file path for 1-GPU benchmark results."""
tmp_dir = tmp_path_factory.mktemp("benchmark_1gpu")
return tmp_dir / "benchmark_result.json"
@pytest.fixture(scope="module")
def benchmark_output_file_4gpu(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Output file path for 4-GPU benchmark results."""
tmp_dir = tmp_path_factory.mktemp("benchmark_4gpu")
return tmp_dir / "benchmark_result.json"
@pytest.fixture(scope="module")
def benchmark_process_1gpu(
run_process: Callable[..., ProcessResult],
benchmark_output_file_1gpu: Path,
) -> ProcessResult:
"""Run the 1-GPU benchmark and return the process result."""
cmd = [
"uv",
"run",
"python",
"benchmarks/scripts/run_single_benchmark.py",
"--type",
"rl",
"--num-gpus",
"1",
"--model-name",
"Qwen/Qwen3-0.6B",
"--seq-len",
"65536",
"--ac",
"Recompute",
"--attention",
"flash_attention_2",
"--output",
str(benchmark_output_file_1gpu),
"--timeout",
str(TIMEOUT - 5 * 60), # Leave 5 min buffer
]
return run_process(cmd, timeout=TIMEOUT, env={"PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True"})
@pytest.fixture(scope="module")
def benchmark_process_4gpu(
run_process: Callable[..., ProcessResult],
benchmark_output_file_4gpu: Path,
) -> ProcessResult:
"""Run the 4-GPU benchmark and return the process result."""
cmd = [
"uv",
"run",
"python",
"benchmarks/scripts/run_single_benchmark.py",
"--type",
"rl",
"--num-gpus",
"4",
"--model-name",
"Qwen/Qwen3-0.6B",
"--seq-len",
"65536",
"--ac",
"Recompute",
"--attention",
"flash_attention_2",
"--output",
str(benchmark_output_file_4gpu),
"--timeout",
str(TIMEOUT - 5 * 60), # Leave 5 min buffer
]
return run_process(cmd, timeout=TIMEOUT, env={"PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True"})
@pytest.fixture(scope="module")
def benchmark_metrics_1gpu(benchmark_process_1gpu: ProcessResult, benchmark_output_file_1gpu: Path) -> dict:
"""Load the 1-GPU benchmark metrics from the output file."""
assert benchmark_process_1gpu.returncode == 0, (
f"Benchmark process failed with return code {benchmark_process_1gpu.returncode}"
)
assert benchmark_output_file_1gpu.exists(), f"Benchmark output file not found at {benchmark_output_file_1gpu}"
with open(benchmark_output_file_1gpu) as f:
result = json.load(f)
assert result.get("config", {}).get("success", False), (
f"Benchmark did not succeed: {result.get('config', {}).get('error_reason', 'unknown error')}"
)
print("=== Benchmark metrics (1-GPU) ===")
print(result["metrics"])
return result["metrics"]
@pytest.fixture(scope="module")
def benchmark_metrics_4gpu(benchmark_process_4gpu: ProcessResult, benchmark_output_file_4gpu: Path) -> dict:
"""Load the 4-GPU benchmark metrics from the output file."""
assert benchmark_process_4gpu.returncode == 0, (
f"Benchmark process failed with return code {benchmark_process_4gpu.returncode}"
)
assert benchmark_output_file_4gpu.exists(), f"Benchmark output file not found at {benchmark_output_file_4gpu}"
with open(benchmark_output_file_4gpu) as f:
result = json.load(f)
assert result.get("config", {}).get("success", False), (
f"Benchmark did not succeed: {result.get('config', {}).get('error_reason', 'unknown error')}"
)
print("=== Benchmark metrics (4-GPU) ===")
print(result["metrics"])
return result["metrics"]
# =============================================================================
# 1-GPU Benchmark Tests
# =============================================================================
def test_peak_memory_within_tolerance_1gpu(benchmark_metrics_1gpu: dict, baseline_metrics_1gpu: dict):
"""Test that peak memory usage is within 1% of the baseline (1-GPU)."""
actual_memory = benchmark_metrics_1gpu["peak_memory"]["gib"]
expected_memory = baseline_metrics_1gpu["peak_memory"]["gib"]
lower_bound = expected_memory * (1 - MEMORY_TOLERANCE)
upper_bound = expected_memory * (1 + MEMORY_TOLERANCE)
assert lower_bound <= actual_memory <= upper_bound, (
f"Peak memory out of tolerance! Expected {expected_memory:.4f} GiB ± 1%, got {actual_memory:.4f} GiB. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}] GiB"
)
def test_mfu_within_tolerance_1gpu(benchmark_metrics_1gpu: dict, baseline_metrics_1gpu: dict):
"""Test that MFU (Model FLOPS Utilization) is within 5% of baseline (1-GPU)."""
actual_mfu = benchmark_metrics_1gpu["mfu"]["mean"]
expected_mfu = baseline_metrics_1gpu["mfu"]["mean"]
lower_bound = expected_mfu * (1 - METRIC_TOLERANCE)
upper_bound = expected_mfu * (1 + METRIC_TOLERANCE)
assert lower_bound <= actual_mfu <= upper_bound, (
f"MFU out of tolerance! Expected {expected_mfu:.4f} ± 5%, got {actual_mfu:.4f}. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}]"
)
def test_throughput_within_tolerance_1gpu(benchmark_metrics_1gpu: dict, baseline_metrics_1gpu: dict):
"""Test that throughput is within 5% of baseline (1-GPU)."""
actual_throughput = benchmark_metrics_1gpu["throughput"]["mean"]
expected_throughput = baseline_metrics_1gpu["throughput"]["mean"]
lower_bound = expected_throughput * (1 - METRIC_TOLERANCE)
upper_bound = expected_throughput * (1 + METRIC_TOLERANCE)
assert lower_bound <= actual_throughput <= upper_bound, (
f"Throughput out of tolerance! Expected {expected_throughput:.4f} ± 5%, got {actual_throughput:.4f}. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}]"
)
def test_step_time_within_tolerance_1gpu(benchmark_metrics_1gpu: dict, baseline_metrics_1gpu: dict):
"""Test that step time is within 5% of baseline (1-GPU)."""
actual_step_time = benchmark_metrics_1gpu["step_time"]["mean"]
expected_step_time = baseline_metrics_1gpu["step_time"]["mean"]
lower_bound = expected_step_time * (1 - METRIC_TOLERANCE)
upper_bound = expected_step_time * (1 + METRIC_TOLERANCE)
assert lower_bound <= actual_step_time <= upper_bound, (
f"Step time out of tolerance! Expected {expected_step_time:.4f} ± 5%, got {actual_step_time:.4f}. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}]"
)
# =============================================================================
# 4-GPU Benchmark Tests
# =============================================================================
def test_peak_memory_within_tolerance_4gpu(benchmark_metrics_4gpu: dict, baseline_metrics_4gpu: dict):
"""Test that peak memory usage is within 1% of the baseline (4-GPU)."""
actual_memory = benchmark_metrics_4gpu["peak_memory"]["gib"]
expected_memory = baseline_metrics_4gpu["peak_memory"]["gib"]
lower_bound = expected_memory * (1 - MEMORY_TOLERANCE)
upper_bound = expected_memory * (1 + MEMORY_TOLERANCE)
assert lower_bound <= actual_memory <= upper_bound, (
f"Peak memory out of tolerance! Expected {expected_memory:.4f} GiB ± 1%, got {actual_memory:.4f} GiB. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}] GiB"
)
def test_mfu_within_tolerance_4gpu(benchmark_metrics_4gpu: dict, baseline_metrics_4gpu: dict):
"""Test that MFU (Model FLOPS Utilization) is within 5% of baseline (4-GPU)."""
actual_mfu = benchmark_metrics_4gpu["mfu"]["mean"]
expected_mfu = baseline_metrics_4gpu["mfu"]["mean"]
lower_bound = expected_mfu * (1 - METRIC_TOLERANCE)
upper_bound = expected_mfu * (1 + METRIC_TOLERANCE)
assert lower_bound <= actual_mfu <= upper_bound, (
f"MFU out of tolerance! Expected {expected_mfu:.4f} ± 5%, got {actual_mfu:.4f}. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}]"
)
def test_throughput_within_tolerance_4gpu(benchmark_metrics_4gpu: dict, baseline_metrics_4gpu: dict):
"""Test that throughput is within 5% of baseline (4-GPU)."""
actual_throughput = benchmark_metrics_4gpu["throughput"]["mean"]
expected_throughput = baseline_metrics_4gpu["throughput"]["mean"]
lower_bound = expected_throughput * (1 - METRIC_TOLERANCE)
upper_bound = expected_throughput * (1 + METRIC_TOLERANCE)
assert lower_bound <= actual_throughput <= upper_bound, (
f"Throughput out of tolerance! Expected {expected_throughput:.4f} ± 5%, got {actual_throughput:.4f}. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}]"
)
def test_step_time_within_tolerance_4gpu(benchmark_metrics_4gpu: dict, baseline_metrics_4gpu: dict):
"""Test that step time is within 5% of baseline (4-GPU)."""
actual_step_time = benchmark_metrics_4gpu["step_time"]["mean"]
expected_step_time = baseline_metrics_4gpu["step_time"]["mean"]
lower_bound = expected_step_time * (1 - METRIC_TOLERANCE)
upper_bound = expected_step_time * (1 + METRIC_TOLERANCE)
assert lower_bound <= actual_step_time <= upper_bound, (
f"Step time out of tolerance! Expected {expected_step_time:.4f} ± 5%, got {actual_step_time:.4f}. "
f"Acceptable range: [{lower_bound:.4f}, {upper_bound:.4f}]"
)