# Endpoint-Jacobian diffusion backpropagation

- ID: 1074
- Canonical URL: https://synthcore.org/idea/1074/endpoint-jacobian-diffusion-backpropagation
- API JSON: https://synthcore.org/api/idea/1074.json
- API Markdown: https://synthcore.org/api/idea/1074.md
- Verification status: failed_benchmark
- Source: [arXiv:2607.17572](https://arxiv.org/abs/2607.17572)
- Category: training
- Solves: speedup, memory, scalability
- ML areas: diffusion, diffusion-sampling, training, optimizer
- Math tags: dynamical-systems, approximation-theory, linear-algebra
- Ratings: usefulness 8/10; difficulty 6/10; novelty 7/10

## Idea description

Group W consecutive diffusion or flow-model loss terms and approximate every intermediate parameter Jacobian by a time-weighted interpolation of the Jacobians at the group’s two endpoints. Sum the intermediate upstream signals into two endpoint cotangents, then perform only two full DiT backward passes instead of W. Add a cosine-similarity gate comparing predicted and actual intermediate velocity changes so that groups violating the local-linearity assumption use exact backpropagation.

## Mathematical statement

The paper uses the rectified-flow interpolation \(\mathbf{z}_{t}=(1-t)\mathbf{x}+t\boldsymbol{\epsilon}\) with constant target velocity \(\mathbf{u}=\boldsymbol{\epsilon}-\mathbf{x}\), and reverse ODE steps \(\mathbf{z}_{s}=\mathbf{z}_{t}+\hat{\mathbf{u}}\cdot(s-t)\). For a neural velocity prediction \(\mathbf{v}_{\theta}(\mathbf{z}_{t},t)\), let \(J_t=\partial \mathbf{v}_{\theta}(\mathbf{z}_{t},t)/\partial\theta\) be its output-by-parameter Jacobian and let \(\mathbf{g}_t=\partial \mathcal{L}/\partial\mathbf{v}_{\theta}(\mathbf{z}_{t},t)\) be the upstream gradient of the group objective. For a group with endpoint times \(t_a<t_b\) and intermediate time \(t\), define \(\lambda_t=(t-t_a)/(t_b-t_a)\). The transferable approximation is \(J_t\approx(1-\lambda_t)J_{t_a}+\lambda_tJ_{t_b}\), which gives \(\sum_tJ_t^{\mathsf T}\mathbf{g}_t\approx J_{t_a}^{\mathsf T}\mathbf{G}_a+J_{t_b}^{\mathsf T}\mathbf{G}_b\), where \(\mathbf{G}_a=\sum_t(1-\lambda_t)\mathbf{g}_t\) and \(\mathbf{G}_b=\sum_t\lambda_t\mathbf{g}_t\). The approximation is exact whenever the model velocity is affine in the relevant trajectory variables \((\mathbf{z},t)\), because its Jacobian varies affinely along the linear flow path. Use the cosine gate \(c_t=\cos(\mathbf{v}_t,\hat{\mathbf{v}}_t)\), with \(\hat{\mathbf{v}}_t=(1-\lambda_t)\mathbf{v}_{t_a}+\lambda_t\mathbf{v}_{t_b}\), and apply JAGG only if the minimum or average \(c_t\) over the group exceeds a threshold \(\tau\).

## Key formulas

- $$\mathbf{z}_{t}=(1-t)\mathbf{x}+t\boldsymbol{\epsilon},\qquad \mathbf{u}=\boldsymbol{\epsilon}-\mathbf{x}.$$
- $$\mathbf{z}_{s}=\mathbf{z}_{t}+\hat{\mathbf{u}}\cdot(s-t).$$
- $$J_t\equiv\frac{\partial\mathbf{v}_{\theta}(\mathbf{z}_t,t)}{\partial\theta}\approx(1-\lambda_t)J_{t_a}+\lambda_tJ_{t_b},\qquad \lambda_t=\frac{t-t_a}{t_b-t_a}.$$
- $$\sum_{t\in\mathcal{G}}J_t^{\mathsf T}\mathbf{g}_t\approx J_{t_a}^{\mathsf T}\underbrace{\sum_{t\in\mathcal{G}}(1-\lambda_t)\mathbf{g}_t}_{\mathbf{G}_a}+J_{t_b}^{\mathsf T}\underbrace{\sum_{t\in\mathcal{G}}\lambda_t\mathbf{g}_t}_{\mathbf{G}_b}.$$

## Implementation notes

Integrate this at the backward stage of a diffusion-policy or GRPO training loop, specifically around the DiT velocity or noise-prediction output. First sample a complete trajectory and compute all W per-timestep scalar losses and their upstream output gradients without retaining full backward graphs. For each group \(\mathcal{G}=\{t_a,\ldots,t_b\}\), run the model at every timestep under detached-forward mode, retaining only endpoint autograd graphs and the predicted outputs \(\mathbf{v}_t\). For each timestep calculate \(\lambda_t=(t-t_a)/(t_b-t_a)\), obtain \(\mathbf{g}_t=\partial\mathcal{L}_t/\partial\mathbf{v}_t\) from the GRPO ratio and reward loss, and accumulate \(\mathbf{G}_a{+}{=}(1-\lambda_t)\mathbf{g}_t\) and \(\mathbf{G}_b{+}{=}\lambda_t\mathbf{g}_t\). Check the gate using \(\hat{\mathbf{v}}_t=(1-\lambda_t)\mathbf{v}_{t_a}+\lambda_t\mathbf{v}_{t_b}\) and \(c_t=\langle\mathbf{v}_t,\hat{\mathbf{v}}_t\rangle/(\|\mathbf{v}_t\|\|\hat{\mathbf{v}}_t\|+10^{-8})\). Detach gate computations so they do not affect optimization. If \(\min_t c_t\geq\tau\), invoke reverse-mode differentiation on the endpoint outputs with upstream gradients \(\mathbf{G}_a\) and \(\mathbf{G}_b\), accumulating both into the same parameter-gradient buffer; otherwise execute ordinary per-timestep backward passes. Use \(\tau\) initially at 0.995 and group sizes W in {2, 4, 8}. In the first cheap experiment, use a 300M-parameter flow transformer on CIFAR-10 or ImageNet-64 with a reward-weighted policy-gradient objective. Compare exact GRPO backpropagation with JAGG at identical batch size, optimizer, and forward trajectory. Measure backward wall-clock time, peak memory, reward or FID, loss, and cosine similarity between approximate and exact parameter gradients on the same minibatch. Success means at least 1.5x end-to-end backward speedup for W=4, substantial reduction in retained activation memory, under 1% relative reward or FID degradation, and high gradient agreement. Sweep \(\tau\) to establish the speed-quality frontier and verify that fallback prevents degradation on nonlinear trajectories.

## Verification

- Status: failed_benchmark
- Mechanism evidence: yes
- Mechanism confirmed: no
- Practical verdict: harms
- Verdict: Built and numerically verified endpoint-Jacobian aggregation for a rectified-flow toy velocity network. The mechanism manifested: affine velocity gave near-zero relative gradient error (<9e-8), nonlinear interpolation error scaled approximately quadratically with trajectory span (log-log slope 1.92 versus predicted 2), and cosine similarity degraded as span increased. A small CUDA benchmark showed 2.58x backward-only speedup for W=4, but this is not evidence of a production DiT or end-to-end training win.

### Mechanism check

- Verdict: Built and numerically verified endpoint-Jacobian aggregation for a rectified-flow toy velocity network. The mechanism manifested: affine velocity gave near-zero relative gradient error (<9e-8), nonlinear interpolation error scaled approximately quadratically with trajectory span (log-log slope 1.92 versus predicted 2), and cosine similarity degraded as span increased. A small CUDA benchmark showed 2.58x backward-only speedup for W=4, but this is not evidence of a production DiT or end-to-end training win.
- Confidence: 8/10
- Limitations: Only a tiny MLP and synthetic batch-size-32 rectified-flow objective were tested, not a DiT, CIFAR/ImageNet, GRPO or reward training, FID, peak activation memory, end-to-end wall time, or a full adaptive fallback training loop. The timing isolates backward work and uses an idealized endpoint-cotangent construction.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.0081
- Paired wins: 0/8
- Benchmark verdict: idea worse (significant)

## Artifacts

- [bench_report.json](https://synthcore.org/code/192/bench_report.json)
- [experiment.py](https://synthcore.org/code/192/experiment.py)
- [jagg_bench.py](https://synthcore.org/code/192/jagg_bench.py)
- [report.md](https://synthcore.org/code/192/report.md)
- [report_bench_2026-08-30T194834.md](https://synthcore.org/code/192/report_bench_2026-08-30T194834.md)
- [results.json](https://synthcore.org/code/192/results.json)
- [Download all files as ZIP](https://synthcore.org/download/192)

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
