CogFormer: Learn All Your Models Once
Organizations: Center for Modeling, Simulation, and Imaging in Medicine (CeMSIM), Rensselaer Polytechnic Institute, Troy, New York, United States · Center for Economic Psychology, University of Basel, Basel, Switzerland · Amsterdam Mathematical Psychology Lab, University of Amsterdam , Amsterdam, Netherlands
Abstract
Simulation-based inference (SBI) with neural networks has accelerated and transformed cognitive modeling workflows. SBI enables modelers to fit complex models that were previously difficult or impossible to estimate, while also allowing rapid estimation across large numbers of datasets. However, the utility of SBI for iterating over varying modeling assumptions remains limited: changes to parameterizations, generative functions, priors, and design variables all necessitate model retraining, thereby diminishing the benefits of amortization. To address these issues, we pilot the CogFormer, a meta-amortized framework for cognitive modeling. Our framework trains a transformer-based architecture that remains valid across a combinatorial number of structurally similar models, allowing for changing data types, parameters, design matrices, and sample sizes. We present promising quantitative results across families of decision-making models for binary, multi-alternative, and continuous responses. Our evaluation suggests that CogFormer can accurately estimate parameters across model families with minimal amortization offset, making it a potentially powerful engine that catalyzes cognitive modeling workflows.
Figures & tables
| Model | Method | NRMSE ( ) | Cal. Error ( ) | Post. Contr. ( ) |
|---|---|---|---|---|
| DDM | Baseline | |||
| CogFormer - | ||||
| CogFormer - | ||||
| RDM | Baseline | |||
| CogFormer - | ||||
| CogFormer - |
| Comparison | DDM | RDM | CDM |
|---|---|---|---|
| CogFormer - vs. Baseline | |||
| CogFormer - vs. CogFormer - |
Appendix figures & tables62 assets
Supplementary material from the paper’s appendix.
Appendix
| Category | Symbol | Meaning |
|---|---|---|
| Amortization scopes | Model class (root; e.g. sequential sampling models) | |
| Model family (shared computational structure) | ||
| Model instance / observation model (fully specified) | ||
| Design configuration over the intrinsic parameters | ||
| Generative objects | Intrinsic parameters of family | |
| Coefficient matrix, (inference target) |
| Hyperparameter | CogFormer- | CogFormer- |
|---|---|---|
| Layers | ||
| Encoder layers | 8 | 8 |
| Decoder layers | 8 | 8 |
| Attention | ||
| Heads (encoder & decoder) | 8 | 8 |
| Projection dim | 256 | 256 |
| Configuration | Model | Intercept ( ) | Slope ( ) | Slope ( ) | Interaction ( ) |
|---|---|---|---|---|---|
| Intercept Only | DDM | ||||
| RDM | |||||
| CDM | |||||
| Fixed Variability | DDM | ||||
| RDM | |||||
| CDM |
| Variant | Component Role |
|---|---|
| No SAB | Self-attention across parameter tokens; allows parameters to coordinate with one another during the denoising pass. |
| No MAB | Cross-attention from parameter tokens to the encoder summary; the primary pathway through which the decoder reads the observed data. |
| Baseline | Feature-wise linear modulation (FiLM) of the output projection, conditioned on the current diffusion timestep; scales and shifts the final representation before predicting velocity. |
| No FE | Learnable Fourier embedding (FE) of the diffusion timestep; projects the scalar into a high-dimensional frequency space before concatenation. |
| With FiLM | Feature-wise linear modulation (FiLM) of the output projection, conditioned on the current diffusion timestep; scales and shifts the final representation before predicting velocity. |
| Condition | Variant | NRMSE | Cal. Error | Contraction |
|---|---|---|---|---|
| Fixed ( ) | Baseline | 0.055 | 0.021 | 0.966 |
| No SAB | 0.058 | 0.039 | 0.944 | |
| No MAB | 0.255 | 0.017 | 0.037 | |
| No FE | 0.053 | 0.023 | 0.965 | |
| With FiLM | 0.058 | 0.017 | 0.966 | |
| Intercept Only ( ) | Baseline | 0.087 | 0.022 | 0.845 |
| Design | Condition | NRMSE | Cal. Error | Contraction |
|---|---|---|---|---|
| Intercept Only | Without Embedding | 0.104 (+0.005) | 0.033 (-0.009) | 0.794 (-0.033) |
| With Embedding | 0.099 | 0.042 | 0.827 | |
| Fixed | Without Embedding | 0.068 (+0.008) | 0.044 (-0.019) | 0.947 (-0.006) |
| With Embedding | 0.060 | 0.063 | 0.954 | |
| Regressed | Without Embedding | 0.082 (-0.002) | 0.031 (+0.000) | 0.884 (-0.002) |
| With Embedding | 0.084 | 0.031 | 0.886 |
| S (2L, 2H) | M (4L, 4H) | L (8L, 8H; baseline) | XL (16L, 16H) | |
|---|---|---|---|---|
| NRMSE | 0.179 | 0.170 | 0.124 | 0.127 |
| Cal. Error | 0.024 | 0.032 | 0.022 | 0.045 |
| Post. Contr. | 0.472 | 0.566 | 0.746 | 0.701 |
| Coupling Flow | Diffusion Model | Flow Matching | Consistency Model | |
|---|---|---|---|---|
| NRMSE | 0.128 | 0.131 | 0.117 | 0.129 |
| Cal. Error | 0.020 | 0.025 | 0.017 | 0.067 |
| Post. Contr. | 0.793 | 0.746 | 0.820 | 0.706 |
| Frameworks | Figures | Color Scheme |
|---|---|---|
| Baseline | 15-19 (DDM) / 30-34 (RDM) / 45-49 (CDM) | Green |
| CogFormer- | 20-24 (RDM) / 35-39 (CDM) / 50-54 (DDM) | Red |
| CogFormer- | 25-29 (RDM) / 40-44 (CDM) / 55-59 (DDM) | Blue |
Amortized Inference
Amortized inference uses trained models to turn repeated probabilistic inference problems into fast predictions or posterior samples.
See all 85 papers