Skip to content

fix(likelihoods): align racing_diffusion_3 parameter order with ssm-simulators - #1371

Merged
AlexanderFengler merged 1 commit into
lnccbrown:mainfrom
AxelNoun:1370-rdm3-param-order
Oct 13, 2026
Merged

AlexanderFengler merged 1 commit into
lnccbrown:mainfrom
AxelNoun:1370-rdm3-param-order

Conversation

@AxelNoun

@AxelNoun AxelNoun commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1370

  • Why: racing_diffusion_3 declared list_params as A, b, v0, v1, v2, t, while ssm-simulators reads theta as v0, v1, v2, A, b, t. Fitting was unaffected, but every prior and posterior predictive draw was simulated from permuted parameters, without any error (details in racing_diffusion_3: prior and posterior predictive draws use permuted parameters #1370).
  • rdm3_params and the logp_rdm3 signature now follow the registry order. They change together because the likelihood is called as loglik(data, *dist_params); rdm3_bounds is keyed by name and unchanged.
  • The racing_diffusion_3 row of docs/reference/models-and-likelihoods.md is updated, as test_builtin_model_matrix_matches_defaults requires.
  • New tests/unit/modelconfig/test_param_order_matches_simulator.py checks that list_params and choices equal the ssm-simulators registry for the 21 (model, likelihood kind) pairs that have a simulator, that the 7 named Python likelihoods declare their arguments in list_params order, and that RDM3 draws from the distribution's RV match hssm.simulate_data at the same named parameters (tolerances of at least four Monte Carlo standard errors). Two of the three tests fail on main; reordering only rdm3_params makes the signature test fail.
  • Inference is unchanged: the compiled joint log density at three named points agrees with main to one float64 ulp, and a model saved with save_model on main reloads with the same log density.
  • sample_prior_predictive (10,000 samples, Normal(theta, 1e-3) priors) now gives P(choice) = [0.7119, 0.1473, 0.1408], against [0.7069, 0.1465, 0.1465] from the integrated likelihood and [0.2644, 0.3495, 0.3861] on main. Its RT quantiles 0.1 to 0.9 lie 4.9 to 15.3 ms above the likelihood's, mostly the simulator's Euler bias at delta_t = 0.001 (4.5 to 8.5 ms when the simulator is called directly); the rest is within two Monte Carlo standard errors.
  • Existing tests: the same failures on main and on this branch, none involving RDM3 (fast suite, plus the RDM, likelihood, model-config and docs-reference modules with their slow tests; Windows 11, Python 3.12, ssm-simulators 0.15.0, not run on Linux). ruff, mypy and pyrefly report nothing.
  • Breaks only positional calls to logp_rdm3 (not exported from hssm.likelihoods) and a user model_config that pins the old list_params. Predictive checks of RDM3 models run with 0.3.0 or later are worth repeating.

I used an AI assistant (Claude Code) to investigate the bug, run the reproductions and measurements, write the fix and its tests, and draft this description.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected the RDM3 parameter order used by likelihood calculations and predictive sampling, aligning results with the simulator.
  • Tests

    • Added checks for parameter and choice ordering, plus a comparison of RDM3 predictive results with simulated data.

…cbrown#1370)

rdm3_params and the logp_rdm3 signature declared A, b, v0, v1, v2, t,
while ssm-simulators registers racing_diffusion_3 as v0, v1, v2, A, b, t.
HSSM passes parameters by position to both the likelihood and the
simulator random variable, so fitting was unaffected but prior and
posterior predictive draws used permuted parameters.

Reorder both, update the models-and-likelihoods table, and add tests
that compare list_params and choices with the ssm-simulators registry
for every supported model, check that named Python likelihoods follow
list_params, and compare RDM3 draws with simulate_data.

Closes lnccbrown#1370

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f391d7b1-35f8-4fce-bab5-676a90fc9427

📥 Commits

Reviewing files that changed from the base of the PR and between 0b54fb3 and e6bdf23.


📒 Files selected for processing (3)
  • docs/reference/models-and-likelihoods.md
  • src/hssm/likelihoods/analytical.py
  • tests/unit/modelconfig/test_param_order_matches_simulator.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.



📝 Walkthrough

Walkthrough

RDM3 parameters now follow the simulator registry order in the likelihood and model configuration. New tests check model parameter and choice orders, likelihood signatures, and predictive draws against simulator output.

Changes

RDM3 parameter order

Layer / File(s) Summary
Align RDM3 parameter order
src/hssm/likelihoods/analytical.py, docs/reference/models-and-likelihoods.md
The RDM3 parameter list and logp_rdm3 signature now use simulator registry order. The reference catalog shows the same order.
Test parameter order and predictive draws
tests/unit/modelconfig/test_param_order_matches_simulator.py
New tests compare supported model parameters and choices with the simulator registry, check named Python likelihood signatures, and compare seeded RDM3 predictive draws with simulator output.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: alexanderfengler


Merge Risk: ⚪ Minimal · up to e6bdf

This change aligns racing_diffusion_3 parameter order with the simulator registry so predictive draws use the intended named parameters. Positional calls to logp_rdm3 or configurations pinning the old order will break, which the PR acknowledges. No merge-blocking risk was identified.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: aligning the racing_diffusion_3 likelihood parameter order with the ssm-simulators registry.
Linked Issues check Passed The PR meets the coding requirements in #1370. rdm3_params now uses v0, v1, v2, A, b, t, and logp_rdm3 uses the same positional order. The model reference row matches this order. The new tests c…
Out of Scope Changes check Passed The changes stay within #1370. The source change fixes the parameter-order mismatch. The documentation update records the new declared order. The tests verify registry alignment, likelihood argument o…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1 …

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AlexanderFengler

Copy link
Copy Markdown
Member

Thanks for the contribution @AxelNoun.
Looks good, and thanks for catching the issue.
Will prioritize merging this.

@AxelNoun

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution @AxelNoun.

Looks good, and thanks for catching the issue.

Will prioritize merging this.

Perfect! Let me know if you need me (for that or for other things!) Thank you!

@AlexanderFengler
AlexanderFengler merged commit 7d53cb9 into lnccbrown:main Oct 13, 2026
9 of 10 checks passed
@AxelNoun
AxelNoun deleted the 1370-rdm3-param-order branch October 19, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

racing_diffusion_3: prior and posterior predictive draws use permuted parameters

2 participants