Skip to main content

RAISE

RAISE (Rule-based Antecedent Inference for Symbolic Evidence) is a tokenizer-aware, model-agnostic rule-based explainer for discrete model behaviour. It converts raw or tokenizer-aligned inputs into symbolic transactions, mines frequent antecedents, scores class-conditional rules with established rule-interestingness measures, and maps rule evidence back to human-readable input components.

This repository is the reference implementation and supplementary-material home for:

RAISE: Tokenizer-Aware Rule-Based Explanations for Transformer Log Anomaly Detection
Paul K. Mvula, Paula Branco, Guy-Vincent Jourdan, Iosif-Viorel Onut, and Herna L. Viktor.

The paper evaluates RAISE within a unified comparison protocol for sparse symbolic and dense attribution explainers across transformer-based log anomaly detectors.

What RAISE provides

RAISE supports:

  • tokenizer-first explanations aligned with a model's tokenization;
  • raw-log canonicalization for regex/log-oriented use;
  • unigram and bigram symbolic transaction construction;
  • Apriori frequent-itemset mining;
  • rule scores including support, confidence, lift, leverage, improvement, PMI, WRAcc, precision, coverage, recall, and F1;
  • optional one-sided Fisher tests with Holm adjustment;
  • optional bootstrap stability filtering;
  • per-event rule retrieval;
  • projection from symbolic token rules to readable log components; and
  • exportable global rule inventories for auditing and downstream analysis.

RAISE is a descriptive post-hoc explainer. Masking-based tests used in the paper evaluate faithfulness to detector behaviour; they do not establish expert, semantic, causal, or root-cause correctness.

Installation

PyPI

Requires Python 3.10 or newer. Install a published release with:

python -m pip install raise-xai

The distribution name is raise-xai; the Python import name is raise_xai:

from raise_xai import RAISEExplainer

Check the installed version with:

python -c "from importlib.metadata import version; print(version('raise-xai'))"

Published versions appear on PyPI. Until the first upload succeeds, use the source installation below. The package includes the explainer, not trained transformer detectors or the full paper evaluation pipeline.

From source

git clone https://github.com/womega/RAISE.git
cd RAISE
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

For conventional requirements-file workflows, the repository also provides:

python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt

The package metadata and dependency declarations in pyproject.toml remain authoritative; the requirements files are convenience mirrors for source checkouts.

A Makefile is provided for the common development workflow:

make venv
source .venv/bin/activate
make ci

make ci is self-contained: it installs the checkout in editable mode with the development extras before linting, formatting checks, tests, and package build. This matters because RAISE uses a src/ package layout, which is intentionally not importable from a clean checkout until installed. Run make help to list all available targets.

Quick start: tokenizer-aligned input

from raise_xai import RAISEExplainer

token_sequences = [
    ["INFO", "DataNode", "block", "received"],
    ["INFO", "DataNode", "block", "received"],
    ["ERROR", "DataNode", "block", "failed"],
    ["ERROR", "DataNode", "block", "failed"],
]
targets = [0, 0, 1, 1]

explainer = RAISEExplainer(
    vocab_cfg={"min_df": 0.0, "max_df": 1.0, "min_df_bigram": 0.0},
    mining_cfg={"min_support": 0.25, "max_len": 2},
    stats_cfg={"use_fisher": False},
).fit_from_tokens(token_sequences, targets)

hits = explainer.explain_event_tokens(
    ["ERROR", "DataNode", "block", "failed"],
    top_k=3,
)

for target_class, rules in hits.items():
    print(target_class)
    for rule in rules:
        print(rule["lhs_items"], rule["wracc"], rule["confidence"])

Quick start: raw logs

from raise_xai import RAISEExplainer

logs = [
    "INFO service worker completed request",
    "INFO service worker completed request",
    "ERROR service worker failed request",
    "ERROR service worker failed request",
]
targets = [0, 0, 1, 1]

explainer = RAISEExplainer(
    vocab_cfg={"min_df": 0.0, "max_df": 1.0, "min_df_bigram": 0.0},
    mining_cfg={"min_support": 0.25, "max_len": 2},
    stats_cfg={"use_fisher": False},
).fit(logs, targets, shape_mode="none")

print(explainer.explain_event("ERROR service worker failed request", top_k=3))

Component-level projection

from raise_xai import aggregate_component_raise_values

sentence = "ERROR DataNode block failed"
tokens = ["ERROR", "DataNode", "block", "failed"]

rules = explainer.explain_event_tokens(tokens, top_k=3)[1]
component_scores = aggregate_component_raise_values(
    sentence,
    tokens,
    rules,
    weight_key="wracc",
)
print(component_scores)

Important evaluation semantics

The paper's comparison protocol separates two ideas that should not be conflated:

  1. Native configuration selection: each explainer is tuned according to its own output structure and configuration semantics.
  2. Shared-budget comparison: selected configurations are frozen and compared under a common low inspection budget with identical masking and evidence-unit conventions.

Empty explanations are retained as outcomes. Pairwise agreement is reported both overall and conditional on both explainers returning non-empty outputs.

Phase-level rule inventory

RAISE builds a shared rule inventory from the corpus supplied to fit, fit_from_tokens, or fit_transactions. If those same samples are then explained, the explanation analysis is transductive with respect to the rule inventory. For an independent rule-inventory generalization study, fit RAISE on a separate corpus and explain held-out samples afterwards.

Repository layout

src/raise_xai/       installable Python package
tests/               unit and smoke tests
examples/            runnable examples
docs/                method, protocol, reproducibility, and release notes
supplementary/       extended results omitted from the short paper
.github/             CI, PyPI release workflow, and Dependabot
Makefile             local development/CI command entry points
requirements*.txt    conventional runtime/development dependency mirrors

Reproducing the paper-level comparison

RAISE itself is detector-agnostic. The paper-level experiments additionally require the fixed trained transformer detectors and the comparison implementations for SHAP, LIME, and Anchors. The supplementary directory records the comparison scope and extended results retained outside the 12-page manuscript. See:

  • docs/methodology.md
  • docs/evaluation-protocol.md
  • docs/reproducibility.md
  • supplementary/README.md

Development

The shortest full local validation workflow is:

make ci

make ci first performs an editable development install and then runs linting, formatting checks, tests, and a package build. If the development environment is already installed and you only want the checks, use:

make check

The equivalent direct commands remain supported:

python -m pip install -e ".[dev]"
ruff check .
ruff format --check .
pytest
python -m build

Publishing releases

Maintainers: follow the PyPI release guide for the Trusted Publisher configuration, first upload, verification, and later releases. Publishing a GitHub release triggers the upload. Manual workflow runs validate and build the package without publishing it.

Citation

Use CITATION.cff for citation metadata. The reference paper is the preferred scientific citation for the method.

License

RAISE is distributed under the MIT License. See LICENSE.

Metadata

Release files for raise-xai 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raise-xai 0.1.1
File Size Uploaded
raise_xai-0.1.1.tar.gz 30.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for raise-xai 0.1.1
File Interpreter ABI Platform
raise_xai-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 49.3 kB

Release files / raise_xai-0.1.1.tar.gz

Download URL raise_xai-0.1.1.tar.gz
Size 30.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e291a30bfc31b6d576497b9b76b9430524cee87613f461fc7321342f8c85c8ac
BLAKE2b-256 checksum
How to use checksums
ff222f72e568c8afa35846ff1801cb5fed00b96a023cf0562a3f5413ac5d09ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / raise_xai-0.1.1-py3-none-any.whl

Download URL raise_xai-0.1.1-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a06aec540f1cc1e90bc090ef5fbca8d5b5ca934fac840e538443a7e988d0bcf
BLAKE2b-256 checksum
How to use checksums
151f3a92db03fd78e2e81aaa0795443750d9c7ea1766b60d5d2d6b9b73b23859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page