REVIEW 3 major objections 5 minor 15 references
JPC: Flexible Inference for Predictive Coding Networks in JAX
T0 review · 3 major / 5 minor · reviewed 2026-08-11 · deepseek-v4-flash
Pith's one-line read JPC shows that Heun's method, a second-order Runge-Kutta integrator, runs predictive-coding inference significantly faster than standard Euler integration while maintaining accuracy across datasets and network depths.
desk verdict A useful, clean JAX library for predictive coding, but the headline speedup claim conflates solver order with adaptive step-size control and needs an ablation. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The central object is the gradient-flow inference dynamics of a predictive coding network, $\dot{z}_\ell=-\partial F/\partial z_\ell$ for layer activities $z_\ell$ under the energy $F=\sum_\ell\|z_\ell-f_\ell(W_\ell z_{\ell-1})\|^2$. Euler integration is the usual discretisation of this flow; the paper replaces it with Diffrax's ODE solvers, defaulting to Heun's method (a second-order explicit Runge-Kutta scheme) combined with a PID step-size controller, so the solver adaptively chooses how many inference steps to take. This machinery is what produces the runtime comparison that supports the central claim.
What would settle it
On the same one-epoch classification benchmark, run Euler with the same PID step-size controller and tolerance used for Heun, and compare wall-clock times at matched final test accuracy; the central runtime claim would collapse if Euler with adaptive step control matches or beats Heun.
Extended reading notes
Core claim
On its own terms, the paper establishes a new default for PC inference: instead of performing gradient descent on the energy $F=\sum_\ell\|z_\ell-f_\ell(W_\ell z_{\ell-1})\|^2$ with a fixed Euler step, one can integrate the continuous-time gradient flow $\dot{z}_\ell=-\partial F/\partial z_\ell$ with Diffrax's ODE solvers. Benchmarking one-epoch training on image datasets with 3-, 5-, and 10-hidden-layer feedforward networks, the authors find that Heun's method—a second-order explicit Runge-Kutta solver with a proportional-integral-derivative step-size controller—converges to comparable mean test accuracy in substantially less wall-clock time than Euler, with the advantage growing with network depth. The paper presents this as a library contribution rather than a theoretical proof, and notes that other optimiser-specific hyperparameters could lead to different results.
Load-bearing premise
The load-bearing premise is that the runtime comparison is fair: Euler with a few fixed step sizes and Heun with an adaptive controller are matched by picking the run with the highest mean test accuracy on each hyperparameter grid, so a different matching rule—say equal integration error or equal step count—could change the speedup.
Editorial extensions
If this is right
- Any PCN training loop that currently uses fixed-step Euler inference can switch to a second-order solver and expect faster wall-clock training at similar accuracy, with the largest gains appearing in 10-hidden-layer networks.
- The same ODE-solver interface works across discriminative, generative, and hybrid PC models, so solver improvements carry over to generative and amortised settings without reimplementation.
- The closed-form energy for deep linear PCNs acts as a convergence diagnostic: more inference steps correlate with better test accuracy on MNIST and Fashion-MNIST, offering an empirical stopping criterion.
- Because the library is jitted and under 1000 lines of code, the runtime gains come with a reproducible and extensible codebase, not a black-box implementation.
Reading between the lines
- The runtime comparison pairs fixed-step Euler with adaptively stepped Heun and selects the highest-accuracy run on each grid; my inference, not the paper's, is that an adaptive Euler baseline or a tolerance-matched comparison could narrow the reported speedup.
- If the speedup transfers to generative and hybrid PC models, which the paper does not benchmark for runtime, ODE-solver inference could make predictive coding competitive with backpropagation in wall-clock time on structured tasks.
- The correlation between the closed-form energy and test accuracy points toward an automatic early-stopping rule for inference, an extension the paper leaves implicit.
- The paper's closing suggestion of stochastic differential solvers raises the prospect of combining the library's wrapper with Langevin-type sampling for better generative performance at lower cost, but this is untested.
Signed reviews
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper introduces JPC, a JAX library for training predictive coding networks (PCNs). JPC provides a simple high-level API and an advanced API built on Equinox, Diffrax, and Optax, and claims to be less than 1000 lines of code. The main empirical claim, developed in Section 3, is that using a second-order ODE solver (Heun) to integrate the PC inference gradient flow yields significantly faster wall-clock runtimes than standard Euler integration, with comparable test accuracy across several datasets and network depths. The paper also presents a theoretical tool from prior work (the closed-form energy of deep linear PCNs, Eq. 4) and a demonstration that the theoretical energy can indicate whether enough inference steps have been performed. The library code is publicly available.
Significance. If the runtime claim is substantiated, the contribution is practically useful: PC training is iterative, and a faster inference integrator could make PC more competitive. The library itself is a valuable community resource, being concise, functional, and built on well-maintained JAX libraries. The explicit use of Diffrax ODE solvers and the inclusion of theoretical diagnostics are also useful. However, the central speedup claim is currently supported by an experimental comparison that confounds solver order with adaptive step-size control and lacks essential statistical and reproducibility details. These issues need to be resolved before the paper's headline result can be accepted.
major comments (3)
- [Section 3, Figure 1] The comparison between Euler and Heun does not isolate the effect of solver order. The text states 'Unlike Euler, Heun employed a standard Proportional–Integral–Derivative step size controller.' This means the observed speedup could be entirely due to adaptive step-size selection rather than Heun's second-order accuracy. The authors should provide ablations, such as Euler with the same PID controller, Heun without a controller, or a comparison at matched integration error or matched step counts, before claiming that the second-order solver is faster.
- [Section 3, Figures 3–6] The hyperparameter selection rule, retaining the run with the highest mean test accuracy across dt and T grids, does not ensure that the two solvers operate at comparable inference accuracy or integration error. Heun could reach the same test accuracy with looser tolerances and fewer, less-accurate steps. The paper does not report step counts or integration error, and the runs are only one epoch long. The phrase 'not significantly different' is used without any statistical test. Without this information, the wall-clock comparison is difficult to interpret and may be biased.
- [Section 3, Figure 1 and experimental setup] Essential experimental details are missing: the hardware used, the ODE solver tolerance settings (e.g., rtol/atol for Heun's PID controller), the number of training iterations (only 'one epoch' is stated), and how the wall-clock time was measured (e.g., whether jit compilation time was fully excluded per iteration). The shaded regions in Figure 1 show variation across three initializations, but no confidence interval or statistical test is provided for the runtime difference. For a paper whose central claim is about runtime, these details are necessary for reproducibility and for assessing the magnitude of the reported speedup.
minor comments (5)
- [Figure 2] The caption contains a typo: 'MINST' should be 'MNIST'.
- [References] Reference [13] appears to have a typo: 'Tscshantz' should be 'Tschantz'.
- [Section 3] The caveat at the end of Section 3 acknowledges that optimiser-specific hyperparameters could change results, which is helpful, but it does not address the confound between solver order and adaptive step-size control that affects the main claim.
- [Figures 4–6] The accuracy curves in Figures 3–6 do not include error bars or confidence intervals, making it hard to verify the statement that accuracy differences are 'not significantly different'.
- [Section 4.2] In the code sketch, the variable name 'op t_ st at e' appears to be a typo for 'opt_state'.
Circularity Check
No significant circularity: the runtime speedup is a direct empirical comparison and the borrowed theoretical energy is an independent closed-form result, not a fitted input.
full rationale
The main claimed result — that Heun inference is faster than Euler on PCNs — is an experimental measurement, not a derivation from fitted parameters. The paper sweeps dt and T and selects the run with highest mean test accuracy; this is a benchmark selection rule, not a parameter fitted to the runtime quantity being reported, so it does not make the speedup true by construction. The only self-citation with substantive content is Eq. (4), attributed to the authors' prior work [3]. That expression is a parameter-free closed-form formula for the inference-equilibrium energy of deep linear networks under stated assumptions (identity activations, ∇zF = 0), and the paper reports numerical agreement (Figure 2) rather than defining the energy in terms of the formula. Thus the citation is real mathematical support and not a load-bearing self-citation. The paper's own caveat that hyperparameter choices could change results, and the confound that Heun used a PID step-size controller while Euler did not, weaken the attribution of speed to solver order, but that is an experimental fairness/correctness concern rather than circular reasoning. No equation or claim in the paper reduces to its own inputs by construction, so no circular step is established.
Assumptions & free parameters
free parameters (4)
- Euler step size dt (selected per dataset and depth) =
one of {0.5, 0.1, 0.05}, chosen by highest mean test accuracy (Figs 4-6)
- Euler integration horizon T (number of steps, selected per dataset and depth) =
one of {5, 10, 20, 50, 100, 200, 500}, chosen by highest mean test accuracy
- Heun initial step size dt (selected per dataset and depth) =
one of {0.5, 0.1, 0.05}, chosen by highest mean test accuracy
- Heun integration upper limit T (selected per dataset and depth) =
one of {5, 10, 20, 50, 100, 200, 500}, chosen by highest mean test accuracy
assumptions (4)
- domain assumption The energy function F (Eq. 1), a sum of squared prediction errors, defines the PCN training objective.
- domain assumption Inference is the gradient flow z_dot = -dF/dz, and Euler gradient descent on the energy is its discretization.
- domain assumption The closed-form inference-equilibrium energy for deep linear networks (Eq. 4) from reference [3] is correct and applies to the trained linear networks in Figure 2.
- domain assumption The Diffrax ODE solvers and their default step-size controller produce accurate solutions of the gradient flow at a cost well represented by wall-clock time.
Cite this review
Pith. "Pith review of JPC: Flexible Inference for Predictive Coding Networks in JAX." pith.science (2026). https://pith.science/paper/UVLFEVNU
@misc{pith2026241203676,
author = {Pith},
title = {Pith review of: JPC: Flexible Inference for Predictive Coding Networks in JAX},
year = {2026},
howpublished = {\url{https://pith.science/paper/UVLFEVNU}},
note = {Machine review of arXiv:2412.03676}
}
read the original abstract
We introduce JPC, a JAX library for training neural networks with Predictive Coding. JPC provides a simple, fast and flexible interface to train a variety of PC networks (PCNs) including discriminative, generative and hybrid models. Unlike existing libraries, JPC leverages ordinary differential equation solvers to integrate the gradient flow inference dynamics of PCNs. We find that a second-order solver achieves significantly faster runtimes compared to standard Euler integration, with comparable performance on a range of tasks and network depths. JPC also provides some theoretical tools that can be used to study PCNs. We hope that JPC will facilitate future research of PC. The code is available at https://github.com/thebuckleylab/jpc.
Figures
Reference graph
Works this paper leans on
-
[3]
F. Innocenti, E. M. Achour, R. Singh, and C. L. Buckley. Only strict saddles in the energy landscape of predictive coding networks? arXiv preprint arXiv:2408.11979, 2024
arXiv 2024
-
[1]
C. L. Buckley, C. S. Kim, S. McGregor, and A. K. Seth. The free energy principle for action and perception: A mathematical review. Journal of Mathematical Psychology, 81:55–79, 2017
work page 2017
-
[2]
DeepMind, I. Babuschkin, K. Baumli, A. Bell, S. Bhupatiraju, J. Bruce, P. Buchlovsky, D. Bud- den, T. Cai, A. Clark, I. Danihelka, A. Dedieu, C. Fantacci, J. Godwin, C. Jones, R. Hemsley, T. Hennigan, M. Hessel, S. Hou, S. Kapturowski, T. Keck, I. Kemaev, M. King, M. Kunesch, L. Martens, H. Merzic, V . Mikulik, T. Norman, G. Papamakarios, J. Quan, R. Ring...
work page 2020
-
[4]
P. Kidger. On neural differential equations. arXiv preprint arXiv:2202.02435, 2022. 6
arXiv 2022
-
[5]
P. Kidger and C. Garcia. Equinox: neural networks in jax via callable pytrees and filtered transformations. arXiv preprint arXiv:2111.00254, 2021
arXiv 2021
-
[6]
N. Legrand, L. Weber, P. T. Waade, A. H. M. Daugaard, M. Khodadadi, N. Mikuš, and C. Mathys. pyhgf: A neural network library for predictive coding. arXiv preprint arXiv:2410.09206, 2024
arXiv 2024
-
[7]
B. Millidge, T. Salvatori, Y . Song, R. Bogacz, and T. Lukasiewicz. Predictive coding: towards a future of deep learning beyond backpropagation? arXiv preprint arXiv:2202.09467, 2022
arXiv 2022
-
[8]
B. Millidge, A. Seth, and C. L. Buckley. Predictive coding: a theoretical and experimental review. arXiv preprint arXiv:2107.12979, 2021
arXiv 2021
Show all 15 references
-
[9]
Oliviers, R
G. Oliviers, R. Bogacz, and A. Meulemans. Learning probability distributions of sensory inputs with monte carlo predictive coding. PLOS Computational Biology, 20(10):e1012532, 2024
2024
-
[10]
Pinchetti, C
L. Pinchetti, C. Qi, O. Lokshyn, G. Olivers, C. Emde, M. Tang, A. M’Charrak, S. Frieder, B. Menzat, R. Bogacz, et al. Benchmarking predictive coding networks–made simple. arXiv preprint arXiv:2407.01163, 2024
2024 arXiv
-
[11]
Rosenbaum
R. Rosenbaum. On the relationship between predictive coding and backpropagation. Plos one, 17(3):e0266102, 2022
2022
-
[12]
Salvatori, A
T. Salvatori, A. Mali, C. L. Buckley, T. Lukasiewicz, R. P. Rao, K. Friston, and A. Ororbia. Brain- inspired computational intelligence via predictive coding. arXiv preprint arXiv:2308.07870, 2023
2023
-
[13]
Tscshantz, B
A. Tscshantz, B. Millidge, A. K. Seth, and C. L. Buckley. Hybrid predictive coding: Inferring, fast and slow. PLoS Computational Biology, 19(8):e1011280, 2023
2023
-
[14]
van Zwol, R
B. van Zwol, R. Jefferson, and E. L. Broek. Predictive coding networks and inference learning: Tutorial and survey. arXiv preprint arXiv:2407.04117, 2024
2024
-
[15]
Zahid, Q
U. Zahid, Q. Guo, and Z. Fountas. Sample as you infer: Predictive coding with langevin dynamics. arXiv preprint arXiv:2311.13664, 2023. 7 A Supplementary figures 100 400 700 10 15 20 25 Euler Heun Training iteration Test accuracy (%) Loading [MathJax]/extensions/MathMenu.js 10...
2023 arXiv
Reviewed August 11, 2026 · model on record in the stance chip above.
Discussion (0). Continue with ORCID to comment.