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:
ZeroCopyTensorView<'a>— a bounds-checked, borrowedf32tensor view withfrom_slice,subview, and stride computation. Slice a tensor without copying its backing data.GlobalMemoryPool— a thread-safe aligned allocator (allocate,allocate_aligned,unsafe deallocate) with layout-tracked, leak-free deallocation.GlobalProfiler—Profiler::instance()plus per-sessionstart_operation/end_operationfor measuring hot paths.
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:
- Gorilla-style time-series compression (
CompressionEngine::compress_series): delta-of-delta timestamp encoding plus XOR float encoding with leading/trailing zero-bit counts, replacing a TODO stub; addsoptimize_compression. - Historical-data lifecycle, archival, and query engine: real
cleanup_expired_data,evaluate_lifecycle,check_deletion_allowed(LifecycleManager);archive_data/retrieve_data(ArchivalSystem);execute_query/check_cache/cache_result(query engine). - Concurrency-detector analytics (
performance_optimizer::test_characterization::concurrency_detector): real cycle/deadlock, thread, lock, and conflict detection plus pattern/sharing/risk-assessment analytics across eight detector modules (lock-cycle extraction, detection-confidence and risk scoring), clearing dozens of type-mismatch stubs indetector.rs.
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
- Real SHAP, LIME, and Integrated-Gradients feature attribution in
trustformers-debugvia a newinterpretabilitymodule —InterpretabilityAnalyzer,InterpretabilityConfig,InterpretabilityReport(replaces placeholder unit-struct stubs).
Zero-copy and memory internals
ZeroCopyTensorView<'a>— bounds-checked borrowedf32view withfrom_slice,subview, and stride computation, re-exported from the crate root.GlobalMemoryPool— thread-safe aligned allocator (allocate,allocate_aligned,unsafe deallocate) with layout-tracked, leak-free deallocation.GlobalProfileroperation API —Profiler::instance()plus per-sessionstart_operation/end_operation.
Correctness fixes
- HuggingFace upload now computes a real SHA-256 digest (via
sha2) for content addressing; the oldsha256_stubwas a non-crypto 128-hex XOR-fold. Output is now 64 hex chars, covered by known-answer vectors. - Miri-verified memory-pool fix: reused blocks free their actual allocation layout (mismatched-layout free is UB) and each
MemoryBlockdrops its backing allocation exactly once; regression test added for larger-block reuse. - Fixed clap
-cshort-flag collisions that panicked theload_testandmessage_queue_clibinaries on startup (now pinned toshort = 'n'). - Replaced a flaky wall-clock assertion in the async-operations benchmark with a deterministic liveness check.
Real .xlsx export
.xlsxexport intrustformers-debugnow emits a valid OOXML workbook package viaoxiarc-archive(Pure Rust), replacing the CSV-with-.xlsx-extension placeholder.
Serving internals
- Gorilla-style time-series compression (delta-of-delta timestamps + XOR float encoding) plus
optimize_compression. - Real historical-data lifecycle, archival, and query engine (LifecycleManager, ArchivalSystem, query cache).
- Concurrency-detector analytics: cycle/deadlock, thread, lock, and conflict detection with risk scoring across eight detector modules.
PerformanceModelingEnginenow stores each trained model inactive_modelsinstead of discarding it; resource statistics now compute real active-resource and peak-usage figures from per-subsystem snapshots.
Workspace dependency consolidation
- Consolidated several deps to
workspace = truefor single-source versioning: async-trait, log, tower, tower-http (trustformers); rmp-serde (trustformers-serve); libc (trustformers-mobile); memmap2 (trustformers-tokenizers).
Tips
- Explain predictions with
InterpretabilityAnalyzer. Configure it viaInterpretabilityConfig, runanalyze(...), and read per-feature contributions off theInterpretabilityReport— SHAP, LIME, and Integrated-Gradients are all real now, not placeholders. - Slice tensors without copying. Use
ZeroCopyTensorView::from_slice(&data, &shape).subview(i)to take a bounds-checked borrowed sub-view instead of allocating a new tensor. - Profile hot paths with
GlobalProfiler. Wrap a region withProfiler::instance().start_operation(...)/end_operation(...)to attribute time per operation. - Trust the hub digest. The upload path now produces a real SHA-256 (64 hex chars), so content addressing and dedup are cryptographically meaningful — no more XOR-fold collisions.
- Open exports anywhere.
.xlsxfiles are real OOXML workbooks now; open them directly in any spreadsheet application instead of working around a mislabeled CSV. - If you build custom allocators on the pool, note it now frees the true allocation layout — no mismatched-layout UB, and each block frees exactly once.
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