Practical overview
When it fits
Use it when an experiment calls for a JAX transformer module grounded in vector-spin model dynamics, or when exploring associative-memory and Hopfield-style neural-network ideas.
Who it is for
- Researchers exploring physics-inspired transformer architectures.
- JAX developers prototyping attention modules or associative-memory experiments.
Documented uses
- Construct a SpinTransformer with selected depth, dimension, number of heads and beta.
- Apply the transformer to input data using JAX vectorization.
- Prototype and explore transformer designs based on vector-spin and mean-field dynamics.
Requirements & limits
The repository is public and identifies its license as Apache-2.0.
- The documented implementation uses Python and JAX.
- The README provides both development setup commands and a concrete model-construction and application example.
- The example uses a randomly generated input and does not present benchmark comparisons.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install the development package and run pre-commit
Set up the repository's documented development dependencies and run its pre-commit checks.
Before you start
- Python and pip
- A local checkout of the repository
Steps
From the repository directory, run the command below.
pip install -e .[dev]Run
pre-commit install.Run
pre-commit run --all-files.
Expected outcome
The development extra is installed, pre-commit is installed for the checkout, and the documented all-files pre-commit command is run.
Guide limitations
- The README documents the setup and commands but does not specify the checks' results.
Construct and apply a SpinTransformer to JAX input
Follow the README example to apply a configured SpinTransformer to a randomly generated input.
Before you start
- The
spin-model-transformerspackage - JAX
Steps
Import
jaxandSpinTransformer.Create a JAX PRNG key and split it into input and module keys.
Generate input with shape
(1, 256, 512)usingjax.random.normal.Construct
SpinTransformer(depth=6, dim=512, num_heads=1, beta=1.0, key=mod_key).Apply it with
jax.vmap(transformer)(x).
Expected outcome
The example assigns the vectorized result to `out` and indicates an output shape of `(1, 256, 512)`.
Guide limitations
- The README example illustrates this configuration and does not provide benchmark or comparative results.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 17 October 2026
- Original website title
- mcbal/spin-model-transformers · Official homepage title · retained in its source language

