Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

torchtsetlin

Latest version: v0.8.2

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
PyPI package Publisher: vlbthambawita
3 Stars
0 Forks
15 Versions
814 Downloads
Python Repo language

Scan summary

torchtsetlin was last scanned on 29 Nov 2026 at version 0.8.2. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 15 versions; the latest 4 were published within 7 days (23–29 Nov 2026).
  • Findings: No rules fired in version 0.8.2.
  • Downloads: 814 downloads.

Versions

15 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.8.2 LATEST 29 Nov 2026 No rules fired
0.8.1 29 Nov 2026 No rules fired
0.8.0 29 Nov 2026 No rules fired
0.7.4 23 Nov 2026 Not shown
0.7.3 20 Nov 2026 Not shown

No rules fired in 0.8.2

Findings

Findings for v0.8.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.8.2; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

torchtsetlin: Fast, Interpretable Tsetlin Machines for PyTorch

Models, data preparation, training, evaluation, interpretation and visualisation in one package, GPU-enabled and PyTorch-native.

PyPI Python CI docs license

A Tsetlin machine learns propositional rules (IF x0 AND NOT x1 THEN class 1) with teams of learning automata instead of gradients. torchtsetlin implements the family as ordinary torch.nn.Modules: the automata live in tensors, so a model moves between CPU and GPU with .to(device), is saved with state_dict(), and learns from mini-batches with a single model.update(x, y) call.

import torchtsetlin as tt

x_train, y_train = tt.data.make_noisy_xor(5000, noise=0.4)          # Boolean features, int labels
x_test, y_test = tt.data.make_noisy_xor(2000, noise=0.0, seed=1)

model = tt.TsetlinMachine(n_features=12, n_classes=2, n_clauses=20, T=15, s=3.9).to("cuda")

# PyTorch-style loop: update() is the analogue of loss.backward(); optimizer.step()
for epoch in range(50):
    model.train()
    for i in range(0, 5000, 10):
        model.update(x_train[i:i+10].cuda(), y_train[i:i+10].cuda())
    model.eval()
    acc = (model(x_test.cuda()).argmax(1) == y_test.cuda()).float().mean()

print(model.rules()[:2])   # ['IF x0 AND NOT x1 THEN 1', 'IF x1 AND NOT x0 THEN 1']

Or with the built-in trainer:

trainer = tt.Trainer(model, batch_size=10, callbacks=[tt.EarlyStopping(patience=20)])
trainer.fit((x_train, y_train), epochs=100, val_data=(x_test, y_test))
trainer.evaluate((x_test, y_test))          # {'accuracy': 0.99}

Features

Models TsetlinMachine (multi-class, optional integer clause weights), FuzzyTsetlinMachine (fuzzy-pattern clauses: a few clauses per class instead of thousands), CoalescedTsetlinMachine (shared clauses; multi-class or multi-label), RegressionTsetlinMachine, ConvTsetlinMachine / Conv1dTsetlinMachine / Conv3dTsetlinMachine (volumes) and convolutional coalesced / regression variants, SegmentationTsetlinMachine / CoalescedSegmentationTsetlinMachine for dense per-pixel prediction
Learning vote margin T, specificity s, memory depth, boosted true-positive feedback, clause-size constraint, drop-clause / drop-literal, focused negative sampling, batched (GPU-friendly) or exact sequential feedback
Data thermometer, one-hot, bit-plane, adaptive-threshold, colour-thermometer, hypervector and multi-scale pyramid encoders; synthetic datasets (including segmentation scenes and 3D volumes); torchvision helpers for classification and segmentation
Training Trainer for tensors / Dataset / DataLoader, callbacks (early stopping, checkpoints, CSV logs, hyper-parameter schedules), History
Evaluation accuracy, confusion matrix, precision/recall/F1, regression and multi-label metrics, IoU / Dice / pixel accuracy / boundary-F1 for segmentation, calibration, trustworthiness curves
Interpretation rule extraction, clause activity/precision, closed-form global & local feature importance, per-example and per-pixel explanations
Visualisation memory plots, automata heat-maps, convolutional clause patches, segmentation overlays and vote maps, confusion matrices, vote distributions

Installation

torchtsetlin is published on PyPI: https://pypi.org/project/torchtsetlin/. It needs Python 3.9+ and PyTorch 2.0+.

  1. Install PyTorch first, choosing the CUDA or CPU build for your machine from pytorch.org, e.g.

    pip install torch                                                     # default build
    pip install torch --index-url https://download.pytorch.org/whl/cpu    # CPU-only
  2. Install torchtsetlin from PyPI:

    pip install torchtsetlin
  3. Optional extras:

    pip install "torchtsetlin[viz]"      # matplotlib for torchtsetlin.viz
    pip install "torchtsetlin[vision]"   # torchvision for the MNIST / torchvision / segmentation dataset helpers
    pip install "torchtsetlin[sklearn]"  # scikit-learn interop in the examples
    pip install "torchtsetlin[all]"      # everything, including docs and dev tools

Check the installation:

import torch, torchtsetlin as tt
print(tt.__version__, torch.cuda.is_available())
From source
git clone https://github.com/vlbthambawita/torchtsetlin
cd torchtsetlin
pip install -e ".[dev]"
pytest            # run the test-suite (uses the GPU when available)
mkdocs serve      # browse the documentation locally

How learning works (in one paragraph)

Each clause is an AND of literals (x_k or NOT x_k); every (clause, literal) pair has a Tsetlin automaton whose integer state decides whether the literal is included. For a training example, clauses of the true class receive Type I feedback (memorise the example's True literals, forget the rest) and clauses of a random other class receive Type II feedback (add a False literal so the clause stops matching), each with a probability controlled by the vote margin T. torchtsetlin evaluates a mini-batch with one matrix product, counts the feedback events per (clause, literal) with another, and turns the counts into binomial state transitions — the whole update is a handful of tensor ops. See the concept pages for details and references.

Documentation

  • Getting started, concepts, guides, examples and the full API reference: https://vlbthambawita.github.io/torchtsetlin/ (or mkdocs serve locally).
  • Measured CPU vs GPU performance (throughput, scaling, memory, where the time goes): Benchmarks -> CPU vs GPU; the harness lives in benchmarks/.
  • Runnable scripts in examples/ (see its README): Noisy XOR, tabular data with thermometer encoding, regression, MNIST flat and convolutional, four convolutional walkthroughs covering 2-D clauses (shapes_conv.py), 1-D signals (conv1d_ramps.py), convolutional regression (conv_regression_blobs.py) and shared clause pools (mnist_conv.py --coalesced), and semantic segmentation on generated street scenes (segmentation_scenes.py).
  • Worked notebooks in examples/notebooks/: Iris (rules you can read), MNIST (convolutional clauses and GPU throughput) and CIFAR-10 (booleanizing colour images), plus two that work through the Tsetlin-machine segmentation literature — the Convolutional Regression TM (ICMLT 2021) and CTM-UNet (ISTM 2025), the latter building a dense per-pixel Tsetlin segmentation head, the graph Tsetlin machine (deep clauses over sequences, and images as graphs), and semantic segmentation with SegmentationTsetlinMachine. Each opens in Google Colab from its badge, and the documentation lists them.

Citation

If you use torchtsetlin in research, please cite the preprint (arXiv:2611.28195), together with the Tsetlin machine papers whose algorithms you rely on (see the documentation). Other formats are at https://vajira.info/torchtsetlin/cite/, and GitHub's "Cite this repository" button reads CITATION.cff.

@misc{thambawita2026torchtsetlin,
  author        = {Thambawita, Vajira and Halvorsen, P{\aa}l and Granmo, Ole-Christoffer},
  title         = {torchtsetlin: Fast, Interpretable Tsetlin Machines for PyTorch},
  year          = {2026},
  eprint        = {2611.28195},
  archivePrefix = {arXiv},
  primaryClass  = {cs.AI},
  doi           = {10.48550/arXiv.2611.28195},
  url           = {https://arxiv.org/abs/2611.28195}
}

License

MIT — see LICENSE.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases torchtsetlin

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229