Skip to content

Menu

WorksMathematics

Sequince: a modular sequential Monte Carlo toolkit

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_v2d2zdzk. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Sequential Monte Carlo (SMC) methods approximate sequences of probability distributions using populations of weighted samples and are widely applicable, including in Bayesian inference and particle filtering. We present sequince, a modular Python toolkit for constructing SMC algorithms from reusable and extensible components. The toolkit provides modular steps for weighting, resampling, mutation, transformation, and control operations that are composed to implement different algorithms. It also includes prebuilt samplers for tempered SMC, persistent sampling and nested sampling via SMC. Its core components follow the Python Array API standard, supporting NumPy, JAX, PyTorch, and CuPy, enabling analyses on CPUs or GPUs. Random-number control and checkpointing support reproducible scientific workflows. This paper describes sequince v0.1.0 and its design as reusable infrastructure for methodological research and application of SMC methods.

Sequential Monte Carlo (SMC) methods are a flexible family of algorithms for approximating sequences of probability distributions using a population of weighted samples, known as particles ([4, 7]). Such sequences arise naturally in applications including Bayesian inference and particle filtering, for example through likelihood tempering or observations arriving over time.

sequince ([17]) is a Python toolkit for constructing

Statement of need

Scientific applications often require SMC methods tailored to a particular problem. Researchers may need to combine adaptive tempering, mutation kernels, transformations, stopping rules, or multi-stage procedures, and to define problem-specific sequences of target distributions. When this logic is embedded in application-specific code, it becomes harder to compare methods, reuse components, and move prototype algorithms into stable analysis software.

sequince addresses these needs through a general-purpose, step-oriented framework with interchangeable algorithmic components. Researchers can start from pre-built samplers for common inference problems or construct custom pipelines with explicit control over the operations and their execution order. The same framework therefore supports both established inference methods and methodological research into new SMC variants.

Scientific models are also increasingly implemented using different numerical libraries to exploit automatic differentiation and hardware acceleration. Coupling an SMC implementation to a single array library can restrict its integration with these models. sequince uses the Python Array API standard ([5]) to support reusable core operations across multiple numerical backends, while allowing specialised components to target particular ecosystems.

State of the field

The Python ecosystem already contains several useful SMC-related tools. The particles package accompanying Chopin & Papaspiliopoulos [4] provides implementations of many established SMC and particle-filtering methods and is particularly useful for teaching and methodological prototyping. SMCPy focuses on uncertainty quantification and Bayesian calibration using parallel likelihood-tempering SMC samplers, including fixed and adaptive tempering variants [10]. popmc implements persistent sampling with normalizing flows for posterior inference (Karamanis & Seljak, 2025).

Broader Bayesian software ecosystems also expose SMC functionality. PyMC includes a sequential Monte Carlo sampler within a general probabilistic programming framework [1], while BlackJAX provides composable inference components in the JAX ecosystem and includes SMC methods alongside other Monte Carlo algorithms [3]. Recent domain-specific frameworks such as SHARPy target gravitational-wave inference with JAX-accelerated SMC and gradient-based mutation kernels [8].

sequince combines support for multiple SMC variants, including tempering, persistent sampling [9], nested sampling via SMC (NS-SMC) [11], and waste-free SMC [6], with a modular architecture for constructing bespoke algorithms. Shared interfaces allow users to reconfigure target sequences, transformations, mutation kernels, and control flow, supporting both the comparison of existing methods and the development of new variants. Support for multiple array backends and integrations with different sampling ecosystems further enable these components to be reused across scientific applications and numerical libraries. The need to combine configurable target sequences, independently reusable steps, and multiple array backends within one framework motivated this design. This combination makes sequince useful as research infrastructure for methodological work and as a foundation for application-specific downstream packages.

Software design

sequince separates target distributions, particle populations, and the operations used to evolve them. The following outlines the main design choices; the documentation and runnable examples provide detailed descriptions of the interfaces and their use.

The distributions approximated during an SMC run are represented by target objects. A target evaluates named components of a probability distribution for a population of particles, while sequential targets describe how that distribution changes between stages. Separating the target from the operations that evolve the particles allows weighting and mutation components to be reused across different inference procedures. For example, tempered SMC and nested-sampling SMC use different target sequences while sharing resampling and compatible mutation components.

Target evaluations are stored as particle-aligned collections of named quantities. These can be propagated through resampling and updated during mutation, allowing previously computed quantities to be reused where valid. This is particularly useful for scientific applications in which likelihood evaluations dominate the computational cost. A ParticleState stores the particles, their log weights, accumulated normalising-constant information, and associated target evaluations. Specialised states provide additional information where required, such as the archive of previous populations used by persistent SMC.

An SMC algorithm is expressed as an ordered collection of steps. Each step receives the current particle state, a runtime context, and a random number generator, and returns an updated state, updated context, and structured outputs. Weighting, resampling, mutation, transformation, and control operations can therefore be implemented independently and combined into different algorithms. Higher-level steps can conditionally execute or compose other steps, keeping algorithm-specific control flow outside the runner. For example, waste-free SMC combines resampling with a mutation component that retains intermediate chain states.

A SequentialMonteCarlo runner repeatedly applies the configured steps. The runtime context contains the current iteration and observation, shared user-provided information, metadata used for communication between steps, and stopping controls. The runner accepts an iterable of observations, supporting both static inference problems and procedures in which targets change as new data become available. Separating particle state, runtime context, and algorithm configuration allows the execution machinery to remain common across different SMC constructions.

Each step can return structured outputs containing quantities such as effective sample sizes, tempering parameters, acceptance statistics, and other diagnostics. These outputs and the recorded particle states are collected in an SMCResult for subsequent analysis. New components can therefore introduce diagnostics without requiring changes to the runner or coupling their implementation to plotting and logging code. Callbacks provide logging, plotting, and other monitoring functionality during execution.

The core abstractions follow the Python Array API standard where possible [5], allowing backend-native arrays to pass through the SMC procedure. Random number generation is similarly abstracted through orng [19]. This design supports reuse across numerical libraries while allowing specialised components to depend on a particular ecosystem. Alongside conventional eager execution, sequince provides a functional execution path that passes random state explicitly between steps. Compatible iterations can be compiled using facilities such as jax.jit, provided their operations are traceable and their state structures, shapes, and dtypes remain stable, while the runner manages observations, callbacks, and result recording. Mutation integrations include ecosystem-specific packages such as BlackJAX [3].

Checkpointing is separate from result recording. Checkpoints capture the particle state, runtime progress, random-number state, and mutable step state needed to continue sampling with a reconstructed sampler configuration. Results provide the analysis record of a completed or partially completed run. Both support HDF5 storage, making numerical data and supported metadata available for inspection independently of the running process.

Research impact statement

sequince is being developed as reusable infrastructure for both methodological research and problem-specific inference workflows. Current applications include customised sampling strategies for astrophysical inference problems relevant to ongoing LIGO-Virgo-KAGRA analyses and future observations with the Laser Interferometer Space Antenna (LISA) [18], as well as integration with broader Bayesian inference ecosystems such as bilby [2, 13] via sequince-bilby [15]. The same methodology is also relevant to future ground-based observatories such as the Einstein Telescope (ET) and Cosmic Explorer (CE).

In these applications, the principal benefit of sequince is not a single sampling algorithm but a shared framework in which new sequential inference methods can be implemented, compared, and reused. The package has been used to explore alternative tempering strategies, persistent SMC, specialised mutation schemes, problem-specific transformations, and hardware-accelerated execution. The common result interface also provides a consistent way to record and compare algorithm-specific diagnostics across these different methods.

The modular design of sequince additionally supports downstream packages that add method- or domain-specific functionality without requiring those dependencies in the core library. For example, sequince-density [16] provides density-estimation components based on Gaussian mixture models and normalizing flows. These can be combined with the core SMC machinery for learned preconditioning, proposal construction, and other density-assisted SMC methods, including approaches related to pocomc and aspire [9, 14]. The wider sequince ecosystem also includes sequince-examples, which provides runnable examples demonstrating common workflows and more specialised uses of the package [12], with online documentation.

AI usage disclosure

Generative AI tools, including OpenAI Codex, were used to assist with code implementation and refactoring. ChatGPT was also used to assist with the organisation and editing of the manuscript. Models varied over the course of development and included GPT-5.3, GPT-5.4, GPT-5.6, GPT-6.0, and GPT-6.1; a complete historical record of model versions was not retained. The authors made the core scientific and software design decisions and reviewed, edited, and validated all AI-assisted contributions. The authors retain full responsibility for the software and manuscript.

Acknowledgements

M.J.W. acknowledges partial support from the UKSA’s LISA Ground Segment (UKRI968) and Science and Technology Facilities Council (STFC) grant UKRI2490. C.E.A.-C.B. is supported by UKSA grant UKRI971.

Numerical computations were carried out on the SCIAMA high-performance computing cluster, which is supported by the Institute of Cosmology and Gravitation and the University of Portsmouth. Additional computations were performed using the University of Birmingham’s BlueBEAR High Performance Computing facility.

References

  1. [1]Abril-Pla, O., Andreani, V., Carroll, C., Dong, L., Fonnesbeck, C. J., Kochurov, M., Kumar, R., Lao, J., Luhmann, C. C., Martin, O. A., Osthege, M., Vieira, R., Wiecki, T. V., & Zinkov, R. (2023). PyMC: A modern, and comprehensive probabilistic programming framework in Python. PeerJ Computer Science, 9, e1516. https://doi.org/10.7717/peerj-cs.1516
  2. [2]Ashton, G., Hübner, M., Lasky, P. D., Talbot, C., Ackley, K., Biscoveanu, S., Chu, Q., Divarkala, A., Easter, P. J., Goncharov, B., Hernandez Vivanco, F., Harms, J., Lower, M. E., Meadors, G. D., Melchor, D., Payne, E., Pitkin, M. D., Powell, J., Sarin, N., ... Thrane, E. (2019). Bilby: A user-friendly Bayesian inference library for gravitational-wave astronomy. The Astrophysical Journal Supplement Series, 241(2), 27. https://doi.org/10.3847/1538-4365/ab06fc
  3. [3]Cabezas, A., Corenflos, A., Lao, J., Louf, R., Carnec, A., Chaudh ari, K., Cohn-Gordon, R., Coullon, J., Deng, W., Duffield, S., Durán-Martín, G., Elantkowski, M., Foreman-Mackey, D., Gregori, M., Iguaran, C., Kumar, R., Lysy, M., Murphy, K., Orduz, J. C., ... Zinkov, R. (2024). BlackJAX: Composable Bayesian inference in JAX. arXiv Preprint arXiv:2402.10797. https://arxiv.org/abs/2402.10797
  4. [4]Chopin, N., & Papaspiliopoulos, O. (2020). An introduction to sequential Monte Carlo. Springer. https://doi.org/10.1007/978-3-030-47845-2
  5. [5]Consortium for Python Data API Standards. (2026). Python array API standard. https://data-apis.org/array-api/latest/.
  6. [6]Dau, H.-D., & Chopin, N. (2022). Waste-free sequential Monte Carlo. Journal of the Royal Statistical Society Series B: Statistical Methodology, 84(1), 114–148. https://doi.org/10.1111/rssb.12475
  7. [7]Del Moral, P., Doucet, A., & Jasra, A. (2006). Sequential Monte Carlo samplers. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68(3), 411–436. https://doi.org/10.1111/j.1467-9868.2006.00553.x
  8. [8]Demasi, G., Capurri, G., Lenti, M., Ricciardone, A., Patricelli, B., Frattale Mascioli, A., Piccari, L., Albuquerque, S., Guidi, G. M., Pannarale, F., Stratta, G., & Del Pozzo, W. (2026). The sequential Monte Carlo goes NUTS: Boosting gravitational-wave inference. arXiv Preprint arXiv:2601.02336. https://arxiv.org/abs/2601.02336
  9. [9]Karamanis, M., & Seljak, U. (2025). Persistent sampling: Enhancing the efficiency of sequential Monte Carlo. Statistics and Computing, 35(5), 144. https://doi.org/10.1007/s11222-025-10682-y
  10. [10]NASA Langley Research Center. (2026). SMCPy: Python module for uncertainty quantification using a parallel sequential Monte Carlo sampler. https://github.com/nasa/SMCPy.
  11. [11]Salomone, R., South, L. F., Drovandi, C., Kroese, D. P., & Johansen, A. M. (2025). Unbiased and consistent nested sampling via sequential Monte Carlo. Journal of the Royal Statistical Society Series B: Statistical Methodology, 87(4), 1221–1238. https://doi.org/10.1093/jrsssb/qkaf015
  12. [12]Sequince contributors. (2026). sequince-dev/sequince-examples. https://github.com/sequince-dev/sequince-examples
  13. [13]Talbot, C., Ashton, G., Hübner, M., Pitkin, M., Williams, M. J., plasky, asb5468, Vijaykumar, A., Smith, R., Smorisaki, Veitch, J., Macleod, D., Sarin, N., Williams, D., JasperMartins, MarcArene, Raymond, V., Berry, C. P. L., AlexandreGoettel, ... Wu, S. (2026). bilby-dev/bilby. Zenodo. https://doi.org/10.5281/zenodo.14025463
  14. [14]Williams, M. J. (2026a). Accelerated Sequential Posterior Inference via Reuse for Gravitational-Wave Analyses. Physical Review Letters, 137(2), 021410. https://doi.org/10.1103/5hvn-3lmh
  15. [15]Williams, M. J. (2026b). sequince-dev/sequince-bilby. Zenodo. https://doi.org/10.5281/zenodo.23736054
  16. [16]Williams, M. J. (2026). sequince-dev/sequince-density. Zenodo. https://doi.org/10.5281/zenodo.23687687
  17. [17]Williams, M. J., & Chapman-Bird, C. (2026). sequince-dev/sequince. Zenodo. https://doi.org/10.5281/zenodo.23596103
  18. [18]Williams, M. J., Chapman-Bird, C. E. A., Costa Barroso, R., & Harry, I. (2026). Robust Bayesian inference for massive black hole binaries in LISA with sequential Monte Carlo. Manuscript in preparation (provisional title).
  19. [19]Williams, M. J., & Talbot, C. (2026). sequince-dev/orng. Zenodo. https://doi.org/10.5281/zenodo.17544786

AI tools statement

This work lists 7 AI tools.

  • Codex · AI tool

    Roles
    Software
    Verification
    self-declared at submission
  • GPT (multiple versions) · AI tool

    Roles
    Writing — review & editing
    Verification
    self-declared at submission
  • GPT-5.3 · AI tool

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission
  • GPT-5.4 · AI tool

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission
  • GPT-5.6 · AI tool

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission
  • GPT-6.0 · AI tool

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission
  • GPT-6.1 · AI tool

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission

Recorded on the work at submission, not per version. Names and roles are shown as submitted; roles use the CRediT taxonomy.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Pick where to look, or just type