[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115112":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":14,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":17,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":13,"lastSyncTime":28,"discoverSource":29},115112,"RiT","THUMAI-Lab\u002FRiT","THUMAI-Lab","[NeurIPS 2026 Spotlight] What Kills v-Prediction? A Patch-wise PCA Perspective on Pixel-Space Flow Matching","",null,"Python",63,2,1,0,5,3,46.43,"MIT License",false,"main",true,[],"2026-11-13 17:46:00","2026-11-23 07:01:12","# [NeurIPS 2026 Spotlight] What Kills $v$-Prediction? A Patch-wise PCA Perspective on Pixel-Space Flow Matching\n\nOfficial PyTorch implementation of **RiT** (NeurIPS 2026 Spotlight, top 1.3% of submissions).\n\n[Tianze Luo](https:\u002F\u002Fgithub.com\u002Fluotianze666)\u003Csup>1,2\u003C\u002Fsup>, [Haofeng Huang](https:\u002F\u002Fgithub.com\u002Fjason-huang03)\u003Csup>1\u003C\u002Fsup>, [Yuan Yao](https:\u002F\u002Fcollegeai.tsinghua.edu.cn\u002Fen\u002FPeople\u002FFull_time_PI\u002FYuan_Yao.htm)\u003Csup>1,2\u003C\u002Fsup>\n\n\u003Csup>1\u003C\u002Fsup> Tsinghua University, \u003Csup>2\u003C\u002Fsup> Shanghai Qi Zhi Institute\n\n[arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.12852) | [Checkpoints](https:\u002F\u002Fhuggingface.co\u002Fluotianze666\u002FRiT_ckpts)\n\n![](.\u002Ffigures\u002Fdemo.png)\n## Code Structure\n\n```text\nrit.py                      # Model architecture and decoder variants\nmodels.py                   # Flow-matching objectives and sampling\ntrain.py                    # Distributed training\ninference.py                # Distributed inference with pretrained checkpoints\nevaluator.py                # Image generation metrics, adapted from ADM\nget_stats.py                # Distributed computation of patch statistics\nstats.pt                    # Precomputed ImageNet patch statistics\nanalysis\u002F\n├── draw_eigens.py          # Plot the PCA eigenvalue spectrum\n├── draw_embeds.py          # Plot embedding effective rank and PCA alignment over training\n└── draw_r2.py              # Plot layer-wise linear reconstruction R²\n```\n\n## 1. Installation\n\nRun all commands from the repository root. Training and inference require NVIDIA GPUs.\n\nCreate the environment for training, inference, and analysis:\n\n```bash\nconda create -n rit python=3.10 -y\nconda activate rit\npip install -r requirements_rit.txt\npip install -U \"huggingface_hub[cli]>=0.34,\u003C1.0\"\n```\n\nCreate a separate environment for evaluation:\n\n```bash\nconda create -n rit_eval python=3.10 -y\nconda activate rit_eval\npip install -r requirements_rit_eval.txt\n```\n\n## 2. Download Checkpoints\n\nCheckpoints and experiment configs are hosted on [Hugging Face](https:\u002F\u002Fhuggingface.co\u002Fluotianze666\u002FRiT_ckpts). The complete release is approximately **400 GB**; download only the files needed for your experiment.\n\nFor example, download the final RiT-B checkpoint, its config, and the ImageNet evaluation reference batch:\n\n```bash\nconda activate rit\nhf download luotianze666\u002FRiT_ckpts \\\n    RiT-B-v\u002Fconfig.yaml RiT-B-v\u002Fckpts\u002F750000.pt \\\n    VIRTUAL_imagenet256_labeled.npz \\\n    --local-dir .\u002FRiT_ckpts\n```\n\nFor other models, replace the folder and checkpoint filename accordingly. Always download the accompanying `config.yaml`.\n\nTo download the entire release:\n\n```bash\nhf download luotianze666\u002FRiT_ckpts --local-dir .\u002FRiT_ckpts\n```\n\nThe reference batch `VIRTUAL_imagenet256_labeled.npz` is provided by [ADM](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fguided-diffusion\u002Ftree\u002Fmain\u002Fevaluations) and is also available in our checkpoint repository. It is required for evaluation, **not for training or inference**.\n\n## 3. Training\n\nPrepare the ImageNet training images in an `ImageFolder` layout. The released configs use `..\u002Fimagenet`, alongside the RiT repository:\n\n```text\nparent_directory\u002F\n├── imagenet\u002F\n│   ├── n01440764\u002F\n│   │   └── *.JPEG\n│   └── ...\n└── RiT\u002F\n    ├── train.py\n    └── your_config.yaml\n```\n\nCreate `your_config.yaml` using a model's `config.yaml` from [Hugging Face](https:\u002F\u002Fhuggingface.co\u002Fluotianze666\u002FRiT_ckpts) as a template. Start with the released config for your desired model size, then update `dataset_path` and `working_dir` for your machine. Relative paths are resolved from the repository root.\n\nAll supported model variants and training settings are controlled through the config:\n\n- **Backbone:** `hidden_size`, `depth`, and `num_heads` determine the model size. `bottleneck_dim` sets the width of the linear input bottleneck. Use the released B\u002FL\u002FH configs to keep these settings consistent.\n- **Decoder and shortcuts:** `depth_final`, `hidden_size_final`, `num_heads_final`, and `patch_size_final` configure the decoder. `decoder_input` controls whether the noisy input is injected into the decoder Transformer blocks, while `shortcut_type` specifies the output-side shortcut formulation, including direct raw-input bypasses and learnable fractional parameterizations.\n- **Prediction objective and PCA experiments:** `use_v_pred: True` selects velocity prediction; `False` selects clean-image prediction. Keep `principal_dim: 0` for standard training. A positive value enables PCA-subspace training and requires `statistics_path` to point to `stats.pt`.\n- **Optimization:** `batch_size` is the global batch size and must be divisible by the number of GPUs. Set `total_steps`, `learning_rate`, `betas`, `weight_decay`, and `warmup_steps` as needed, or retain the released recipe to reproduce an experiment.\n\nLaunch training:\n\n```bash\nconda activate rit\ntorchrun --nproc_per_node=8 train.py --config your_config.yaml\n```\n\nTraining automatically resumes from the largest numbered checkpoint in `\u003Cworking_dir>\u002Fckpts\u002F`, restoring model weights, EMA weights, optimizer state, and progress counters. **Use a new, empty `working_dir` to train from scratch.** To extend an existing run, increase `total_steps` and launch the same command.\n\nCheckpoints, sample grids, and evaluation samples are saved under `ckpts\u002F`, `figs\u002F`, and `evals\u002F`. Set `ckpt_saving_steps`, `eval_demo_steps`, and `eval_steps` to control their frequency. Training generates the evaluation samples; run `evaluator.py` separately to compute their metrics.\n\n## 4. Inference\n\nReference results on ImageNet 256×256, using EMA 0.9996 and 50-step Heun sampling:\n\n| Model | Checkpoint | Approx. epochs | CFG | CFG interval | IS ↑ | FID-50K ↓ |\n|---|---:|---:|---:|---|---:|---:|\n| RiT-B\u002F16 | 250000 | 200 | 3.1 | [0.0, 0.89] | 283.9 | 3.40 |\n| RiT-B\u002F16 | 750000 | 600 | 2.8 | [0.0, 0.89] | 300.3 | 3.01 |\n| RiT-L\u002F16 | 250000 | 200 | 2.5 | [0.0, 0.89] | 300.6 | 2.48 |\n| RiT-L\u002F16 | 750000 | 600 | 2.6 | [0.0, 0.89] | 331.4 | 2.06 |\n| RiT-H\u002F16 | 250000 | 200 | 2.4 | [0.0, 0.89] | 309.2 | 2.17 |\n| RiT-H\u002F16 | 600000 | 480 | 2.35 | [0.0, 0.90] | 332.9 | 1.79 |\n\nIS and FID values are rounded to one and two decimal places, respectively.\n\nTo generate samples with RiT-B:\n\n```bash\nconda activate rit\ntorchrun --nproc_per_node=8 inference.py \\\n    --working_dir .\u002FRiT_ckpts\u002FRiT-B-v \\\n    --ckpt_steps 750000 --ema_decay_rate 0.9996 \\\n    --eval_solver Heun --eval_solver_steps 50 \\\n    --eval_cfg_scale 2.8 --eval_cfg_interval 0.0 0.89 \\\n    --seed 42\n```\n\nFor RiT-L or RiT-H, download the corresponding config and checkpoint, then use `RiT-L-v` or `RiT-H-v` as the working directory and the sampling settings listed above.\n\nThe script reads the architecture from `\u003Cworking_dir>\u002Fconfig.yaml` and writes 50,000 samples to `\u003Cworking_dir>\u002Fevals\u002F`. Allow approximately **10 GB** of disk space per sample file. Inference does not require the ImageNet training set.\n\nUse `--eval_cfg_scale 1.0` for unguided sampling. `--eval_batch_size` controls the batch size per GPU. BF16 and compilation are enabled by default; disable them with `--no-use_bf16_autocast` and `--no-use_compile`. Run `python inference.py --help` for all options.\n\n## 5. Evaluation\n\nDownload `VIRTUAL_imagenet256_labeled.npz` as shown above, then run:\n\n```bash\nconda activate rit_eval\npython evaluator.py \\\n    --ref_batch .\u002FRiT_ckpts\u002FVIRTUAL_imagenet256_labeled.npz \\\n    --sample_batch_dir .\u002FRiT_ckpts\n```\n\n`--sample_batch_dir` should point to the **parent directory of the experiments**, not an individual `evals\u002F` folder. The evaluator scans each experiment's `evals\u002F`, computes the metrics, appends them to `eval_results.txt`, and **deletes each NPZ after successful evaluation**.\n\nPreviously evaluated filenames are skipped. To evaluate the same filename again, rename the existing `eval_results.txt` or remove the matching entry.\n\nFor continuous evaluation:\n\n```bash\nconda activate rit_eval\nwhile true; do\n    python -u evaluator.py \\\n        --ref_batch .\u002FRiT_ckpts\u002FVIRTUAL_imagenet256_labeled.npz \\\n        --sample_batch_dir .\u002FRiT_ckpts\n    sleep 60\ndone\n```\n\nThis checks for new files 60 seconds after each pass finishes. Run only one evaluator per output directory, preferably on a separate GPU. When evaluating alongside training, ensure sample files are fully written before they become visible to the evaluator.\n\n## 6. Analysis Figures\nWe provide reproducible scripts for generating the analysis figures presented in our paper directly from the released checkpoints. These scripts cover the patch-wise PCA eigenspectrum, the evolution of learned input embeddings, and layer-wise linear reconstruction fidelity.\n\nThe eigenvalue plot only needs the `stats.pt` included in this repository. The remaining figures require checkpoints from Hugging Face:\n\n- **R²:** the configs and 250K checkpoints of `PCA768-v`, `PCA128-v`, `PCA768-x`, and `PCA128-x`, plus the ImageNet training images.\n- **Embedding plots:** the full checkpoint trajectories of those four experiments and `vanilla-L-v`.\n\nTo download the PCA experiment trajectories and vanilla-L checkpoints:\n\n```bash\nconda activate rit\nhf download luotianze666\u002FRiT_ckpts \\\n    --include 'PCA*\u002Fconfig.yaml' 'PCA*\u002Fckpts\u002F*.pt' \\\n              'vanilla-L-v\u002Fconfig.yaml' 'vanilla-L-v\u002Fckpts\u002F*.pt' \\\n    --local-dir .\u002FRiT_ckpts\n```\n\nGenerate the figures:\n\n```bash\npython analysis\u002Fdraw_eigens.py \\\n    --stats_path .\u002Fstats.pt \\\n    --save_path .\u002Ffigures\u002Fpca_eigenvalues.pdf\n\npython analysis\u002Fdraw_embeds.py \\\n    --stats_path .\u002Fstats.pt --top_k 280 \\\n    --save_path .\u002Ffigures\u002Fembedding.pdf\n\npython analysis\u002Fdraw_r2.py \\\n    --dataset_path ..\u002Fimagenet --stats_path .\u002Fstats.pt \\\n    --batch_size 64 --steps 16 --seed 42 \\\n    --save_path .\u002Ffigures\u002Fr2_scores.pdf\n```\n\nThe scripts save four figures under `.\u002Ffigures\u002F`; `draw_embeds.py` produces separate rank and alignment plots. Default checkpoint paths follow the download layout above. \n\nTo recompute patch statistics:\n\n```bash\ntorchrun --nproc_per_node=8 get_stats.py \\\n    --dataset_path ..\u002Fimagenet \\\n    --data_size 256 --patch_size 16 \\\n    --batch_size 256 --save_path .\u002Fstats.pt\n```\n\n## Acknowledgements\n\nOur implementation builds on [JiT](https:\u002F\u002Fgithub.com\u002FLTH14\u002FJiT), [SiT](https:\u002F\u002Fgithub.com\u002Fwillisma\u002FSiT), and [LightningDiT](https:\u002F\u002Fgithub.com\u002Fhustvl\u002FLightningDiT). We use the evaluation code from [ADM](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fguided-diffusion\u002Ftree\u002Fmain\u002Fevaluations).\n\n## Citation\n\n```bibtex\n@article{luo2026kills,\n  title={What kills $ v $-prediction? A Patch-wise PCA Perspective on Pixel-Space Flow Matching},\n  author={Luo, Tianze and Huang, Haofeng and Yao, Yuan},\n  journal={arXiv preprint arXiv:2611.12852},\n  year={2026}\n}\n```\n\n## License\n\nOriginal RiT code is licensed under [MIT](LICENSE). Third-party code retains its original licenses.","RiT 是一个面向像素空间流匹配（Flow Matching）的生成模型研究项目，聚焦于分析 v-预测失效机制及其 patch-wise 主成分结构。项目提供 PyTorch 实现，核心包含 RiT 模型架构、多种流匹配目标函数、分布式训练\u002F推理脚本，以及配套的 patch 统计分析工具（如 PCA 特征谱、嵌入对齐度、线性重构 R² 评估）。技术特点包括基于 ImageNet patch 的预计算统计、模块化解码器设计与可复现的流匹配采样流程。适用于生成模型机理研究、流匹配算法改进、图像生成中的表示学习分析等学术场景。","2026-11-24 04:50:23","CREATED_QUERY"]