TinyRustLM operational contract: ownership, state, and recovery

A source-grounded operational reading of the current global runtime, transfer ABI, model-load transaction, generation transaction, and recovery behavior.

The reviewed runtime is governed by one global mutable owner, not a hidden framework. A process-global mutex protects an optional Runtime containing model, KV cache, tokenizer, scratch, logits, sampling, result, and diagnostics state.

Two transactions

Model loading commits only after parsing, tensor materialization, scratch creation, KV allocation, and logits allocation all succeed. Generation clears only generation state, then tokenizes, prefills, decodes, and publishes one result or stable error.

Recovery

Many prompt and sampling errors preserve the accepted model, allowing a later valid call to recover. Reset clears context. Free Model discards model-owned state. Clear Chat changes only the browser transcript.

Read the operations handbook