Add README.md
Browse files
README.md
CHANGED
|
@@ -15,92 +15,115 @@ datasets:
|
|
| 15 |
- armanakbari4/ur3-3task-lerobot
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# ImageWAM UR3 3-task β
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
`torch._scaled_mm_v2`
|
|
|
|
| 23 |
|
| 24 |
-
| | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|---|---|
|
| 26 |
-
|
|
| 27 |
-
|
|
| 28 |
-
|
|
| 29 |
-
|
|
| 30 |
-
|
|
| 31 |
-
|
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
**153 of the model's 156 MoT Linears**, holding **4.498 B weights β 99.6% of `mot`'s parameters.**
|
| 37 |
-
Three
|
| 38 |
|
| 39 |
| layer | shape | why |
|
| 40 |
|---|---|---|
|
| 41 |
-
| `mixtures.action.action_encoder` | (1024, 16) | K = 16, and cuBLASLt's FP4 path needs **K % 32 == 0**. Measured on a B300: K = 32, 64, 96, 128, 256 pass;
|
| 42 |
| `mixtures.video.transformer.final_layer.linear` | (128, 3072) | the video output head predicts the next **frame**; it never runs during action inference, so it has no calibration |
|
| 43 |
| `β¦final_layer.adaLN_modulation.1` | (6144, 3072) | same |
|
| 44 |
|
| 45 |
-
## Calibration
|
| 46 |
-
|
| 47 |
-
**The same 30 episodes as the FastWAM UR3 arms**, so the two models' quantised rows are
|
| 48 |
-
comparable: 10 episodes per task x 3 tasks, seed 42, **all frames β 9,908 observations**. The
|
| 49 |
-
episode selection is imported from the FastWAM calibration rather than re-derived.
|
| 50 |
-
|
| 51 |
-
Two things come out of those forward passes. Per-input-channel **activation absmax** feeds
|
| 52 |
-
SmoothQuant's migration factor. A **768-row-per-layer reservoir** of real layer inputs feeds the
|
| 53 |
-
smoothing search, whose objective is SVDQuant's own `OutputsError`: each layer's output MSE against
|
| 54 |
-
bf16, with the NVFP4 quantiser and the refitted low-rank branch inside the scored loop. Split-half
|
| 55 |
-
agreement (search on the even rows, score the odd) is 50%.
|
| 56 |
-
|
| 57 |
-
Chosen families: 129 layers `(alpha, 0)`, 23 `(alpha, 1-alpha)`, 2 no smoothing. Searching the
|
| 58 |
-
smoothing is worth 1.050x over a fixed alpha = 0.5; the rank-32 branch is worth 1.081x over no
|
| 59 |
-
branch β small, and reported because it is what was measured.
|
| 60 |
-
|
| 61 |
## Verification
|
| 62 |
|
| 63 |
On **held-out episodes the calibration never saw** (9 episodes disjoint from the calibration
|
| 64 |
-
selection, 36 observations, horizon 16, 10 denoising steps)
|
| 65 |
-
|
| 66 |
-
| | NRMSE |
|
| 67 |
-
|---|---|
|
| 68 |
-
| NVFP4 vs bf16 | **0.00167** (worst frame 0.00335, correlation 0.999983) |
|
| 69 |
-
| bf16 vs recorded teleoperation | 0.00293 β the ceiling |
|
| 70 |
-
| NVFP4 vs recorded teleoperation | 0.00362 |
|
| 71 |
-
|
| 72 |
-
And that the arithmetic is real rather than simulated:
|
| 73 |
|
| 74 |
* every `wq` is `torch.float4_e2m1fn_x2`; 2144.9 MiB of packed weight for 4.498 B weights is
|
| 75 |
**4.00 bits/weight exactly**; **zero** dequantised weight copies anywhere in the module.
|
| 76 |
-
* **747** `torch._scaled_mm_v2` calls per inference, every one
|
| 77 |
-
|
| 78 |
|
| 79 |
-
**No closed-loop success rate has been measured with
|
| 80 |
necessary and not sufficient.
|
| 81 |
|
| 82 |
-
## Running
|
| 83 |
|
| 84 |
-
Needs a Blackwell GPU and a torch with `torch._scaled_mm_v2` (built and verified on
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
denormalisation, and the pre-encoded prompts.
|
| 89 |
|
| 90 |
```python
|
| 91 |
from iw_nvfp4_runtime import load_quantized_model
|
| 92 |
-
model, proc = load_quantized_model("
|
| 93 |
```
|
| 94 |
|
| 95 |
-
`install_nvfp4`
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
emits a plausible action chunk.
|
|
|
|
| 99 |
|
| 100 |
`iw_nvfp4_runtime.py` here is a standalone copy, verified **bit-identical** to the in-repo runtime
|
| 101 |
-
on real exported layers. The repo version can additionally drive a fused Triton
|
| 102 |
-
substantially faster; this copy takes the torch path, which is the reference the
|
| 103 |
-
against.
|
| 104 |
|
| 105 |
## Three things about this model that will bite you
|
| 106 |
|
|
@@ -114,6 +137,11 @@ against.
|
|
| 114 |
3. **Actions come back 16-D.** Un-pad to 14-D β `concat(x[..., 0:7], x[..., 8:15])` β before
|
| 115 |
sending anything to a controller.
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
## Tasks
|
| 118 |
|
| 119 |
* `blue_basket` β put the medicine then the measuring tape inside the blue basket
|
|
|
|
| 15 |
- armanakbari4/ur3-3task-lerobot
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# ImageWAM UR3 3-task β W4A4 in NVFP4, two arms
|
| 19 |
|
| 20 |
+
The ImageWAM-FLUX.2-4B UR3 three-task fine-tune (step 7000) quantised to **NVFP4** for Blackwell,
|
| 21 |
+
by two methods calibrated identically so they can be compared. Real 4-bit execution on the FP4
|
| 22 |
+
tensor cores through `torch._scaled_mm_v2`: nothing is stored dequantised and no fp16 GEMM runs on
|
| 23 |
+
the bulk path.
|
| 24 |
|
| 25 |
+
| | `ur3_step7000_asp_nvfp4.pt` | `ur3_step7000_svdquant_nvfp4.pt` |
|
| 26 |
+
|---|---|---|
|
| 27 |
+
| method | **AFQ / ASP**, deflated form | SVDQuant (Li et al., ICLR 2025) |
|
| 28 |
+
| rotation | block Hadamard | none |
|
| 29 |
+
| low-rank branch | rank 32 on the **action expert**, from the action metric | rank 32 on **every** layer, from the quantisation residual |
|
| 30 |
+
| BPW | **4.5789** | 4.7523 |
|
| 31 |
+
| resident weights | **2.668 GiB** (3.22x less than bf16) | 2.857 GiB (3.00x) |
|
| 32 |
+
| NVFP4 vs bf16 | **0.00108** | 0.00167 |
|
| 33 |
+
| worst frame | **0.00248** | 0.00335 |
|
| 34 |
+
| correlation with bf16 | **0.999992** | 0.999983 |
|
| 35 |
+
| vs recorded teleoperation | **0.00300** | 0.00362 |
|
| 36 |
+
|
| 37 |
+
bf16's own distance to the demonstrator is **0.00293**, so ASP lands within 0.00007 of the
|
| 38 |
+
unquantised model while spending 0.17 fewer bits per weight than the baseline.
|
| 39 |
+
|
| 40 |
+
## The action metric, and where it points
|
| 41 |
+
|
| 42 |
+
ASP protects the directions the emitted action actually depends on:
|
| 43 |
+
`G_l = E[J_l^T J_l]`, `J_l = d(action chunk)/d(x_l)` differentiated through all ten denoising
|
| 44 |
+
steps, estimated with random probes over **901 frames x 12 probes** of the calibration set. The
|
| 45 |
+
protected subspace is the top-32 eigenspace of `G~ = H diag(s) G diag(s) H` β the metric in the
|
| 46 |
+
coordinates actually being quantised β and it is searched jointly with the smoothing, because
|
| 47 |
+
changing `s` moves the subspace.
|
| 48 |
+
|
| 49 |
+
**98.4% of the action mass sits in six layers**, and none of them is a transformer block:
|
| 50 |
+
|
| 51 |
+
| layer | share of tr(G) |
|
| 52 |
|---|---|
|
| 53 |
+
| `single_stream_modulation.lin` | 36.1% |
|
| 54 |
+
| `action_encoder` | 31.6% |
|
| 55 |
+
| `double_stream_modulation_img.lin` | 21.1% |
|
| 56 |
+
| `time_in.out_layer` | 6.3% |
|
| 57 |
+
| `head.linear` | 2.1% |
|
| 58 |
+
| `head.adaLN_modulation.1` | 1.2% |
|
| 59 |
+
|
| 60 |
+
The 60 Linears inside the action expert's blocks hold **1.6%** between them. That is a different
|
| 61 |
+
picture from the FastWAM UR3 model, whose mass spreads across `cross_attn.o` in every block, and it
|
| 62 |
+
is the point of measuring rather than assuming.
|
| 63 |
+
|
| 64 |
+
`mixtures.action.time_in.in_layer` gets **rank 0**, not rank 32: it consumes the timestep, not the
|
| 65 |
+
action latents, so its Jacobian to the action is genuinely empty and a "protected subspace" there
|
| 66 |
+
would be 32 directions chosen by LAPACK out of a zero matrix. 65 layers carry a subspace, 88 do not.
|
| 67 |
+
|
| 68 |
+
## Calibration
|
| 69 |
+
|
| 70 |
+
**The same 30 episodes as the FastWAM UR3 arms** β 10 per task x 3 tasks, seed 42, all frames,
|
| 71 |
+
**9,908 observations** β so the two models' quantised rows are comparable. Activation absmax feeds
|
| 72 |
+
SmoothQuant; a 768-row-per-layer reservoir of real layer inputs feeds the smoothing search, whose
|
| 73 |
+
objective is the layer's own output MSE against bf16 with the NVFP4 quantiser inside the scored
|
| 74 |
+
loop. Candidates are deepcompressor's 39 `(alpha, beta)` pairs.
|
| 75 |
|
| 76 |
+
Split-half agreement (search on the even rows, score the odd): **75.8%** for ASP, 50.0% for
|
| 77 |
+
SVDQuant. What each low-rank branch buys, as median layer output error against no branch at all:
|
| 78 |
+
**1.913x** for ASP's action subspace, **1.081x** for SVDQuant's residual SVD.
|
| 79 |
+
|
| 80 |
+
## What is quantised
|
| 81 |
|
| 82 |
**153 of the model's 156 MoT Linears**, holding **4.498 B weights β 99.6% of `mot`'s parameters.**
|
| 83 |
+
Three stay bf16 and both checkpoints record them:
|
| 84 |
|
| 85 |
| layer | shape | why |
|
| 86 |
|---|---|---|
|
| 87 |
+
| `mixtures.action.action_encoder` | (1024, 16) | K = 16, and cuBLASLt's FP4 path needs **K % 32 == 0**. Measured on a B300: K = 32, 64, 96, 128, 256 pass; 16 and 48 return `CUBLAS_STATUS_NOT_SUPPORTED`. |
|
| 88 |
| `mixtures.video.transformer.final_layer.linear` | (128, 3072) | the video output head predicts the next **frame**; it never runs during action inference, so it has no calibration |
|
| 89 |
| `β¦final_layer.adaLN_modulation.1` | (6144, 3072) | same |
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
## Verification
|
| 92 |
|
| 93 |
On **held-out episodes the calibration never saw** (9 episodes disjoint from the calibration
|
| 94 |
+
selection, 36 observations, horizon 16, 10 denoising steps) β the table at the top. And that the
|
| 95 |
+
arithmetic is real rather than simulated, for both arms:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
* every `wq` is `torch.float4_e2m1fn_x2`; 2144.9 MiB of packed weight for 4.498 B weights is
|
| 98 |
**4.00 bits/weight exactly**; **zero** dequantised weight copies anywhere in the module.
|
| 99 |
+
* **747** `torch._scaled_mm_v2` calls per inference, every one `BlockWise1x16`. 747 is not a round
|
| 100 |
+
number: it is 87 video Linears once plus 66 action Linears across 10 denoising steps.
|
| 101 |
|
| 102 |
+
**No closed-loop success rate has been measured with either checkpoint.** Open-loop agreement is
|
| 103 |
necessary and not sufficient.
|
| 104 |
|
| 105 |
+
## Running them
|
| 106 |
|
| 107 |
+
Needs a Blackwell GPU and a torch with `torch._scaled_mm_v2` (built and verified on 2.12.0+cu130).
|
| 108 |
+
Both files are self-contained β quantised Linears, every unquantised `mot` tensor, the proprio
|
| 109 |
+
encoder β so the 9.0 GiB bf16 checkpoint is not needed at inference. You still need the FLUX.2
|
| 110 |
+
klein-base-4B backbone and autoencoder, the dataset stats, and the pre-encoded prompts here.
|
|
|
|
| 111 |
|
| 112 |
```python
|
| 113 |
from iw_nvfp4_runtime import load_quantized_model
|
| 114 |
+
model, proc = load_quantized_model("ur3_step7000_asp_nvfp4.pt", build_model=my_builder)
|
| 115 |
```
|
| 116 |
|
| 117 |
+
`install_nvfp4` dispatches on the checkpoint's `lowrank_mode` and cross-checks
|
| 118 |
+
`requires_runtime_fwht` against what the layers actually carry. SVDQuant applies no rotation and
|
| 119 |
+
ASP applies one; driving either checkpoint through the other's branch produces a well-formed GEMM
|
| 120 |
+
of the wrong bilinear form β it loads, it runs, and it emits a plausible action chunk. It also
|
| 121 |
+
raises unless every name in the checkpoint resolves to an `nn.Linear`.
|
| 122 |
|
| 123 |
`iw_nvfp4_runtime.py` here is a standalone copy, verified **bit-identical** to the in-repo runtime
|
| 124 |
+
on real exported layers of **both** modes. The repo version can additionally drive a fused Triton
|
| 125 |
+
prologue that is substantially faster; this copy takes the torch path, which is the reference the
|
| 126 |
+
exports were scored against.
|
| 127 |
|
| 128 |
## Three things about this model that will bite you
|
| 129 |
|
|
|
|
| 137 |
3. **Actions come back 16-D.** Un-pad to 14-D β `concat(x[..., 0:7], x[..., 8:15])` β before
|
| 138 |
sending anything to a controller.
|
| 139 |
|
| 140 |
+
If you differentiate through this model yourself: cuDNN's fused attention cannot be backpropagated
|
| 141 |
+
here β from the third denoising step on it dies with `mha_graph.execute(...).is_good()` false,
|
| 142 |
+
surfacing as an illegal memory access β and gradient checkpointing must be off. The forward is
|
| 143 |
+
unaffected either way, which is why inference never notices.
|
| 144 |
+
|
| 145 |
## Tasks
|
| 146 |
|
| 147 |
* `blue_basket` β put the medicine then the measuring tape inside the blue basket
|