COOLJAPAN
← All posts

TrustformeRS 0.1.3 Released — Model Interpretability, Zero-Copy Tensors, and Verified Memory Safety

TrustformeRS 0.1.3 patch — real SHAP/LIME/Integrated-Gradients interpretability, ZeroCopyTensorView + GlobalMemoryPool + GlobalProfiler, Miri-verified memory-pool fixes, real SHA-256 on the HuggingFace upload path, and real OOXML .xlsx export via oxiarc-archive.

release trustformers rust transformers interpretability memory-safety machine-learning pure-rust

You can finally explain what your model just did — and trust that the bytes underneath it are sound.

Today we released TrustformeRS 0.1.3 — a patch that wires up real SHAP/LIME/Integrated-Gradients interpretability, adds zero-copy tensor views and a leak-free aligned memory pool with Miri-verified safety fixes, and replaces stubs on the hub-upload and export edges with real SHA-256 content addressing and a real OOXML .xlsx workbook.

TrustformeRS is Pure Rust Hugging Face Transformers: transformer/LLM loading and inference, tokenizers, and the model hub — no Python, no PyTorch.

No PyTorch. No Python. No CUDA-C. No libtorch shared object to chase across machines. TrustformeRS compiles to a single static binary — or to WASM — and runs anywhere Rust runs. This release leans into what that ownership buys you: it hunts down a real instance of undefined behavior (a heap mis-layout free in the memory pool), fixes it so each block frees the layout it was actually allocated with, and proves the fix with Miri plus a regression test. That is the kind of guarantee a hand-rolled C++ allocator stack does not give you for free.

Why 0.1.3 matters

Interpretability is now real. The SHAP, LIME, and Integrated-Gradients feature-attribution paths in trustformers-debug are no longer placeholder unit-structs — they are working implementations behind a clean InterpretabilityAnalyzer surface, so you can actually explain why a prediction came out the way it did.

The tensor and memory internals got both faster and safer. New zero-copy tensor views and an aligned global memory pool cut allocation overhead — and in the process we caught and fixed a genuine soundness bug. Freeing an allocation with a mismatched layout is undefined behavior; reused pool blocks used to free with the smaller requested size instead of their true allocation layout. That is now fixed and Miri-verified.

The correctness story extends to the edges. The HuggingFace upload path now computes a real SHA-256 digest for content addressing — the old sha256_stub was a non-cryptographic 128-hex XOR-fold, never SHA-256. And exports are honest now: a .xlsx request emits a real Office Open XML workbook, not a CSV with the wrong file extension.

Technical Deep Dive

(a) Interpretability in trustformers-debug. A new interpretability module exposes InterpretabilityAnalyzer, InterpretabilityConfig, and InterpretabilityReport. Together they wrap real SHAP, LIME, and Integrated-Gradients feature attribution, replacing the previous placeholder unit-struct stubs. You configure the analyzer, run it against a model and inputs, and get a structured report of per-feature contributions.

(b) Zero-copy and memory internals in trustformers (crate root). Three new surfaces are re-exported from the crate root:

And the soundness fix lives here: reused blocks now record and free their actual allocation layout instead of the smaller requested size (freeing with a mismatched layout is UB), and each MemoryBlock releases its backing allocation exactly once through its own Drop. A regression test covering larger-block reuse guards against the leak coming back, and the whole thing is Miri-verified.

(c) Correctness on the hub and export edges. The HuggingFace upload path now derives content addresses from a real SHA-256 digest via sha2 — output is now 64 hex chars, covered by known-answer test vectors. The data-export path emits a valid OOXML workbook package ([Content_Types].xml, relationships, workbook, worksheet) for .xlsx via oxiarc-archive, which is Pure Rust and load-bearing for this feature.

(d) Serving internals in trustformers-serve. Several historical-data and observability paths went from parameter-ignoring stubs to working code:

The memory-pool fixes are Miri-verified, and the project remains 100% Pure Rust.

Getting Started

cargo add trustformers
use trustformers::{AutoTokenizer, AutoModel};
use trustformers_debug::{InterpretabilityAnalyzer, InterpretabilityConfig};

fn main() -> anyhow::Result<()> {
    // Backbone: load a model and tokenizer, then run a forward pass.
    let tokenizer = AutoTokenizer::from_pretrained("bert-base-uncased")?;
    let model = AutoModel::from_pretrained("bert-base-uncased")?;

    let inputs = tokenizer.encode("TrustformeRS runs transformers in Pure Rust.")?;
    let outputs = model.forward(&inputs)?;
    println!("logits shape: {:?}", outputs.shape());

    // New in 0.1.3: explain the prediction with real feature attribution.
    let config = InterpretabilityConfig::default();
    let analyzer = InterpretabilityAnalyzer::new(config);
    let report = analyzer.analyze(&model, &inputs)?; // SHAP / LIME / Integrated-Gradients
    for attribution in report.feature_attributions() {
        println!("{attribution:?}");
    }

    Ok(())
}

Prefer to slice tensors without copying? Reach for the new crate-root view:

use trustformers::ZeroCopyTensorView;

let data = [0.0f32, 1.0, 2.0, 3.0, 4.0, 5.0];
let view = ZeroCopyTensorView::from_slice(&data, &[2, 3]); // bounds-checked
let row = view.subview(0); // borrowed sub-view, no allocation
println!("{row:?}");

What’s New in 0.1.3

Interpretability

Zero-copy and memory internals

Correctness fixes

Real .xlsx export

Serving internals

Workspace dependency consolidation

Tips

This is the foundation

TrustformeRS 0.1.3 stands on the mid-2026 COOLJAPAN stack: SciRS2 0.5.0 (with scirs2-linalg 0.5.0) for numerics, OxiBLAS for linear algebra, Oxicode for serialization, and OxiARC 0.3.3 — whose oxiarc-archive writer rides under the new OOXML .xlsx export — alongside OxiONNX for model interchange, with sha2 providing real content-addressing hashes. It pairs with OxiCUDA for GPU work and sits beside OxiLLaMa, ToRSh, SkleaRS, and TenfloweRS in the ecosystem, and the codebase is kept tidy with SplitRS.

Repository: https://github.com/cool-japan/trustformers

Star the repo if you want transformers you can explain, profile, and trust — all the way down to the layout of the bytes. Pure Rust, no Python, no PyTorch, sovereign by default.

KitaSan at COOLJAPAN OÜ June 25, 2026

↑ Back to all posts