[tunix] Add model-agnostic JAX diffusion training contracts - #1743
Open
ethannnnnn wants to merge 1 commit into
Open
[tunix] Add model-agnostic JAX diffusion training contracts#1743ethannnnnn wants to merge 1 commit into
ethannnnnn wants to merge 1 commit into
Conversation
Define a target-aligned, batch-major diffusion batch contract and typed adapter/scorer protocols without depending on MaxText or a specific training algorithm. Validate shapes and dtypes at construction and scoring boundaries, while preserving JAX pytree, JIT, and sharding compatibility. Tests: 10 diffusion contract tests; pyink/isort; pylint; pyrefly; py_compile.
ethannnnnn
requested review from
abheesht17,
hgao327,
jiangyangmu,
lc5211,
s-noghabi,
sizhit2,
tianshub and
wang2yn84
as code owners
July 23, 2026 22:43
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Diffusion training integrations need a stable batch and scoring boundary that does not depend on MaxText, a specific model, or one training algorithm.
Scope
DiffusionTokenBatchwith target-aligned targets and explicit loss weights.Design
Every model-input leaf has the same leading batch axis. Model-specific static configuration lives in the logits-function closure rather than the batch. Targets refer to physical target positions, so same-position and shifted models resolve alignment before constructing the contract.
Construction and scoring boundaries validate array structure and active values. Validation remains trace safe under JIT and sharding; additional finite/range checks run when arrays are eagerly addressable.
Compatibility
These are new model-agnostic JAX modules. Existing SFT, distillation, RL, and autoregressive paths do not construct them and remain unchanged.
Extensibility
MaxText and other integrations can provide different corruption, tokenizer, model, and alignment policies while sharing the same Tunix loss and learner interfaces.
Tests
Known limitations
The contract intentionally does not create corruption, execute a model rollout, choose stop tokens, or prove that a prepared batch is fresh.
Stack
First PR in this repository stack; no preceding PR dependency.
Tunix block-diffusion design document