Restore package README; record v2 verdict and structural downgrade
Browse files- README.md +24 -25
- benchmarks/RESULTS.md +20 -9
README.md
CHANGED
|
@@ -1,33 +1,32 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
`lerobot/` source tree so optimization experiments do not mix with upstream
|
| 6 |
-
code changes.
|
| 7 |
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
| 11 |
-
- Thor server is parked for now; it is not the training test target.
|
| 12 |
-
- Hugging Face Jobs are a final validation path only, and only A100 is planned.
|
| 13 |
-
- HF Jobs budget target: keep early validation under a few dozen dollars.
|
| 14 |
-
- Prefer China-friendly mirrors and ModelScope for downloads.
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
- `scripts/`: helper scripts for remote setup, probing, and later test runs.
|
| 20 |
-
- `results/`: JSON/CSV/text outputs from tests.
|
| 21 |
-
- `profiles/`: torch profiler traces and summaries.
|
| 22 |
-
- `env/`: requirements and environment lock notes.
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
- `docs/proof_results_initial.md`: first synthetic proof-test results.
|
|
|
|
| 1 |
+
# flashrt-flex-attention-train
|
| 2 |
|
| 3 |
+
FlexAttention replacement training package for PI-style dual-expert
|
| 4 |
+
transformers.
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
Hub repo: `flashrt/flashrt-flex-attention-train`
|
| 7 |
|
| 8 |
+
## Public API
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
- `flex_attention`
|
| 11 |
+
- `flex_attention_forward`
|
| 12 |
+
- `reference_flex_attention`
|
| 13 |
+
- `build_block_sparse_bool_masks`
|
| 14 |
+
- `backend_marker`
|
| 15 |
|
| 16 |
+
## Scope
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
This package locks the public Tensor API and correctness harness for a native
|
| 19 |
+
replacement of the PI052 FlexAttention/SDPA attention path:
|
| 20 |
|
| 21 |
+
- prefix self-attention rows
|
| 22 |
+
- action-to-prefix rows plus block-diagonal action rows
|
| 23 |
+
- `head_dim=256`
|
| 24 |
+
- BF16 forward/backward through PyTorch autograd fallback
|
| 25 |
+
- detached-prefix semantics for action rows reading prefix K/V
|
| 26 |
+
- prefix mask, prefix padding mask, action block mask, and action padding mask
|
| 27 |
+
- automatic SDPA fallback for unsupported shapes
|
| 28 |
|
| 29 |
+
The current implementation is the SDPA-backed training reference. It is meant
|
| 30 |
+
to be the stable integration target for native CUDA fwd/bwd kernels; no native
|
| 31 |
+
performance claim is made until the benchmark gates in `VALIDATION.md` pass on
|
| 32 |
+
both A100 and RTX 5090.
|
|
|
benchmarks/RESULTS.md
CHANGED
|
@@ -64,16 +64,27 @@ CUDA with no dropout, SDPA elsewhere.
|
|
| 64 |
(128x128 for P>=896-class shapes).
|
| 65 |
- A100/H100/H200: SDPA path (see the verdict table).
|
| 66 |
|
| 67 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
(~20% wasted FLOPs at p700) and the action part's cross-chunk block
|
| 72 |
-
is near-empty. Splitting Q into (group-0, group-1, action) rows cuts
|
| 73 |
-
both.
|
| 74 |
-
2. Custom autograd saving bf16 probabilities only (halves saved-activation
|
| 75 |
-
bytes and backward traffic).
|
| 76 |
-
3. Native CUDA fused kernel: manual sits at ~20% of bf16 peak on the
|
| 77 |
5090 (harness-inclusive); an FA2-style specialized kernel
|
| 78 |
(D=256, GQA, prefix-dense + action-block) targeting 40-50% would be
|
| 79 |
another ~2x. Entry per house rules: only after 1-2 are in and the
|
|
|
|
| 64 |
(128x128 for P>=896-class shapes).
|
| 65 |
- A100/H100/H200: SDPA path (see the verdict table).
|
| 66 |
|
| 67 |
+
## Measured and closed follow-up levers (2026-07-09)
|
| 68 |
+
|
| 69 |
+
1. **bf16-saved-p custom autograd (`manual_attention_part_v2`): REJECTED
|
| 70 |
+
end-to-end.** Against the EAGER composed part it wins 1.32-1.48x
|
| 71 |
+
fwd+bwd (fused softmax-gradient chain) — but the production form is
|
| 72 |
+
the composed part under `torch.compile`, where AOTAutograd's
|
| 73 |
+
partitioner already generates a fused backward and manages what gets
|
| 74 |
+
saved; the hand-written Function blocks that whole-graph treatment
|
| 75 |
+
and measured slower on the real model (text step 341.6 vs 333.3 ms
|
| 76 |
+
on a 5090). The symbol stays exported for API stability and as the
|
| 77 |
+
documented negative. Lesson (third time this project): compare
|
| 78 |
+
against the PRODUCTION form of the baseline, not its eager form.
|
| 79 |
+
2. **Structural 3-GEMM split: DOWNGRADED.** The synthetic harness's
|
| 80 |
+
half/half att pattern overstates it — on the real model, flow-step
|
| 81 |
+
prefixes are fully bidirectional (no maskable quadrant) and text-step
|
| 82 |
+
causal spans vary per sample (no uniform split). The remaining
|
| 83 |
+
uniform win is the action cross-chunk block (~7% of attention
|
| 84 |
+
FLOPs); not scheduled.
|
| 85 |
|
| 86 |
+
## Next levers (not yet implemented)
|
| 87 |
+
1. Native CUDA fused kernel: manual sits at ~20% of bf16 peak on the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
5090 (harness-inclusive); an FA2-style specialized kernel
|
| 89 |
(D=256, GQA, prefix-dense + action-block) targeting 40-50% would be
|
| 90 |
another ~2x. Entry per house rules: only after 1-2 are in and the
|