linxin02 commited on
Commit
9a11bd8
·
verified ·
1 Parent(s): e843be5

Update REPA metrics and experiment documentation

Browse files
EXPERIMENTS_REPA.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PixelDiT Representation-Alignment (REPA) — experiments & handoff
2
+
3
+ Study of **what to align PixelDiT's intermediate features to** (the "teacher" in REPA-style
4
+ training) on ImageNet-256, plus a per-layer feature analysis. Variants A–E keep PixelDiT's
5
+ flow-matching loss and alignment point (patch **block 8**) fixed and only change the teacher;
6
+ variant F is a follow-up hybrid that adds SRA guidance at block 4 while retaining block-8 REPA.
7
+ This doc is the authoritative summary + handoff (results, infra, current state, how to continue).
8
+
9
+ ---
10
+
11
+ ## 1. Setup / infra
12
+
13
+ - **Model**: PixelDiT-XL, 797M — pixel-space DiT, 26 patch blocks + 4 pixel blocks, patch 16, 256×256.
14
+ - **Data**: ImageNet-1K, REPA-E 256px H5 at `imagenet256_data/images.h5` (253 GB, restored from S3
15
+ `s3://dit-scale-up/fe-experiments/xinlin/pixeldit_imagenet256_xl_lx_vb/data/`).
16
+ - **Recipe** (identical across variants unless noted): 8×80GB, global batch 256 (8×32), AdamW lr 1e-4,
17
+ EMA 0.9999 (SRA/Staged use **0.999**, see §3D), `bf16-mixed`, 70k steps, checkpoint every 10k
18
+ (`save_top_k=-1`, all kept, ~12.8 GB each).
19
+ - **Eval**: `main.py predict` → 50k samples (50/class, FlowDPMSolver 100-step, CFG 2.75, interval
20
+ [0.1,0.9]) → OpenAI guided-diffusion **ADM evaluator** vs `eval_refs/VIRTUAL_imagenet256_labeled.npz`
21
+ → FID / sFID / IS. FID worker computes one point per 10k checkpoint.
22
+ - **Envs**: `/mnt/localssd/pixeldit-venv` (torch 2.5.0+cu124, training/predict); ADM evaluator in
23
+ `/mnt/localssd/adm-eval-venv` (tf 2.15) + `/mnt/localssd/guided-diffusion`. Static `tmux` at
24
+ `~/.local/bin/tmux`.
25
+ - **W&B**: project `pixeldit-imagenet-repro` on `adobesensei.wandb.io` (API key needed;
26
+ `wandb==0.19.11` required — 40-char check rejects the self-hosted key on ≥0.20).
27
+ - **Run a variant** (8-GPU): `scripts/train_pixeldit_imagenet256_xl.sh <config.yaml> [--ckpt_path=...]`
28
+ in one tmux; `scripts/<variant>_fid_eval.sh` in another (`WANDB_API_KEY`, `PIXELDIT_SKIP_S3_RESTORE=1`
29
+ set). FID/predict shares the 8 GPUs with training (~0.06 it/s, ~1.5–2h per 50k point).
30
+
31
+ ## 2. Per-layer feature analysis (which layer is semantic)
32
+
33
+ On the official converged PixelDiT-XL (`nvidia/PixelDiT-ImageNet` epoch320), hooking each patch
34
+ block and PCA→RGB + linear-CKA-vs-DINOv2: **semantic content peaks sharply at patch block 8**
35
+ (CKA 0.85), exactly the REPA anchor; early blocks = detail, late blocks specialize toward the
36
+ denoising output. DiT-XL/2-256's own features are semantic mid-late (blk 12–21). Scripts:
37
+ `scripts/viz_layer_features.py`, `viz_layer_similarity.py`, `viz_dit_layers.py`
38
+ (figures in `viz_layer_features/`, `viz_dit_layers/` — PNGs are gitignored, regenerate from scripts).
39
+
40
+ ## 3. Experiments (teacher = the only thing that changes)
41
+
42
+ - **A. baseline (DINOv2 REPA)** — project block-8 tokens (MLP→768), cosine-align to frozen DINOv2
43
+ patch tokens of the clean image, weight 0.5. `pix256_xl_orig_10k.yaml`. W&B loss `y4489tgd`, FID `xo84hpbc`.
44
+ - **B. DiT-REPA (blk12)** — teacher = frozen DiT-XL/2-256: VAE-encode → noise at ddpm t=100 → DiT
45
+ forward (class-cond) → block-12 features. **Gotcha:** raw DiT features are DC-dominated (inter-token
46
+ cosine 0.965) so cosine aligns trivially → fixed by per-image mean-centering. `src/dit_repa.py`,
47
+ `pix256_xl_ditrepa12.yaml`. W&B `s075fe0g` / `o113h6qc`.
48
+ - **C. dino+VAE** — keep DINOv2 REPA **and** add a 2nd projector on block 8 aligned to the frozen
49
+ **SD-VAE encoder mid-block** feature (DC-centered), λ_gen 0.05. `src/dino_vae_repa.py`,
50
+ `pix256_xl_dinovae.yaml`. W&B `0e4hcesw` / `pixeldit_dinovae_fid`.
51
+ - **D. SRA (self-distillation, EMA teacher)** — no external teacher: student block-8 (through a
52
+ projector) aligns to the **EMA net's block-16** at a lower-noise timestep, smooth-L1 β0.05, weight
53
+ 0.04. Port of [vvvvvjdy/SRA](https://github.com/vvvvvjdy/SRA). **Two fixes were required:**
54
+ (1) `use_proj=True` — reference projects the STUDENT and aligns to the RAW teacher (asymmetric);
55
+ (2) **EMA decay 0.9999 → 0.999** — SRA reads the EMA forward every step and drives the online
56
+ weight-norm up; the wide 0.9999 window lags that norm so the EMA (not the online model) samples as
57
+ noise by ~30k. A tighter 0.999 window tracks it → clean EMA. `SRATrainer` in `src/diffusion.py`
58
+ (`use_proj` flag), `pix256_xl_sra.yaml`. W&B `77xtrzcq` / `pixeldit_sra_fid`.
59
+ - **E. StagedTeacher (self-distillation, frozen-snapshot teacher)** — like SRA but the teacher is a
60
+ **frozen hard copy of the online model, refreshed every 10k steps** (a periodically-updated target
61
+ network) instead of an EMA. Resumed from SRA's 10k checkpoint. `src/staged_teacher.py`,
62
+ `pix256_xl_stageteach.yaml` (`refresh_interval: 10000`). W&B `5ywf06q4` / `pixeldit_stageteach_fid`.
63
+ - **F. SRA4 + DINO-REPA8 (hybrid)** — one online forward supplies two complementary targets:
64
+ online **block 4** (student projector) aligns by smooth-L1 to the EMA net's raw **block 16** at a
65
+ lower-noise timestep, while online **block 8** independently aligns by cosine to frozen DINOv2
66
+ clean-image patch tokens. Weights remain SRA 0.04 and REPA 0.5; EMA decay is 0.999.
67
+ `src/hybrid_sra_repa.py`, `pix256_xl_sra_repa4.yaml`. W&B training run `49p8qfc5`;
68
+ FID curve pending.
69
+
70
+ ## 4. Results — 50k-sample ADM eval
71
+
72
+ **FID** (↓ better)
73
+
74
+ | step | baseline | DiT-REPA | dino+VAE | SRA (EMA) | StagedTeacher |
75
+ |---|---|---|---|---|---|
76
+ | 10k | 389.3 | 368.7 | 383.1 | 187.5 | 187.5¹ |
77
+ | 20k | 363.6 | 350.6 | 387.5 | **102.8** | 116.0 |
78
+ | 30k | 106.1 | 108.1 | 127.9 | **82.2** | 86.9 |
79
+ | 40k | 66.8 | 81.7 | **52.6** | 67.1 | 68.7 |
80
+ | 50k | **31.1** | 57.2 | 39.2 | 55.8 | 58.4 |
81
+ | 60k | **21.3** | 39.6 | 25.9 | — | 49.5 |
82
+ | 70k | — | — | **17.0** | — | 43.1 |
83
+
84
+ **sFID** (↓ better)
85
+
86
+ | step | baseline | DiT-REPA | dino+VAE | SRA | StagedTeacher |
87
+ |---|---|---|---|---|---|
88
+ | 10k | 414.7 | 417.3 | 398.4 | 50.4 | 50.4¹ |
89
+ | 20k | 304.7 | 197.4 | 403.2 | **13.9** | 17.5 |
90
+ | 30k | 78.2 | 45.6 | 73.2 | **10.0** | 13.0 |
91
+ | 40k | 46.0 | 42.7 | 30.5 | **8.5** | 8.9 |
92
+ | 50k | 20.3 | 32.2 | 27.0 | 7.9 | **7.8** |
93
+ | 60k | 14.7 | 20.3 | 18.0 | — | **7.3** |
94
+ | 70k | — | — | 14.1 | — | **6.8** |
95
+
96
+ **IS** (↑ better)
97
+
98
+ | step | baseline | DiT-REPA | dino+VAE | SRA | StagedTeacher |
99
+ |---|---|---|---|---|---|
100
+ | 10k | 1.07 | 1.04 | 1.06 | **5.40** | 5.40¹ |
101
+ | 20k | 1.40 | 1.64 | 1.00 | **9.59** | 8.43 |
102
+ | 30k | **11.71** | 10.48 | 9.94 | 11.15 | 10.39 |
103
+ | 40k | 17.51 | 10.82 | **19.19** | 12.59 | 12.40 |
104
+ | 50k | **26.65** | 13.84 | 24.78 | 14.19 | 13.73 |
105
+ | 60k | **32.94** | 18.56 | 30.52 | — | 15.36 |
106
+ | 70k | — | — | **37.30** | — | 17.12 |
107
+
108
+ ¹ StagedTeacher resumed from SRA's 10k checkpoint, so its 10k = SRA's 10k. Chart:
109
+ `slides_assets/fid_comparison_5way.png` (regenerate; PNGs gitignored).
110
+
111
+ ## 5. Findings
112
+
113
+ 1. **Self-distillation (SRA, StagedTeacher) converges dramatically faster early and dominates sFID
114
+ at every step.** At 10k SRA is FID 187 / IS 5.4 while the external-teacher variants are still
115
+ ~380 / IS ~1; SRA's 20k FID (103) ≈ the DINOv2 baseline's 30k. sFID stays 2–5× better throughout.
116
+ 2. **But self-distillation plateaus on FID/IS.** By 50–60k the external-teacher variants overtake on
117
+ FID (60k: baseline 21.3, dino+VAE 25.9 vs StagedTeacher 49.5) and on IS. Net: self-distillation =
118
+ fast + best structure (sFID), external semantic teacher = better final FID/diversity (IS).
119
+ dino+VAE reaches the best FID by 70k (17.0).
120
+ 3. **EMA teacher (SRA) ≈ frozen-snapshot teacher (StagedTeacher), EMA slightly better early.** Gap
121
+ 20k 116 vs 103, narrowing to ~identical by 40k. The gain comes from the self-distillation mechanism
122
+ (block-8→block-16 alignment), not from how the teacher is updated.
123
+ 4. **DiT-blk12 as teacher (B) < DINOv2 (A)**; **dino+VAE (C) ≈ baseline** (slightly better late).
124
+ 5. **Diffusion-model features need DC removal** to be a usable cosine-alignment teacher (B, C).
125
+ 6. Debugging lesson (SRA): the EMA "noise" was **not** EMA corruption — the EMA tracked online
126
+ (cosine 0.985, drift 0) but lagged in *norm* under the wide 0.9999 window; several wrong fixes
127
+ (stream, compile, clobber) were tried before the real cause (norm-lag) → decay 0.999.
128
+
129
+ ## 6. Current state (as of 2026-07-28)
130
+
131
+ - **Running**: hybrid SRA4 + DINO-REPA8 (`49p8qfc5`), newly started from scratch. tmux sessions
132
+ `hybrid_train`, `hybrid_fid`; the FID worker targets every 10k checkpoint from 10k through 70k.
133
+ - **Completed**: StagedTeacher reached 70k; its final point is FID 43.11 / sFID 6.78 / IS 17.12.
134
+ - **Checkpoints on local SSD** (`train_logs/exp_pixeldit_imagenet256_xl_<variant>/`, every 10k, ~12.8GB):
135
+ baseline 10–60k, DiT-REPA 10–70k, dino+VAE 10–70k, SRA 10–60k, StagedTeacher 20–70k.
136
+ **NOT backed up to S3** — a box wipe loses them (`scripts/sync_pixeldit_to_s3_loop.sh` can back up).
137
+ - baseline & SRA runs were stopped early (~62k) to free GPUs for later variants, hence FID only to 60k/50k.
138
+
139
+ ## 7. Handoff notes (for continuing)
140
+
141
+ - To finish a curve: relaunch its `scripts/<variant>_fid_eval.sh` (idempotent — skips computed points;
142
+ set `STEPS=...` to target specific steps). Checkpoints are all saved, so any FID point can be
143
+ (re)computed offline without retraining.
144
+ - To resume/continue training: `train_pixeldit_imagenet256_xl.sh <config> --ckpt_path=<...ckpt>`.
145
+ - Open directions: (a) push SRA/Staged past 70k or with a **stronger λ / IS-oriented tweak** to fix
146
+ the FID/IS plateau while keeping the sFID lead; (b) **hybrid**: DINOv2 REPA + SRA self-distillation
147
+ (semantic teacher for late FID/IS + self-distillation for early speed & sFID); (c) tune SRA
148
+ student/teacher blocks & `sra_t_max`. (d) back up checkpoints to S3 first.
149
+ - Gotchas: EMA decay must be ≤0.999 for any variant that reads the EMA during training (norm-lag);
150
+ keep DC-centering for diffusion/VAE-feature teachers; `nn.Module.compile()` is lazy (first-forward);
151
+ the CLI list-index override `--trainer.callbacks.N...` is rejected by jsonargparse (edit the YAML).
152
+
153
+ ## 8. File map
154
+
155
+ ```
156
+ pixeldit_configs/pix256_xl_orig_10k.yaml # A baseline (DINOv2)
157
+ pixeldit_configs/pix256_xl_ditrepa12.yaml # B DiT-REPA blk12 (DC-centered)
158
+ pixeldit_configs/pix256_xl_dinovae.yaml # C DINOv2 + SD-VAE detail head
159
+ pixeldit_configs/pix256_xl_sra.yaml # D SRA (use_proj=true, EMA decay 0.999)
160
+ pixeldit_configs/pix256_xl_stageteach.yaml # E StagedTeacher (refresh_interval 10000)
161
+ pixeldit_configs/pix256_xl_sra_repa4.yaml # F hybrid: SRA 4->16 + DINOv2 REPA on block 8
162
+ PixelDiT/c2i/src/diffusion.py # REPATrainer, DINOv2, SRATrainer (use_proj flag)
163
+ PixelDiT/c2i/src/dit_repa.py # B
164
+ PixelDiT/c2i/src/dino_vae_repa.py # C
165
+ PixelDiT/c2i/src/staged_teacher.py # E
166
+ PixelDiT/c2i/src/hybrid_sra_repa.py # F
167
+ scripts/*_fid_eval.sh # per-variant FID-curve workers
168
+ scripts/log_fid_wandb.py # append an FID point to a W&B run
169
+ scripts/viz_*_layers*.py, build_slides.py # analysis + slide deck
170
+ ```
HYBRID_SRA_REPA.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PixelDiT Hybrid SRA + REPA
2
+
3
+ ## Motivation
4
+
5
+ The previous controlled experiments showed complementary behavior:
6
+
7
+ - DINOv2 REPA converges slowly at the beginning, but gives stronger late-stage FID and IS.
8
+ - SRA converges much faster and gives substantially better sFID, but its FID/IS improvement slows
9
+ after roughly 40k steps.
10
+
11
+ The hybrid experiment keeps the original DINOv2 REPA target on patch block 8 and adds an earlier
12
+ SRA target on patch block 4. The goal is to retain SRA's early structural acceleration without
13
+ removing the fixed external semantic anchor that benefits late-stage generation.
14
+
15
+ ## Method
16
+
17
+ One online PixelDiT forward captures two intermediate features:
18
+
19
+ ```text
20
+ noisy image x_t
21
+ |
22
+ +-- online block 4 -- SRA projector -- Smooth-L1 --> EMA block 16
23
+ | (same image and noise,
24
+ | lower-noise timestep)
25
+ |
26
+ +-- online block 8 -- REPA projector -- cosine --> frozen DINOv2 patch tokens
27
+ (clean image)
28
+ ```
29
+
30
+ The training objective is:
31
+
32
+ \[
33
+ \mathcal{L}
34
+ =
35
+ \mathcal{L}_{FM}
36
+ + 0.04\,\mathcal{L}_{SRA}^{4\rightarrow16}
37
+ + 0.5\,\mathcal{L}_{REPA}^{8\rightarrow DINOv2}.
38
+ \]
39
+
40
+ ### SRA branch
41
+
42
+ - Student: online PixelDiT patch block 4.
43
+ - Teacher: EMA PixelDiT patch block 16.
44
+ - The teacher receives a lower-noise point no more than `0.2` away from the student timestep.
45
+ - Student and teacher use the same clean image, class label, and sampled noise.
46
+ - A two-layer MLP projects only the student feature.
47
+ - Alignment uses patch-wise Smooth-L1 with `beta=0.05`.
48
+ - Loss weight is `0.04`.
49
+ - EMA decay is `0.999`, which avoids the feature-norm lag observed with `0.9999` in PixelDiT.
50
+
51
+ ### REPA branch
52
+
53
+ - Student: online PixelDiT patch block 8.
54
+ - Teacher: frozen DINOv2 ViT-B/14 patch tokens from the clean image.
55
+ - A three-layer MLP projects the PixelDiT feature from 1152 to 768 dimensions.
56
+ - Corresponding spatial patch tokens are aligned with cosine distance.
57
+ - Loss weight remains `0.5`, unchanged from the original PixelDiT DINOv2 REPA baseline.
58
+
59
+ Both online features are captured during the same forward pass. The EMA and DINOv2 teacher
60
+ branches run without gradients. Both projection heads are training-only and are omitted at
61
+ inference.
62
+
63
+ ## Implementation
64
+
65
+ - `PixelDiT/c2i/src/hybrid_sra_repa.py`
66
+ - Defines `HybridSRAREPATrainer`.
67
+ - Captures online blocks 4 and 8 in one forward.
68
+ - Reuses the existing SRA timestep construction and Smooth-L1 alignment.
69
+ - Preserves the existing DINOv2 REPA cosine alignment and spatial-grid matching behavior.
70
+ - Logs the unweighted and weighted SRA/REPA losses separately.
71
+ - `pixeldit_configs/pix256_xl_sra_repa4.yaml`
72
+ - Configures SRA `4 -> 16`, REPA on block 8, EMA decay `0.999`, and 70k training steps.
73
+ - `scripts/sra_repa4_fid_eval.sh`
74
+ - Builds the 10k-to-70k FID curve with 50k ADM samples per checkpoint.
75
+
76
+ ## Initial result
77
+
78
+ ImageNet-256, PixelDiT-XL, global batch 256, evaluated with the same 50k-sample ADM protocol:
79
+
80
+ | Experiment at 10k | FID ↓ | sFID ↓ | IS ↑ |
81
+ |---|---:|---:|---:|
82
+ | DINOv2 REPA baseline | 389.3 | 414.7 | 1.07 |
83
+ | DINOv2 + VAE | 383.1 | 398.4 | 1.06 |
84
+ | SRA, block 8 -> 16 | 187.5 | 50.4 | 5.40 |
85
+ | StagedTeacher | 187.5 | 50.4 | 5.40 |
86
+ | **Hybrid SRA 4 -> 16 + REPA block 8** | **86.67** | **18.28** | **11.30** |
87
+
88
+ Relative to the original SRA run at 10k, the hybrid lowers FID by about 54%, lowers sFID by about
89
+ 64%, and increases IS by about 2.1x. Its 10k FID is also already better than the original SRA
90
+ 20k FID of 102.8.
91
+
92
+ These are early results; later checkpoints are required to determine whether the hybrid preserves
93
+ the original REPA run's late-stage FID/IS advantage.
94
+
95
+ ## Running the experiment
96
+
97
+ ```bash
98
+ PIXELDIT_SKIP_S3_RESTORE=1 \
99
+ scripts/train_pixeldit_imagenet256_xl.sh \
100
+ pixeldit_configs/pix256_xl_sra_repa4.yaml
101
+ ```
102
+
103
+ Run the FID worker separately:
104
+
105
+ ```bash
106
+ PIXELDIT_SKIP_S3_RESTORE=1 scripts/sra_repa4_fid_eval.sh
107
+ ```
108
+
109
+ The active W&B training run is `49p8qfc5` (`pixeldit_sra4_repa8_loss`) in the
110
+ `pixeldit-imagenet-repro` project.
111
+
112
+ ## Validation performed
113
+
114
+ - Python syntax compilation for the hybrid trainer.
115
+ - Shell syntax validation for the FID worker.
116
+ - LightningCLI config parsing with the complete YAML.
117
+ - Synthetic forward/backward test verifying:
118
+ - gradients reach the online network;
119
+ - gradients reach both projection heads;
120
+ - no gradients reach the EMA teacher.
121
+ - Real 8-GPU launch and sustained training beyond 20k steps.
122
+ - Successful 10k checkpoint sampling and 50k ADM evaluation.
METRICS.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Baseline vs hybrid metric summary
2
+
3
+ All values use the same ImageNet-256 50k-sample ADM evaluation protocol.
4
+
5
+ ## DINOv2 REPA baseline
6
+
7
+ | Step | FID ↓ | sFID ↓ | IS ↑ |
8
+ |---:|---:|---:|---:|
9
+ | 10,000 | 389.2824 | 414.7020 | 1.0710 |
10
+ | 20,000 | 363.6215 | 304.7034 | 1.4038 |
11
+ | 30,000 | 106.0903 | 78.1710 | 11.7050 |
12
+ | 40,000 | 66.7541 | 45.9615 | 17.5108 |
13
+ | 50,000 | 31.1164 | 20.3315 | 26.6462 |
14
+ | 60,000 | 21.3407 | 14.7369 | 32.9395 |
15
+
16
+ ## Hybrid SRA4 + REPA8
17
+
18
+ | Step | FID ↓ | sFID ↓ | IS ↑ |
19
+ |---:|---:|---:|---:|
20
+ | 10,000 | 86.6690 | 18.2777 | 11.2964 |
21
+ | 20,000 | 44.5866 | 11.0986 | 19.4438 |
22
+ | 30,000 | 28.4069 | 9.0362 | 26.7527 |
dinov2_repa_baseline/README.md CHANGED
@@ -1,3 +1,17 @@
1
- # DINOv2 REPA baseline checkpoints
2
 
3
- PixelDiT-XL ImageNet-256 checkpoints at 10k-step intervals.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DINOv2 REPA baseline
2
 
3
+ PixelDiT-XL on ImageNet-256. Online patch block 8 is projected and aligned
4
+ patch-wise to frozen DINOv2 clean-image tokens with cosine distance.
5
+
6
+ ## 50k-sample ADM metrics
7
+
8
+ | Step | FID ↓ | sFID ↓ | IS ↑ |
9
+ |---:|---:|---:|---:|
10
+ | 10,000 | 389.2824 | 414.7020 | 1.0710 |
11
+ | 20,000 | 363.6215 | 304.7034 | 1.4038 |
12
+ | 30,000 | 106.0903 | 78.1710 | 11.7050 |
13
+ | 40,000 | 66.7541 | 45.9615 | 17.5108 |
14
+ | 50,000 | 31.1164 | 20.3315 | 26.6462 |
15
+ | 60,000 | 21.3407 | 14.7369 | 32.9395 |
16
+
17
+ Raw evaluator outputs are stored under `metrics/`.
dinov2_repa_baseline/metrics.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ step,FID,sFID,IS,Precision,Recall
2
+ 10000,389.2823967413824,414.7020167260448,1.0709521770477295,,
3
+ 20000,363.62150542991213,304.70335112320214,1.4037563800811768,,
4
+ 30000,106.09033483097272,78.1709826505786,11.705048561096191,,
5
+ 40000,66.75411054088266,45.96150425066094,17.510835647583008,,
6
+ 50000,31.116447437985357,20.331490638313994,26.646221160888672,,
7
+ 60000,21.34065440024318,14.736901695812094,32.93950653076172,,
dinov2_repa_baseline/metrics.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "FID": 389.2823967413824,
4
+ "IS": 1.0709521770477295,
5
+ "sFID": 414.7020167260448,
6
+ "step": 10000
7
+ },
8
+ {
9
+ "FID": 363.62150542991213,
10
+ "IS": 1.4037563800811768,
11
+ "sFID": 304.70335112320214,
12
+ "step": 20000
13
+ },
14
+ {
15
+ "FID": 106.09033483097272,
16
+ "IS": 11.705048561096191,
17
+ "sFID": 78.1709826505786,
18
+ "step": 30000
19
+ },
20
+ {
21
+ "FID": 66.75411054088266,
22
+ "IS": 17.510835647583008,
23
+ "sFID": 45.96150425066094,
24
+ "step": 40000
25
+ },
26
+ {
27
+ "FID": 31.116447437985357,
28
+ "IS": 26.646221160888672,
29
+ "sFID": 20.331490638313994,
30
+ "step": 50000
31
+ },
32
+ {
33
+ "FID": 21.34065440024318,
34
+ "IS": 32.93950653076172,
35
+ "sFID": 14.736901695812094,
36
+ "step": 60000
37
+ }
38
+ ]
dinov2_repa_baseline/metrics/step-10000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 1.0709521770477295
2
+ FID: 389.2823967413824
3
+ sFID: 414.7020167260448
dinov2_repa_baseline/metrics/step-20000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 1.4037563800811768
2
+ FID: 363.62150542991213
3
+ sFID: 304.70335112320214
dinov2_repa_baseline/metrics/step-30000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 11.705048561096191
2
+ FID: 106.09033483097272
3
+ sFID: 78.1709826505786
dinov2_repa_baseline/metrics/step-40000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 17.510835647583008
2
+ FID: 66.75411054088266
3
+ sFID: 45.96150425066094
dinov2_repa_baseline/metrics/step-50000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 26.646221160888672
2
+ FID: 31.116447437985357
3
+ sFID: 20.331490638313994
dinov2_repa_baseline/metrics/step-60000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 32.93950653076172
2
+ FID: 21.34065440024318
3
+ sFID: 14.736901695812094
hybrid_sra4_repa8/METHOD.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PixelDiT Hybrid SRA + REPA
2
+
3
+ ## Motivation
4
+
5
+ The previous controlled experiments showed complementary behavior:
6
+
7
+ - DINOv2 REPA converges slowly at the beginning, but gives stronger late-stage FID and IS.
8
+ - SRA converges much faster and gives substantially better sFID, but its FID/IS improvement slows
9
+ after roughly 40k steps.
10
+
11
+ The hybrid experiment keeps the original DINOv2 REPA target on patch block 8 and adds an earlier
12
+ SRA target on patch block 4. The goal is to retain SRA's early structural acceleration without
13
+ removing the fixed external semantic anchor that benefits late-stage generation.
14
+
15
+ ## Method
16
+
17
+ One online PixelDiT forward captures two intermediate features:
18
+
19
+ ```text
20
+ noisy image x_t
21
+ |
22
+ +-- online block 4 -- SRA projector -- Smooth-L1 --> EMA block 16
23
+ | (same image and noise,
24
+ | lower-noise timestep)
25
+ |
26
+ +-- online block 8 -- REPA projector -- cosine --> frozen DINOv2 patch tokens
27
+ (clean image)
28
+ ```
29
+
30
+ The training objective is:
31
+
32
+ \[
33
+ \mathcal{L}
34
+ =
35
+ \mathcal{L}_{FM}
36
+ + 0.04\,\mathcal{L}_{SRA}^{4\rightarrow16}
37
+ + 0.5\,\mathcal{L}_{REPA}^{8\rightarrow DINOv2}.
38
+ \]
39
+
40
+ ### SRA branch
41
+
42
+ - Student: online PixelDiT patch block 4.
43
+ - Teacher: EMA PixelDiT patch block 16.
44
+ - The teacher receives a lower-noise point no more than `0.2` away from the student timestep.
45
+ - Student and teacher use the same clean image, class label, and sampled noise.
46
+ - A two-layer MLP projects only the student feature.
47
+ - Alignment uses patch-wise Smooth-L1 with `beta=0.05`.
48
+ - Loss weight is `0.04`.
49
+ - EMA decay is `0.999`, which avoids the feature-norm lag observed with `0.9999` in PixelDiT.
50
+
51
+ ### REPA branch
52
+
53
+ - Student: online PixelDiT patch block 8.
54
+ - Teacher: frozen DINOv2 ViT-B/14 patch tokens from the clean image.
55
+ - A three-layer MLP projects the PixelDiT feature from 1152 to 768 dimensions.
56
+ - Corresponding spatial patch tokens are aligned with cosine distance.
57
+ - Loss weight remains `0.5`, unchanged from the original PixelDiT DINOv2 REPA baseline.
58
+
59
+ Both online features are captured during the same forward pass. The EMA and DINOv2 teacher
60
+ branches run without gradients. Both projection heads are training-only and are omitted at
61
+ inference.
62
+
63
+ ## Implementation
64
+
65
+ - `PixelDiT/c2i/src/hybrid_sra_repa.py`
66
+ - Defines `HybridSRAREPATrainer`.
67
+ - Captures online blocks 4 and 8 in one forward.
68
+ - Reuses the existing SRA timestep construction and Smooth-L1 alignment.
69
+ - Preserves the existing DINOv2 REPA cosine alignment and spatial-grid matching behavior.
70
+ - Logs the unweighted and weighted SRA/REPA losses separately.
71
+ - `pixeldit_configs/pix256_xl_sra_repa4.yaml`
72
+ - Configures SRA `4 -> 16`, REPA on block 8, EMA decay `0.999`, and 70k training steps.
73
+ - `scripts/sra_repa4_fid_eval.sh`
74
+ - Builds the 10k-to-70k FID curve with 50k ADM samples per checkpoint.
75
+
76
+ ## Initial result
77
+
78
+ ImageNet-256, PixelDiT-XL, global batch 256, evaluated with the same 50k-sample ADM protocol:
79
+
80
+ | Experiment at 10k | FID ↓ | sFID ↓ | IS ↑ |
81
+ |---|---:|---:|---:|
82
+ | DINOv2 REPA baseline | 389.3 | 414.7 | 1.07 |
83
+ | DINOv2 + VAE | 383.1 | 398.4 | 1.06 |
84
+ | SRA, block 8 -> 16 | 187.5 | 50.4 | 5.40 |
85
+ | StagedTeacher | 187.5 | 50.4 | 5.40 |
86
+ | **Hybrid SRA 4 -> 16 + REPA block 8** | **86.67** | **18.28** | **11.30** |
87
+
88
+ Relative to the original SRA run at 10k, the hybrid lowers FID by about 54%, lowers sFID by about
89
+ 64%, and increases IS by about 2.1x. Its 10k FID is also already better than the original SRA
90
+ 20k FID of 102.8.
91
+
92
+ These are early results; later checkpoints are required to determine whether the hybrid preserves
93
+ the original REPA run's late-stage FID/IS advantage.
94
+
95
+ ## Running the experiment
96
+
97
+ ```bash
98
+ PIXELDIT_SKIP_S3_RESTORE=1 \
99
+ scripts/train_pixeldit_imagenet256_xl.sh \
100
+ pixeldit_configs/pix256_xl_sra_repa4.yaml
101
+ ```
102
+
103
+ Run the FID worker separately:
104
+
105
+ ```bash
106
+ PIXELDIT_SKIP_S3_RESTORE=1 scripts/sra_repa4_fid_eval.sh
107
+ ```
108
+
109
+ The active W&B training run is `49p8qfc5` (`pixeldit_sra4_repa8_loss`) in the
110
+ `pixeldit-imagenet-repro` project.
111
+
112
+ ## Validation performed
113
+
114
+ - Python syntax compilation for the hybrid trainer.
115
+ - Shell syntax validation for the FID worker.
116
+ - LightningCLI config parsing with the complete YAML.
117
+ - Synthetic forward/backward test verifying:
118
+ - gradients reach the online network;
119
+ - gradients reach both projection heads;
120
+ - no gradients reach the EMA teacher.
121
+ - Real 8-GPU launch and sustained training beyond 20k steps.
122
+ - Successful 10k checkpoint sampling and 50k ADM evaluation.
hybrid_sra4_repa8/README.md CHANGED
@@ -1,3 +1,18 @@
1
- # Hybrid SRA4 + REPA8 checkpoints
2
 
3
- SRA online block 4 to EMA block 16 plus DINOv2 REPA on online block 8.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hybrid SRA4 + REPA8
2
 
3
+ PixelDiT-XL on ImageNet-256 with two representation targets:
4
+
5
+ - SRA: online block 4 to EMA block 16 at a lower-noise timestep, Smooth-L1 weight 0.04.
6
+ - REPA: online block 8 to frozen DINOv2 clean-image tokens, cosine weight 0.5.
7
+
8
+ See [`METHOD.md`](./METHOD.md) for implementation details and validation.
9
+
10
+ ## 50k-sample ADM metrics
11
+
12
+ | Step | FID ↓ | sFID ↓ | IS ↑ |
13
+ |---:|---:|---:|---:|
14
+ | 10,000 | 86.6690 | 18.2777 | 11.2964 |
15
+ | 20,000 | 44.5866 | 11.0986 | 19.4438 |
16
+ | 30,000 | 28.4069 | 9.0362 | 26.7527 |
17
+
18
+ Raw evaluator outputs are stored under `metrics/`.
hybrid_sra4_repa8/metrics.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ step,FID,sFID,IS,Precision,Recall
2
+ 10000,86.66904452942163,18.277675999740154,11.29637622833252,,
3
+ 20000,44.58660002402064,11.098587139252231,19.443777084350586,,
4
+ 30000,28.406907534417826,9.036190922661376,26.752666473388672,,
hybrid_sra4_repa8/metrics.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "FID": 86.66904452942163,
4
+ "IS": 11.29637622833252,
5
+ "sFID": 18.277675999740154,
6
+ "step": 10000
7
+ },
8
+ {
9
+ "FID": 44.58660002402064,
10
+ "IS": 19.443777084350586,
11
+ "sFID": 11.098587139252231,
12
+ "step": 20000
13
+ },
14
+ {
15
+ "FID": 28.406907534417826,
16
+ "IS": 26.752666473388672,
17
+ "sFID": 9.036190922661376,
18
+ "step": 30000
19
+ }
20
+ ]
hybrid_sra4_repa8/metrics/step-10000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 11.29637622833252
2
+ FID: 86.66904452942163
3
+ sFID: 18.277675999740154
hybrid_sra4_repa8/metrics/step-20000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 19.443777084350586
2
+ FID: 44.58660002402064
3
+ sFID: 11.098587139252231
hybrid_sra4_repa8/metrics/step-30000-adm_eval.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Inception Score: 26.752666473388672
2
+ FID: 28.406907534417826
3
+ sFID: 9.036190922661376