Many experiments in psychology, linguistics and speech science have a crossed design. Every participant responds to many stimulus items, every item is seen by many participants, and the analysis must allow for both "this person is slow" and "this word is hard" at the same time. Mixed-effects models handle this with two sets of random effects, one per participant and one per item. These are shrunk toward population averages, a property called partial pooling. When the response model is simple and Gaussian, standard software fits these models. When the response comes from a mechanistic process with no convenient likelihood, such as a diffusion decision model with collapsing boundaries or a simulator of reading behavior, researchers have two options. They can drop the item effects, or they can fall back on slow, hand-tuned Markov chain Monte Carlo (MCMC), a sampler that draws posterior samples by a long random walk. Simulation-based inference (SBI) is the obvious remedy: train a neural network on simulated datasets so that it maps data directly to a posterior over parameters. Every existing hierarchical SBI method, however, assumes nested groups, where each observation belongs to exactly one group.
This proposal builds on one structural fact. In a crossed model the joint posterior over participant and item effects does not factorize, but each set of effects does factorize once the other set is held fixed. We propose to learn two amortized conditional posteriors, one for each participant given the item effects and one for each item given the participant effects, and to alternate between them as a learned Gibbs sampler. This sampler is driven by a global network that reads the whole sparse participant-by-item data matrix and respects its two-way permutation symmetry. Because each conditional involves only one row or one column, the local networks can be trained on single-row and single-column simulations. That is the cheap per-group training trick of earlier hierarchical methods, made valid for crossed designs where it otherwise breaks. The second contribution is the first benchmark of crossed random-effects tasks with gold-standard reference posteriors. It is built so that the method is judged by empirical checks rather than by how it is constructed.
Core Claim
Write $\theta$ for the global parameters (fixed effects and the variances of the participant and item effects), $u_i$ for the effect of participant $i$, $v_j$ for the effect of item $j$, and $y_{ij}$ for the observed responses of participant $i$ to item $j$, which may be missing in unbalanced designs. If responses are conditionally independent given $(\theta, u_i, v_j)$, then
$$ p(u \mid v, \theta, y) = \prod_i p(u_i \mid v, \theta, y_{i\cdot}), \qquad p(v \mid u, \theta, y) = \prod_j p(v_j \mid u, \theta, y_{\cdot j}), $$
where $y_{i\cdot}$ is participant $i$'s row of observed responses and $y_{\cdot j}$ is item $j$'s column. This holds for any simulator, not only linear-Gaussian ones. We claim that a sampler built from a global posterior network $q(\theta \mid y)$ and two amortized conditional networks, $q(u_i \mid \theta, v, y_{i\cdot})$ and $q(v_j \mid \theta, u, y_{\cdot j})$, run as alternating Gibbs sweeps, will match MCMC reference posteriors on crossed models where that reference exists. We also claim it stays calibrated on crossed models whose likelihood is intractable. Its simulation cost for the local networks grows with the size of one row or column, not with the full design.
The idea differs from its nearest neighbors in specific ways. Amortized Bayesian Multilevel Models introduces multilevel neural posterior estimation. It pairs a local summary network per group with a global pooling network, and a global inference network with a local one that conditions on it. It recovers Stan-like shrinkage on a hierarchical diffusion decision model, but its local network assumes each observation has exactly one parent group. Tokenised Flow Matching for Hierarchical Simulation Based Inference trains a surrogate on single-site simulations and uses it to generate multi-site training data. It assumes sites are conditionally independent given global parameters and explicitly defers partial-pooling tasks. Compositional amortized inference for large-scale hierarchical Bayesian models sums per-group score estimates with error damping, and it also relies on conditional independence across local units. All three supply method ingredients we reuse: hierarchical summary networks, per-group training, and conditioning local estimates on global ones. All three are blocked by the same assumption. Our conditioning step restores per-group independence inside a crossed model, which is what lets the per-group trick carry over.
Research Program
The global network reads the observed cells of the participant-by-item matrix as a set of triples (participant index, item index, response). It processes them with layers that give the same answer under any reordering of participants and any reordering of items. Each layer updates a cell embedding by combining it with pooled averages over its row, its column and the whole matrix, computed only over observed cells, so unbalanced and sparse designs need no padding. The network produces a dataset embedding that feeds a flow-matching density estimator for $q(\theta \mid y)$. It also produces row and column embeddings that the local networks can reuse. The local networks are small conditional density estimators. The participant network sees one row of responses together with the current values of the item effects on that row. The item network mirrors it on columns.
The two local networks need only one-row or one-column simulations. We draw $\theta$ from the prior, draw item effects for the items that participant saw, draw one participant effect, and simulate that row. This sidesteps the cost of simulating whole multi-group datasets for every training step, which the file identifies as the main limitation of nested multilevel posterior estimation. Only the global network needs full-matrix simulations, and it learns a low-dimensional target.
There is a known risk. Separately learned conditionals need not be compatible with any single joint distribution, so the Gibbs chain may drift. A related problem is that Gibbs mixes slowly when participant and item effects are strongly coupled, which happens in sparse designs with large variances. We will measure both directly. Chains will be started from several initializations, and agreement across chains will be monitored with the standard between-chain diagnostic. As a safeguard, we will test an optional correction that reweights local proposals using a neural likelihood surrogate in the style of Sequential Neural Likelihood, which is exact when the surrogate is exact. The implementation will extend BayesFlow 2.0. That library already provides nested hierarchical summary networks and flow-matching inference networks, but no layers for crossed designs, and the new layers will be released there.
The benchmark answers the empirical-validation direction. Benchmarking Simulation-Based Inference showed that, before shared tasks and the classifier two-sample test (C2ST, in which a classifier tries to tell inferred posterior samples from reference samples, so 0.5 is perfect), SBI claims were not comparable. Every one of its ten tasks is flat, with no group structure. The hierarchical suite in the tokenised flow-matching paper is nested only. We will release four crossed tasks, each at three design sizes (roughly 20×20, 60×80 and 200×300) and at balanced, moderately unbalanced and heavily unbalanced missingness. The first task is a crossed linear-Gaussian model with random intercepts and slopes. The second is a crossed logistic model for accuracy data. The third is a crossed diffusion decision model for choices and reaction times, where Stan can be run, since the multilevel posterior estimation paper used it as reference. The fourth is a crossed diffusion decision model with collapsing boundaries, which has no tractable likelihood. Tasks one to three get reference posteriors from long NUTS runs. NUTS is the No-U-Turn Sampler, the adaptive MCMC method used in Stan. Task four is checked with simulation-based calibration, which tests whether the posterior ranks of true parameters are uniform across many simulated datasets.
Baselines
The naive reference point is the no-item-effects analysis that practitioners use when the likelihood is hard. It fits a subject-only hierarchical model, as Neural superstatistics for Bayesian estimation of dynamic cognitive models does for lexical decision data, where words are treated as interchangeable. We run it on the same simulated data. We report how much it inflates confidence in fixed effects, measured by interval coverage of the true fixed effect. Beating it means coverage near nominal where it falls short. It is a reference point rather than a competitor.
The strongest existing method on posterior accuracy is NUTS in Stan, run on tasks one to three with four chains, long warmup and convergence checks. We will report its wall-clock time and, for every competing method, the number of datasets needed before amortized training pays for itself. On flat tasks the best reported figure is a C2ST of 0.5 on Two Moons at $10^5$ simulations for sequential neural methods (Benchmarking Simulation-Based Inference). For nested amortized multilevel inference, Stan took about 8 seconds per run against under a millisecond after roughly one hour of training, with posteriors described as nearly identical (Amortized Bayesian Multilevel Models). We found no reported result on Lacuna for any SBI method on crossed random effects. Beating NUTS therefore means two things. On accuracy, the method must reach C2ST at or below 0.55 on global parameters and on randomly chosen local effects. On cost, it must reach a lower total time once the workflow needs about a hundred refits, as simulation-based calibration, leave-one-participant-out validation or power analysis do.
The strongest neural competitor is a token transformer over the observed cells with learned participant and item group embeddings, trained jointly over all parameters with flow matching. This is the architecture of Tokenised Flow Matching for Hierarchical Simulation Based Inference, extended by giving each cell two group embeddings instead of one. A second neural competitor is nested multilevel posterior estimation with participants as groups and item identity passed in as an input feature. Both get the same simulation budget, counted in simulated cells, the same GPU-hour budget, and the same hyperparameter search of twenty trials.
Two ablations isolate our key ingredients. In the first, a single joint flow over all local effects replaces the amortized Gibbs sampler, which tests whether the factorized conditionals matter. In the second, participant and item effects are drawn independently given $\theta$, a mean-field shortcut, which tests whether alternating between the two factors matters. Sampling item and participant effects independently should miss their posterior correlation in sparse designs. We will check this by comparing the posterior correlation of $u_i$ and $v_j$ against NUTS.
Why not just…?
Why not just run lme4 or Stan? For a single crossed linear-Gaussian fit this is the right answer, and we expect NUTS to win outright there. Its weakness is twofold. Repeated-fit workflows are slow; NUTS needed about nine hours on a 64-core cluster for a 128×128 hierarchical grid in Compositional amortized inference for large-scale hierarchical Bayesian models. And the crossed collapsing-boundary diffusion model cannot be written in Stan at all. The break-even analysis on tasks one to three will report the number of refits at which amortization starts to pay. If that number exceeds the refits a realistic workflow needs, we will say so and narrow the claim to intractable crossed models.
Why not just use the exact crossed covariance inverse? On the inverse of covariance matrices for unbalanced crossed designs inverts the dense covariance matrix of unbalanced two-way crossed linear-Gaussian designs. It combines a Khatri–Rao product construction with recursive rank-one updates, but it was validated only on matrix residuals. We will implement it as a likelihood engine for task one and test it in actual downstream inference. That gives this paper the downstream evaluation it lacked and gives us a fast, exact reference. It does not compete on tasks two to four, which are non-Gaussian. If our method underperforms it on task one, that result will be reported as is.
Why not just add a second group embedding to a token transformer? This is the most serious threat, because it requires no new theory. Our expectation that it will fall short has two grounds. Joint flow matching over hundreds of local effects must learn the coupling between participant and item effects from full-matrix simulations. And attention over all observed cells grows quadratically, which the tokenised flow-matching paper notes already limits it beyond about 100 sites. The head-to-head comparison at the 200×300 design size, under equal cell budgets, settles this question. If the transformer matches us on C2ST and calibration at all sizes, the simpler architecture should be preferred, and our contribution reduces to the benchmark.
Why not just use rejection or sequential Monte Carlo approximate Bayesian computation? These methods keep a parameter draw only if its simulated data land close to the observed data under hand-chosen summary statistics. With hundreds of random effects, matching within tolerance becomes hopeless. Even on low-dimensional flat tasks, Benchmarking Simulation-Based Inference found rejection-based approximate Bayesian computation far behind neural methods. We include it only at the 20×20 design size, as a sanity floor.
Decisive Experiments
The first decisive check is accuracy against NUTS on tasks one to three, swept across design size and degree of imbalance. We report C2ST for global parameters, C2ST for local effects, the correlation between our posterior means for item and participant effects and those from NUTS, and the ratio of our posterior standard deviations to NUTS's as a measure of shrinkage fidelity. The claim fails if heavily unbalanced designs push global C2ST above 0.6 while the token-transformer baseline stays below it.
The second check is calibration on the intractable task four, using simulation-based calibration over 1,000 simulated datasets, together with the multi-chain agreement diagnostic for the learned Gibbs sampler. This experiment directly tests whether the conditionals are compatible.
The third check is simulation efficiency. We plot accuracy against the total number of simulated cells and expect the per-row training of the local networks to reach a given C2ST with an order of magnitude fewer cells than full-matrix training at the largest design size. Our basis is that full-matrix training pays for every cell in a design for each sample, while row training pays for one row.
The final check is on real data. We apply the crossed diffusion decision model to the lexical decision data analyzed in Neural superstatistics for Bayesian estimation of dynamic cognitive models, and a crossed reading-time model to the self-paced reading passages of Text difficulty modulates the surprisal effect in self-paced reading. The latter reported an RNNG difficulty-by-surprisal interaction of β = 2.27, p = 0.036 with a linear mixed model. The question is whether modeling item effects inside a mechanistic model changes these substantive conclusions. Posterior predictive checks and leave-one-participant-out validation, which amortization makes cheap, will be the evidence.
References
- Amortized Bayesian Multilevel Models
- Tokenised Flow Matching for Hierarchical Simulation Based Inference
- Compositional amortized inference for large-scale hierarchical Bayesian models
- Sequential Neural Likelihood: Fast Likelihood-free Inference with Autoregressive Flows
- BayesFlow 2.0: Multi-Backend Amortized Bayesian Inference in Python
- Benchmarking Simulation-Based Inference
- Neural superstatistics for Bayesian estimation of dynamic cognitive models
- On the inverse of covariance matrices for unbalanced crossed designs
- Text difficulty modulates the surprisal effect in self-paced reading