torchtsetlin: Fast, Interpretable Tsetlin Machines for PyTorch
Vajira Thambawita, P{\aa}l Halvorsen, Ole-Christoffer Granmo
Key points
From the paper's conclusion- Its software, however, consists of C and CUDA kernels behind scikit-learn-style wrappers that sit outside the deep learning ecosystem. torchtsetlin implements the Tsetlin machine family as ordinary PyTorch modules: vanilla and weighted, coalesced, regression, convolutional over sequences, images and volumes, and dense per-pixel segmentation.
Abstract
The Tsetlin machine learns propositional rules with teams of Tsetlin automata that are driven by reward and penalty rather than gradients, so its models are interpretable by construction and cheap to evaluate. Its software, however, consists of C and CUDA kernels behind scikit-learn-style wrappers that sit outside the deep learning ecosystem. torchtsetlin implements the Tsetlin machine family as ordinary PyTorch modules: vanilla and weighted, coalesced, regression, convolutional over sequences, images and volumes, and dense per-pixel segmentation. The automata are a tensor buffer, so a model moves with .to(device), is saved with state_dict() and learns from a mini-batch with one update(x,y) call. Its core technique is a batched formulation of Type I and Type II feedback, in which automaton transitions become event counts realised as binomial draws, with one commit per mini-batch. On ten benchmarks taken from the existing libraries, it matches their accuracy, and on all but the two smallest it trains 2.4-10.9X faster than PyTsetlinMachineCUDA and 10.3-81.2X faster than tmu on the same GPU. The package is pure Python, MIT-licensed and on PyPI; every number in this paper is reproduced by one script. Code: https://github.com/vlbthambawita/torchtsetlin; package: https://pypi.org/project/torchtsetlin/.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Inference Latency-Aware Tsetlin Machine TrainingarXiv · 2026
- Loss-Guided Tsetlin Machines: Making the Learning Objective ExplicitarXiv · 2026
- Using the Tsetlin Machine to Learn Human-Interpretable Rules for High-Accuracy Text Categorization with Medical ApplicationsarXiv · 2026
- How to Turn an Attention Neural Network into an Interpretable Hard-Logic Predicate Circuit: Truth-Table Predicate Extraction and State-Machine Merging under Ship-of-Theseus ReplacementarXiv · 2026
- SLIC: Reinforcement Fine-Tuning Small LMs for Multi-Turn Analog Circuit OptimizationarXiv · 2026
- Sparse Transformer: a Controlled Testbed for Mechanistic InterpretabilityarXiv · 2026