TrustformeRS 0.2.1 went looking for every place the code was quietly inventing an answer instead of computing one — and deleted the invention.
Today we released TrustformeRS 0.2.1 — a production-grade honesty and correctness pass across the entire workspace: fabricated and placeholder logic replaced with real implementations or structured errors, unsound and orphaned code deleted, five deadlock-class bugs fixed, and dependency hygiene tightened end to end. The release was verified across three checkpoints — 2026-08-18, 2026-08-24, and a final validation on 2026-08-26 — landing at 21,370 tests passing, 0 failed (25,883 on --all-features), with clippy, doctests, and cargo deny all clean.
TrustformeRS is Pure Rust Hugging Face Transformers: transformer/LLM loading and inference, tokenizers, training, and serving — no Python required, no PyTorch, no libtorch anywhere in the workspace. It compiles to a single static binary — or to WASM, or onto mobile — and runs anywhere Rust runs. 0.2.1 adds a second, quieter kind of sovereignty: nothing this release ships silently invents a number, a status, or a response when it can’t actually produce one.
Why TrustformeRS 0.2.1 is a game changer
Running TrustformeRS before 0.2.1 meant trusting code that, in a surprising number of places, wasn’t telling the truth:
- API endpoints and pipelines that returned canned output — a literal
"Mock response",format!("{text} [Generated continuation]"), a hardcodedscore: 0.95— indistinguishable from real inference unless you read the source. - Six cloud-provider integrations that all returned the same
"Mock response"/https://example.com/endpointregardless of which one you configured. - Profiling and monitoring code that invented CPU/GPU utilization, memory, temperature, and battery figures instead of measuring them — one WASM helper even probed a
navigator.thermalStatethat isn’t a real browser API. - Eleven model architectures whose checkpoint loaders silently returned
Ok(())and left the model at its random-initialized weights, with nothing telling you inference was running on noise. - An orphaned auth module cluster that accepted RS256-signed JWTs without checking the signature against a real key — never wired to a router, but sitting in the tree.
- Five real deadlocks, including an unconditional re-entrant one in the Metal GPU attention path.
- A
deny.tomlthat either failed to parse under currentcargo-denyor passed vacuously with an empty ban list — the COOLJAPAN banned-crate policy wasn’t actually being enforced.
TrustformeRS 0.2.1 ends all of that:
- The fabrication sweep, quantified. Dozens of
estimate_*/mock/placeholder code paths acrosstrustformers-serve,trustformers-wasm,trustformers-mobile,trustformers-py, andtrustformers-trainingnow either do the real measurement or inference, or return a structured error naming exactly what’s missing. - An RS256 JWT auth bypass deleted outright — the fabricated auth surface was never reachable from any router, so nothing shipped was exposed, but it’s gone rather than patched.
- Five deadlock-class bugs fixed: the Metal GPU
attention_gpu_to_gpu_optimizedre-entrant deadlock, atokio::sync::Mutexdeadlock inDistributedDebugger::coordinate_operation, and threeRwLockread-read reentrancy hazards. cargo deny check advisories/bans/licensesall pass for real. The[bans]deny-list — previously an empty comment behind a schemacargo-denycouldn’t fully parse — now enforces the full COOLJAPAN banned-crate list on a current schema.- Eleven architectures’ checkpoint loaders now bind real weights, or honestly refuse with a
not_implementederror naming the specific reason, instead of silently leaving a model randomly initialized. trustformers-serve::openai_compatis mounted for real, backed by a realOpenAiInferenceBackend, and 27 previously-orphaned test files (+770 tests) are compiled and running behind a new source-tree orphan guard.
Technical Deep Dive: what 0.2.1 actually changed under the hood
1. trustformers-serve — the biggest single cleanup. The resource_manager/ placeholder tree (11 files, 5,972 lines) that fabricated network ports (vec![8080] always), temp-directory paths, database connection ids, and GPU device stats is deleted outright — the unprefixed ResourceManagementSystem name now resolves to the real, tested resource_management module. Cloud-provider integrations, model management (ModelInstance::infer no longer synthesizes "Generated response for: {}"), notification channels, GPU statistics, and cache health checks all stop returning canned data.
2. Security and GPU lifetime (trustformers-core, trustformers-mobile). A new MetalBufferHandle RAII type releases a Metal buffer’s cache entry when the last handle drops, replacing stay-live-until-eviction semantics across every GPU-to-GPU result site trustformers-core owns. trustformers-mobile::advanced_security gains real post-quantum primitives — KyberKem (FIPS 203 ML-KEM), DilithiumSigner (FIPS 204 ML-DSA), SphincsSigner (FIPS 205 SLH-DSA) — replacing placeholder byte-tricks.
3. Model correctness (trustformers-models). Checkpoint loading for roberta, albert, fnet, nemotron, phi4, mistral_v3, phi2, yi, starcoder2, llama3, and command_r now binds real weights via Checkpoint::from_reader; architectures the machinery can’t yet serve faithfully (rwkv, mamba, hyena, performer, retnet, and others) now return a named not_implemented error instead of the same silent Ok(()). FNetLMPredictionHead is a real implementation for the first time, and GPT-2 contrastive search — publicly constructible since it was documented — actually runs instead of returning “not yet implemented for GPT-2”.
4. WASM honesty (trustformers-wasm). performance_profiler deletes 22 estimate_*/get_*/check_*/calculate_* helpers that invented CPU/GPU usage, memory/FLOPs/bandwidth, battery level, and an “ML-powered” improvement estimate — a public #[wasm_bindgen] API shape change. What remains is real: wall-clock duration, real WASM linear-memory growth, and a real Battery Status API read. ModelSplitter::analyze_model_structure stops inventing a transformer layout from buffer length alone (“first 1% is config, next 5% is vocabulary…”) and instead reads real SafeTensors component boundaries where the format is recognized.
Getting Started
cargo add trustformers
use trustformers::prelude::*;
use trustformers::{AutoModel, AutoTokenizer, Tensor};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let tokenizer = AutoTokenizer::from_pretrained("bert-base-uncased")?;
let model = AutoModel::from_pretrained("bert-base-uncased")?;
let tokenized = tokenizer.encode("Hello, Rust world!")?;
let ids: Vec<f32> = tokenized.input_ids.iter().map(|&id| id as f32).collect();
let len = ids.len();
let inputs = Tensor::from_vec(ids, &[len])?;
let outputs = model.forward(inputs)?;
println!("Output shape: {:?}", outputs.shape());
Ok(())
}
What’s New in 0.2.1
Security
- RS256 JWT auth bypass deleted; five deadlock-class bugs fixed;
cargo deny check advisories/bans/licensesall pass for real.
Added
openai_compatmounted on real routers; 27 orphaned test files (+770 tests) recompiled under a new source-tree orphan guard.MetalBufferHandleRAII type for Metal GPU buffer lifetimes; real post-quantum primitives (KyberKem/DilithiumSigner/SphincsSigner) intrustformers-mobile.trustformers-training::distributed_zero(ZeRO optimizer-state/gradient/parameter partitioning), implemented and tested.trustformers-py::models::losses: real cross-entropy loss for classification and language modeling, closed-form verified.- A
metalfeature on thetrustformersumbrella crate — Metal acceleration was previously unreachable from the published entry-point crate.
Changed
- Checkpoint loading for 11 architectures binds real weights or honestly refuses;
SentencePieceTokenizer/WordPieceTokenizer::from_pretrainedhard-error instead of fabricating a vocabulary; GPT-2 contrastive search implemented. - NCCL/Gloo/MPI distributed backends stop simulating collectives; DPO’s
get_batch_logpsdoes a real masked per-token log-probability gather. - The
resource_manager/placeholder tree deleted (5,972 lines); dozens oftrustformers-servemodel/cloud/notification/metrics paths stop fabricating data. trustformers-wasm::performance_profiler,ModelSplitter,IndexedDBstorage, andmulti_model_manager::warmup_modelall replace invented telemetry/layout/compression with real measurement.trustformers-py::training::PyTrainer::train()now honestly refuses — no backward/gradient path exists yet anywhere in the training stack, so it names that reason instead of reporting a loss that never changes.
Removed
- Orphaned root
src/tree (899 lines); two tracked compiled Mach-O binaries;impl_placeholder_backend!-generated message-queue backends; ~4,800 lines of dead/duplicatetrustformers-mobilescaffolding; 24 no-op mesh methods intrustformers-serve.
Fixed
deny.tomlnow parses and actually enforces the COOLJAPAN banned-crate list; 9 files split to stay under the workspace’s 2,000-line policy limit;AdvancedRAGPipeline’s self-reflection results were silently discarded and never extended a run — both the discard and an unconditionalbreakblocking multi-hop retrieval are fixed.
Tips
- Post-quantum primitives are real now — use them directly.
use trustformers_mobile::advanced_security::pqc::{KyberKem, DilithiumSigner};—KyberKem::generate()gets you a FIPS 203 ML-KEM keypair withencrypt/decrypt;DilithiumSigner::generate_from_rng(&mut rng)(anyrand_core::CryptoRng) gets you a FIPS 204 ML-DSA signer withsign/verify. - If you relied on a checkpoint loader silently succeeding for
rwkv,mamba,hyena,performer, orretnet, check your error handling. These now return a namednot_implementederror instead of leaving the model randomly initialized with no signal — that’s the correct behavior, but it means a previously-silent path now surfaces anErr. trustformers-wasm’sPerformanceProfilerlost its estimated fields.cpu_time/gpu_time/memory/cpu/gpu/gpu_memoryare gone from the public#[wasm_bindgen]shape; what’s left (duration_ms,wasm_memory_growth_bytes, real battery level) is real. Update any external consumer that read the removed fields.- Don’t route production traffic expecting
token-classificationorquestion-answeringfromtrustformers-py’s pipelines yet. Both now refuse construction with a structuredNotImplementedError— this crate’s tokenizers don’t yet produce a character-level offset mapping — rather than inventing an entity or an answer. - Run
cargo deny check bansif you vendor or fork this workspace. The ban list now actually covers the full COOLJAPAN openblas/bincode/rustfft/rusqlite/z3/zip/flate2/zstd/bzip2/lz4-family replacements — a check that used to pass vacuously will now catch real violations.
This is the foundation
TrustformeRS 0.2.1 rides on OxiCUDA for CUDA compute, oxicuda-metal for Apple Silicon, SciRS2 for numerics, OxiBLAS for Pure-Rust BLAS/LAPACK, OxiCode for serialization, and OxiARC (oxiarc-zstd/-deflate/-lz4/-archive) for compression — with a new real SHA-256 and DEFLATE path replacing a byte-sum “checksum” and an uncompressed-but-mislabeled-Gzip storage bug in trustformers-wasm’s IndexedDB layer this release. It sits beside ToRSh, SkleaRS, and TenfloweRS in the COOLJAPAN model-training and serving stack.
Repository: https://github.com/cool-japan/trustformers
Star the repo if you’d rather your transformer stack return a structured error than a plausible-looking lie. The era of monitoring dashboards that invent their numbers and pipelines that fake their inference is over. Pure Rust transformers — honest about what they can and can’t yet do — are here.
— KitaSan at COOLJAPAN OÜ
August 26, 2026