NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Verifying Properties of Tsetlin Machines

Emilia Przybysz, Bimal Bhattarai, Cosimo Persia, Ana Ozaki, Ole-Christoffer Granmo, Jivitesh Sharma

Abstract

Tsetlin Machines (TsMs) are a promising and interpretable machine learning method which can be applied for various classification tasks. We present an exact encoding of TsMs into propositional logic and formally verify properties of TsMs using a SAT solver. In particular, we introduce in this work a notion of similarity of machine learning models and apply our notion to check for similarity of TsMs. We also consider notions of robustness and equivalence from the literature and adapt them for TsMs. Then, we show the correctness of our encoding and provide results for the properties: adversarial robustness, equivalence, and similarity of TsMs. In our experiments, we employ the MNIST and IMDB datasets for (respectively) image and sentiment classification. We discuss the results for verifying robustness obtained with TsMs with those in the literature obtained with Binarized Neural Networks on MNIST.

Introduction

As machine learning (ML) models are increasingly deployed in high-stakes environments—such as medical diagnosis or autonomous driving—their "black box" nature becomes a significant liability. Even models considered interpretable, like Tsetlin Machines (TsMs), are susceptible to adversarial attacks: tiny, often invisible perturbations to input data that can flip a model's prediction.

While traditional empirical testing involves evaluating a model against random noise, it fails to provide absolute guarantees. This research addresses the need for formal verification. By bridging the gap between the pattern-matching capabilities of TsMs and the rigorous framework of formal logic, we can mathematically prove that if up to $k$ bits in an input are flipped, the classification will remain unchanged.

Formalizing Tsetlin Machines

The core contribution of this work is an exact encoding of a Tsetlin Machine into propositional logic. Unlike deep neural networks that rely on complex floating-point weights, TsMs are "logic-native," utilizing Boolean algebra and discrete states.

Tsetlin Automata states and transitions governing the inclusion or exclusion of features in a clause.

TsMs classify data using a majority vote of "monomials" (conjunctions of Boolean features). We translated this structure into a Boolean formula, using sequential counters to transform cardinality constraints—such as determining if positive votes outweigh negative ones—into a format compatible with a SAT solver.

Verification Framework

Once the model is represented as a logic formula, we employ the Glucose SAT solver to verify specific properties:

  1. Adversarial Robustness: We ask the solver if any input within a defined distance $\epsilon$ of the original results in a different label. If the solver returns "unsatisfiable," the model is proven robust for that instance.
  2. Equivalence: Determining if two models always behave identically across all possible inputs.
  3. Similarity: Assessing if two models behave the same specifically on a given dataset.

Experimental Evaluation

We evaluated our approach using two benchmarks: MNIST (handwritten digits) and IMDB (sentiment analysis). For MNIST, images were binarized using adaptive Gaussian thresholding to meet the TsM's Boolean input requirements.

Samples from the MNIST dataset showing original digits and their binarized variations used for training and verification.

Key Results

  • Performance: TsMs achieved ~98% accuracy on MNIST and ~82% on IMDB, performing competitively with Binarized Neural Networks (BNNs).
  • Provable Robustness: On MNIST, the system verified 200 test instances for 1-bit flips in less than a second per instance. However, complexity increases exponentially with the number of allowed flips ($k$), leading to timeouts for higher perturbation budgets.
  • The Specificity Lever: We found that the hyperparameter $s$ (specificity) acts as a knob for robustness. Lower $s$ values encourage "negated reasoning," which surprisingly increases resistance to adversarial inputs.
  • Equivalence vs. Accuracy: Our tests proved that two models with identical test accuracy are often logically inequivalent, highlighting the limitations of relying solely on accuracy metrics for safety-critical applications.

Conclusion and Future Work

While formal verification provides unparalleled trust, scalability remains the primary bottleneck. SAT solving is NP-hard, and verification time increases exponentially with model size and the perturbation budget. Future research will focus on optimizing SAT encodings and exploring specialized solvers to handle larger Tsetlin Machines and multi-class problems more efficiently.

Summary updated

BibTeX
@misc{przybysz2023verifying,
  author = {Emilia Przybysz and Bimal Bhattarai and Cosimo Persia and Ana Ozaki and Ole-Christoffer Granmo and Jivitesh Sharma},
  title = {{Verifying Properties of Tsetlin Machines}},
  year = {2023},
  eprint = {2303.14464},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.14464},
}
Figure