OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

Spin Model Transformers

Spin Model Transformers is a Python library of transformer modules based on mean-field dynamics of vector-spin models, with a JAX example for constructing and applying a SpinTransformer.

Independent OpenViST project profile, based on linked sources.

Spin Model Transformers — OpenViST project profile in AI Models.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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.

Source-based practical guide

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

  1. From the repository directory, run the command below.

    Documented command
    pip install -e .[dev]
  2. Run pre-commit install.

  3. 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.
Source-based practical guide

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-transformers package
  • JAX

Steps

  1. Import jax and SpinTransformer.

  2. Create a JAX PRNG key and split it into input and module keys.

  3. Generate input with shape (1, 256, 512) using jax.random.normal.

  4. Construct SpinTransformer(depth=6, dim=512, num_heads=1, beta=1.0, key=mod_key).

  5. 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.
Evidence and transparency

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