Skip to content

v0.8.0

Latest

Choose a tag to compare

@nicholasjpaterno nicholasjpaterno released this 01 Dec 01:50

[0.8.0] - 2026-11-30

Added

  • pmetal infer --json --top-logits K reports the first generation step's top-k raw logits (first_step_logits) (#37). Works across every engine (shared model, all native engines, MTP speculative decoding, and ANE), capturing the unpenalized, pre-temperature logits in float32 on device (or host for ANE) as [{"token_id", "token", "logit"}, ...] sorted descending. Also available via InferSpec::top_logits and pmetal_runtime::decode::{top_k_logits, capture_first_step_logits}.

  • Full CLI, TUI, and Desktop GUI feature parity and developer SDK documentation. Expanded 13 job specs (merge, serve, infer, train, grpo, rlkd, distill, preference, quantize, pretrain, speak, train-tts, train-asr) for full engine configurability across CLI, MCP, Python, TUI, and GUI; brought pmetal tui to 33 tabs covering all 27 job specs (adding speech, MTP/draft/diffusion training, decide, fuse, imatrix, pack-experts, Metal 4/TB5 RDMA telemetry, and live LR steering across trainers); upgraded the Tauri desktop GUI with Metal 4 / MPP / NAX / TB5 RDMA hardware telemetry, audio/adapter model badges, multi-turn reasoning_content + full inference parameters drawer, and live training LR/checkpoint steering (set_job_lr); and added a comprehensive Rust developer SDK guide suite under docs/sdk/ with runnable examples.

  • Hot-swap multi-LoRA serving, an Ollama-compatible HTTP API, and cluster inspection endpoints in pmetal serve. POST /v1/adapters, GET /v1/adapters, and DELETE /v1/adapters/{name} register, inspect, and unload LoRA adapters at runtime (AdapterRegistry), routed by model name (base:adapter or registered alias) with per-request adapter syncing on the model thread. /api/chat, /api/generate, /api/tags, /api/show, and /api/version expose Ollama's NDJSON streaming and model-inspection wire protocol on the same inference engine. With --features distributed, GET /v1/cluster/rdma, POST /v1/cluster/previews, GET /v1/cluster/election, and GET /v1/cluster/incompatible-peers surface live Thunderbolt RDMA readiness, heterogeneous placement previews, leader election state, and ABI/wire compatibility reports (examples/serve_multilora_ollama.sh and examples/cluster_preview.sh demonstrate both).

  • Disaggregated prefill/decode serving, JACCL Thunderbolt 5 RDMA, leader election, and heterogeneous shard planning in pmetal-distributed, plus pmetal cluster preview and pmetal cluster rdma. disaggregated streams KV-cache layer chunks and recurrent Mamba/GDN states from prefill workers to decode workers (DisaggregatedPrefillServer, DisaggregatedDecodeClient). rdma probes macOS Thunderbolt 5 RDMA capabilities (LocalRdmaCapabilities::probe) and builds JACCL mesh matrices and launch environments. election coordinates session-epoch leader election with sleep/wake holdback, namespace enforces cluster wire-schema and ABI compatibility across peers, and shard_plan plans heterogeneous memory/bandwidth-weighted layer placements across mixed Apple Silicon clusters.

  • Metal 4 / MPP compute kernels and expanded ANE training/inference support in pmetal-metal. Adds Metal 4 shader compilation and metal4_ops dispatch on Metal 4 / SDK 27+ toolchains, alongside ANE FP16 numerical preflight checks, weight palettization, ANE LM-head execution, and heterogeneous GPU+ANE pipelining.

  • AirLLM-style disk-backed layer streaming (pmetal_models::layer_stream) and streamed LoRA training (pmetal_trainer::streamed_lora). SafetensorsLayerStreamer streams transformer decoder layers from safetensors shards on demand with bounded residency plans (LayerResidencyPlan) and background prefetching so models larger than unified memory can run and train with boundary checkpoints.

  • System capability inspection in the Python bindings (pmetal.system_info) alongside hardened Tauri desktop GUI job controls, a torch_pickle fuzz target (fuzz/fuzz_targets/torch_pickle.rs), and a nightly real-weights CI workflow (.github/workflows/nightly-real-weights.yml).

  • pmetal serve --tts-model serves a Qwen3-TTS voice on POST /v1/audio/speech, in OpenAI's shape, beside the language model or alone. voice is one of the model's nine speakers, instructions directs the delivery in plain words, seed picks the take and language the language (both pmetal's extensions). response_format: "pcm" streams 16-bit 24 kHz mono as it is synthesized (the x-sample-rate header names the rate) and wav sends the whole clip; a client that disconnects stops the synthesis. speed other than 1, stream_format: "sse" and the compressed formats are refused by name. On an M4 Max a sentence's first audio reaches the client in 53–61 ms and a clip comes at about 4x real time; the server holds 5.1 GB. pmetal_serve::{SpeechEngine, Synthesizer} put any synthesizer behind the route.

  • pmetal serve --stt-model transcribes on POST /v1/audio/transcriptions, in OpenAI's shape, beside the other models or alone; --stt-aligner adds word timestamps. The form's file is a recording at any rate and with any number of channels (mixed to mono and resampled to 16 kHz, up to 25 MB); prompt is the words the recording is likely to hold, which steer the transcript; language is an ISO 639 code or the model's name for it, or left for the model to tell. response_format is json (the default), text or verbose_json (task, language, duration, text), and timestamp_granularities[]=word adds each word's start and end in seconds, timed by the Qwen3-ForcedAligner model --stt-aligner names. Segment timestamps, srt, vtt, stream, and a temperature other than 0 are refused by name. pmetal_serve::{TranscriptionEngine, Transcriber, Qwen3Transcriber} put any recognizer behind the route.

  • pmetal-speech, a new crate: Qwen3-TTS text to speech. Qwen3Tts loads a CustomVoice release (its weights, its vocab.json/merges.txt tokenizer and its codec) and generates a clip's codes frame by frame for a named speaker, a language (or auto) and a delivery in plain words ("quietly, almost a whisper"), handing each 80 ms frame over as soon as it is complete. The talker and code predictor are pmetal's own Qwen3 decoder layers; sampling is the workspace's sampler (the release's temperature, top-k and repetition penalty, the talker held to the codebook and end of speech, no end in its first two draws), and a seed gives the same reading every time. On the released 1.7B model, decoding greedily in float32, the codes are identical to the reference implementation's, frame for frame, for a plain prompt and for a whispered one. synthesize streams the audio as it is generated (a short first piece, then larger ones; AudioChunking), and the pieces join into exactly the clip decoded whole; speak returns the clip. On an M4 Max with the release's bf16 weights, warm, the first audio of a sentence arrives in 62–68 ms and a clip is generated at about 3.8–4.0x real time, with 4.0 GB of GPU memory in use (examples/speak.rs measures it).

  • Every Qwen3-TTS release speaks: VoiceDesign models with a voice described in plain words, Base models with a voice cloned from a recording of it, and the 0.6B models. A request's voice is Voice::Speaker (CustomVoice), Voice::Designed (VoiceDesign, its delivery describing the voice) or Voice::Cloned, from Qwen3Tts::clone_voice, which runs a Base model's speaker encoder (ECAPA-TDNN) over a few seconds of the voice at any rate. SynthesisOptions::text_input gives the talker the whole text in its prompt (CustomVoice's and VoiceDesign's default) or a token a frame (TextInput::Interleaved, a Base model's default), as the reference does. Qwen3Tts::clone_voice_with_transcript clones from a recording and what it says: the talker reads the recording's own codes, from the codec's encoder, pmetal_vocoder::codec::Qwen3TtsCodecEncoder (Mimi's), and continues the voice from them. On the released 1.7B models in float32, the speaker vector of a clip is the reference's within 1.1e-5, the encoder's codes of a clip are the reference's, all 49 frames of 16 codebooks, and the greedy codes of a VoiceDesign voice, a cloned voice with and without its transcript, and a CustomVoice speaker with the text a token a frame are the reference's, frame for frame. A delivery instruction to a model that does not read one (0.6B, Base) is refused by name; the reference drops it silently. Qwen3Tts::generate_codes takes SynthesisOptions in place of a sampling and a seed, and SpeechRequest::speaker is now voice. pmetal serve --tts-model serves every kind: a VoiceDesign model's one voice is designed, which instructions describes, and a Base model speaks the voices --tts-voice NAME=RECORDING.wav names, cloned at load (with the recording's transcript when RECORDING.txt sits beside it). The route takes temperature, top_k, top_p and repetition_penalty (pmetal's extensions; temperature: 0 draws greedily) and refuses instructions by name to a model that reads none. pmetal_serve::Synthesizer now takes a SpokenLine, its voice by name, and reports takes_instructions; Qwen3Voices is the Qwen3-TTS implementation, and SpeechEngine::load_qwen3_tts takes the recordings to clone.

  • Speech to text in pmetal-speech: Qwen3-ASR, with each word timed by Qwen3-ForcedAligner. Qwen3Asr loads a release (the official one, or an MLX conversion, whose quantized weights stay packed) and transcribes 16 kHz audio. TranscribeOptions::context steers it toward the words a clip is likely to hold ("TurboClipboard mcpotion pmetal"): on twelve spoken sentences full of product names, it wrote 4 of their 14 names right without one and 9 with one. language takes the model's name for a language (English) or its ISO 639 code (en), or is left for the model to tell. Qwen3ForcedAligner::align times each word of a transcript (WordTiming, in seconds) in about 50 ms for a 10 s clip. On the released 1.7B model in float32, a 10 s LibriSpeech clip's transcript is the reference implementation's, and so are its 27 word timings, to the millisecond. Across 203 LibriSpeech utterances the word error rate is 2.10% on test-clean and 5.05% on test-other in bf16, and 2.05% and 5.17% with the 8-bit conversion. On an M4 Max a 10 s clip is transcribed in 246 ms by the 8-bit 1.7B model (2.3 GB of GPU memory), in 410 ms in bf16, and in 120 ms by the 8-bit 0.6B model (examples/transcribe.rs measures it). The encoder attends within windows of 8 s, as the reference's vLLM backend does; its transformers encoder builds that mask but never applies it. Words are split as the reference splits them, except that en and em dashes separate words (right—quite), and a word keeps its inner punctuation (state-of-the-art). A recording longer than 20 minutes is transcribed in chunks cut at its quietest moment near each limit, as the reference cuts it, and Qwen3Asr::transcribe_timed times the words of a recording of any length in chunks of at most 3 minutes; the transcripts are joined with a space (the reference joins them with nothing, which runs English sentences together). A recording with no speech (language None) comes back as empty text, and a transcript that falls into a loop has the loop collapsed, as the reference does. The Whisper log-mel front end (stt::LogMel) is within 1e-4 of transformers' WhisperFeatureExtractor.

  • pmetal_vocoder::codec::Qwen3TtsCodec decodes Qwen3-TTS 12 Hz speech tokens to 24 kHz audio, and Qwen3TtsCodecStream decodes them as they are generated. Every layer of the decoder is causal, so the stream carries each convolution's left context and each attention layer's sliding window from one piece to the next, and its audio equals decoding the clip whole. (The reference's chunked decode re-decodes 25 frames of left context instead; on 12 s of speech tokens it differs from its own whole decode by up to 0.89, because the transformer's receptive field spans hundreds of frames.) On the released decoder the audio is within 6.0e-5 of the reference implementation's (98.7 dB SNR).

  • A tokenizer released as vocab.json and merges.txt, with no tokenizer.json, loads (Tokenizer::from_model_dir), built the way transformers converts it: a Qwen2Tokenizer, as Qwen3-TTS ships, gives the same ids as transformers on English, numbers, contractions, CJK, emoji, decomposed accents and special tokens. Another tokenizer class in this form is refused by name rather than guessed.

  • Word timings for Japanese and Korean, with the japanese-word-timings and korean-word-timings features (of pmetal, pmetal-serve and pmetal-speech, off by default). Japanese splits into words as the UniDic dictionary splits it, and Korean into its spaced words, each timed by its morphemes (mecab-ko-dic), both through Lindera; each feature embeds its dictionary (about 190 MB and 80 MB), which the build downloads and checks. On 20 FLEURS recordings of each language, 99% of the reference implementation's Japanese word edges fall in the same places and 99% of those are timed identically; for Korean, whose words the reference splits further (a stem from its ending), 98% of the edges both give are within 80 ms. A Japanese number is one word, where the reference times each digit. Without the features they are refused by name. examples/align.rs times the words of a transcript you already have.

  • Compressed audio in: FLAC, MP3, AAC or ALAC in M4A or MP4, Opus in Ogg, AIFF and CAF, decoded by macOS's AudioToolbox (pmetal_vocoder::audio::read_audio). /v1/audio/transcriptions takes them in file (up to 2 hours of audio), --tts-voice clones from them, and pmetal_speech::stt::clip_from_bytes (which replaces clip_from_wav) reads them; a WAV file is still read by pmetal's own parser. WebM and Vorbis, which macOS does not decode, are refused.

  • Qwen3Asr::transcribe_batch transcribes several recordings at once, up to 32 chunks together as the reference batches them: each prompt is filled on its own, shifted to end where the longest does, and the rows then decode together. On an M4 Max, eight LibriSpeech clips (79 s of audio) took 1.7 s batched against 3.6 s one at a time with the 8-bit 1.7B model, each transcript the one it gets alone. examples/transcribe.rs --batch times both.

  • Qwen3Tts::synthesize_batch speaks several lines at once (generate_codes_batch gives their codes), each line streamed to on_audio(line, piece) as it is synthesized, drawn from its own seed and stopped on its own. Each prompt is filled alone and the lines then run together, as transcription batches. On an M4 Max, four readings of a sentence (33 s of audio) took 3.9 s batched against 7.5 s one at a time with the 1.7B model, 8.5x real time. In float32 each line's codes are exactly its codes alone, on the released 1.7B model with lines of different lengths; in bfloat16 a matrix product over several rows sums in a different order from one over a single row, so a reading can come out as a different, equally valid take (a batch of one is exactly alone). examples/speak.rs --batch N times both.

  • pmetal serve --cache-limit MB bounds MLX's buffer cache, the freed GPU buffers kept for reuse; serve keeps 256 MB by default (ServeSpec::cache_limit, so the TUI, GUI, MCP and Python get it too; pmetal_runtime::memory::set_buffer_cache_limit for the SDK, whose default stays MLX's: as many as fit). A server holds several models, and an unbounded cache held about half a gigabyte more beside a Qwen3-TTS model. The speech examples take --cache-limit too.

  • Qwen3Asr::stream transcribes as the audio arrives (TranscriptStream::{push, finish}, StreamOptions), as the reference's vLLM backend streams: every 2 s of new audio, the model transcribes everything heard so far, continuing from the last transcript minus its last 5 tokens, which the new audio may change (from scratch for the first two). Unlike the reference, an update does not grow with the stream: the encoder attends within 8 s windows, so a window heard in full can no longer change, and the stream keeps those windows' encodings and the decoder's cache through them, reading only the audio since; and after a minute (segment_seconds) it closes the segment at the next pause, keeping its transcript and starting the next from scratch. On a 206 s recording an update took 174 ms at the median and 437 ms at most, and the whole stream 19 s of compute, where re-reading everything grew to 1.7 s an update and 107 s in all (8-bit 1.7B). On 203 LibriSpeech clips the final word error rate is the offline one (2.01% and 4.94%). examples/transcribe.rs --stream SECONDS times it.

  • pmetal speak and pmetal transcribe, from the job specs SpeakSpec and TranscribeSpec, so the terminal UI, the desktop app, the MCP server (speak, transcribe, 59 tools now) and Python (pmetal.SpeakSpec, pmetal.TranscribeSpec) start them as the command line does. speak writes a WAV in a CustomVoice model's speaker, a VoiceDesign model's described voice, or a Base model's voice cloned from --reference; transcribe prints or writes the transcript, as text or as JSON with each word timed by --aligner. The speech feature, on by default, carries them; japanese-word-timings and korean-word-timings now turn it on rather than serve. SpeechSampling::with applies a request's temperature, top-k, top-p and repetition penalty, as the speech route does.

  • Qwen3Tts::finetune_speaker fine-tunes a Qwen3-TTS Base model on one speaker's recordings into a CustomVoice model that speaks as them by name. prepare_speaker turns each recording (any rate, with its text and language) into the codec's codes, and a reference clip into the speaker's vector; finetune_speaker trains the talker and the code predictor with AdamW (FinetuneOptions: epochs, batch size, learning rate, warmup, weight decay, gradient clipping, the code predictor's share of the loss, the shuffle's seed), reporting each step to a TrainingCallback, which can stop it; save_custom_voice writes the CustomVoice model beside the Base model it came from, the speaker at codec id 3000 and the weights in bfloat16. Each recording is laid out as inference reads a CustomVoice request, so the loss on a recording is the negative log-likelihood generation gives it (to 1e-4, checked step by step on a seeded model); the reference's script differs from its own inference in four ways, listed on the speech models page. The weights train in float32, and a bfloat16 model is refused: at these learning rates most steps are smaller than bfloat16 resolves beside a weight. On an M4 Max, the released 0.6B Base model fine-tuned on 100 lines of one speaker (10 minutes) in under 2 minutes with about 20 GB of memory at its peak; on 20 new lines it read at 13.8 characters a second against the speaker's 14.5, where cloning the speaker from a recording read at 16.8 to 17.6, with the same word error rate (3.5%) and speaker similarity (0.99). examples/voice_similarity.rs compares voices by their speaker vectors.

  • pmetal train-tts fine-tunes a Qwen3-TTS Base model on one speaker from the job spec TrainTtsSpec, so the terminal UI, the desktop app (a Voice page under Train), the MCP server (train_tts, 60 tools now) and Python (pmetal.TrainTtsSpec) start it as the command line does. The dataset is the reference fine-tuning script's JSONL (audio, text, and optionally language and ref_audio), with recordings in any format transcribe reads; the result is a CustomVoice model that pmetal speak --voice NAME and pmetal serve --tts-model use like any other. Each step's loss, learning rate and gradient norm goes to --log-events, and Ctrl-C saves the model as it stands.

  • Qwen3Asr::finetune and pmetal train-asr fine-tune a Qwen3-ASR model on recordings and their transcripts. prepare_transcripts lays each recording out as transcription reads it (the context as the system turn, the audio as the user's) with the target after it, language NAME<asr_text>TRANSCRIPT and the end of the turn; the target is the reference's data format as given, or built from plain text and a language. The audio encoder and the language model train on the target's cross-entropy, in float32, and save writes the official release's layout in bfloat16. The loss on a transcript is the negative log-likelihood that decoding gives it. pmetal train-asr reads the reference script's JSONL (audio, text, and optionally language and prompt) and is on every surface (TrainAsrSpec, the train_asr MCP tool, 61 tools now, a Transcription page under Train in the desktop app).

  • Speech fine-tuning resists forgetting. A fine-tune on a little data forgets what the model knew: fine-tuned on 120 sentences of new product names alone, Qwen3-ASR-1.7B learned them (4 of 14 right to 12 of 14) and its LibriSpeech word error rate tripled. FinetuneOptions now has replay_share (part of every batch drawn from general examples), a held-out set evaluated as training goes (eval_every, reported in FinetuneReport::evaluations) with early stopping that keeps the best weights (patience), and lora_rank (low-rank adapters on the decoder layers, every other weight frozen, folded in at the end so the saved model's layout is unchanged). pmetal train-asr takes them as --replay-dataset, --replay-share, --eval-dataset, --eval-every, --patience and --lora-r, and by default trains rank-16 adapters at 1e-4 for two passes of 8 recordings a step (FinetuneOptions::transcription()), warning when no general recordings are given to replay. Taught six names from 496 sentences, Qwen3-ASR-1.7B went from 4 to 10 of 14 names right; with replay its LibriSpeech word error rate stayed at the release's (2.19% and 4.82% against 2.15% and 5.11%), where the reference's settings tripled it (6.48% and 14.41%), and LoRA used 14 GB against 36 GB for every weight.

  • A speech models page, docs/models/speech.md, lists the Qwen3-TTS and Qwen3-ASR releases PMetal runs, and marks every feature of the reference packages as matched, missing, or done otherwise on purpose, with the reason.

  • JobEvent::set_job_id (pmetal-core), ProcessStatus::state (pmetal-supervisor) and Dtype::size_in_bytes (pmetal_runtime::compat). They give a job's events another job id, name a job's state as it is serialized, and give a dtype's element width, which code outside these crates used to work out by matching every variant, as it no longer can (see below).

Changed

  • The enums and structs pmetal hands back are #[non_exhaustive] (breaking). That covers every crate's error enum; the events and statuses (JobEvent, JobStatus, Phase, JobKind, ProcessStatus, EventKind, TokenEvent, FinishReason, the trainers' phases and learning-rate events); the formats, dtypes and kinds pmetal detects or reads (ModelArchitecture, GgmlType, FileType, GgufVersion, Dtype, Quantization, TorchDtype, ChatTemplateType, ModelFamily and the like); the model dispatch enums (DynamicModel, EncoderModel, PretrainModel); and the outputs, results, statistics, metrics and reports (StepMetrics, EvalMetrics, TrainingInfo, the Hub's listings, search results and plans, the OpenAI and Anthropic response bodies, the merge, quantization and calibration reports, and the like). Outside their crates, a match on one of these enums needs a _ arm, and a pattern on one of these structs ends with ... They are read, not built: code that built a StepMetrics, EvalMetrics or TrainingInfo (a custom trainer, or a callback's test) starts from Default::default() or TrainingInfo::starting and sets the fields it needs. Variants and fields added to them from now on are not breaking changes. Config structs, request bodies and the enums that choose an option are unchanged.
  • No public error type names another crate's error type: the safetensors, JSON, YAML and bitcode failures they carry are their source(), not their payload (breaking). MergeError::{Safetensors, Serde, Yaml} (pmetal-merge), DistillError::{Safetensors, Serde, Yaml, Bitcode} (pmetal-distill), DistributedError::Serialization (pmetal-distributed), LoadError::Json and WeightFormatError::Json (pmetal-models), DynamicLoraError::Json (pmetal-lora) and IndexError::Json (pmetal-core) carried a safetensors::SafeTensorError, serde_json::Error, serde_saphyr::Error or bitcode::Error and converted one with From, so a release of any of those libraries that changed its error type was a breaking change for pmetal. Each variant holds a Box<dyn std::error::Error + Send + Sync>: source() reaches the library's error, downcast_ref recovers it (downcast_ref::<serde_json::Error>(), for one), and the message is the same. Code that relied on ? to convert one of those errors writes .map_err(|e| MergeError::Serde(e.into())) and the like.
  • pmetal_distributed::{PeerId, Multiaddr} re-export the libp2p types that its errors, discovery events and topology carry, so code can name them without depending on libp2p itself. They are still libp2p's types, so a libp2p upgrade is a breaking change for pmetal-distributed until 0.9.0 replaces them.
  • MLX's buffer cache is bounded by default, to a tenth of the device's recommended working set (about 10 GB on a 128 GB Mac). MLX keeps freed GPU buffers for reuse up to its whole memory limit, and work whose shapes vary (requests of every length, recordings, batches) fills that with buffers nothing reuses: a speech fine-tune reached a 110 GB footprint on a 0.6B model. The bridge sets the bound at the first op, so every binary and the SDK get it; a limit set with pmetal_runtime::memory::set_buffer_cache_limit always stands, and usize::MAX is the explicit way back to an unbounded cache; on the command line, PMETAL_CACHE_LIMIT_MB (megabytes, or unbounded) sets the default for every command. buffer_cache_limit() and default_buffer_cache_limit() report them. pmetal serve keeps its 256 MB (--cache-limit), which now has tests: forty chat requests of different lengths through the router, and lines and recordings of every length through the speech models, stay within it.
  • A Qwen3-TTS process's peak memory falls by 0.4 to 1.1 GB: the codec's checkpoint loads straight into MLX's buffers (pmetal_vocoder::checkpoint::load_safetensors). It was read whole into host memory and converted there, and macOS's allocator kept the freed pages: the 1.7B model's peak footprint falls from 6.0 GB to 4.9 GB with MLX's buffer cache off, and to 5.7 GB with it at its default. Float64 tensors, which MLX can't hold, are still decoded on the host.
  • pmetal serve listens at once and loads its models behind it. /health answers from the start; /v1/models lists a model only once it has loaded and warmed up (two tokens for a language model, a short line for a voice, so the first request is as quick as the rest), and a request for a model still loading gets 503 with Retry-After. A model that fails to load stops the server with its error. Before, the server bound its port only after the model had loaded. --model is no longer required when --tts-model is given; pmetal_serve::server::run_server_loading does the same for a library caller.
  • pmetal --version names the commit it was built from, pmetal 0.8.0 (8117445f), so a program that starts pmetal can tell the build it was tested against from another; a build outside a git checkout (from crates.io) prints the version alone.
  • rustix 1.1.6 (RUSTSEC-2026-0486: its xattr functions marked unwritten bytes as initialized when given a zero-length buffer).
  • pmetal_serve::routes::AppState::engine is now AppState::llm, an optional ModelSlot read through AppState::llm(), so a server can hold models other than a language model, and a model that is still loading. Migration: state.engine.x() becomes state.llm()?.x(); llm() is ServeError::NotServed (404) when the server serves no language model and ServeError::ModelLoading (503, with Retry-After) while it loads. build_router, build_router_with and run_server are unchanged. Telemetry::render takes the engine as an Option.
  • The engine speed comparison in docs/cli/infer.md is a measured table. It gave the architectures' own engines as 1.0x to 1.6x the shared model's speed without the checkpoints behind the figures; it now gives each measured checkpoint with its revision, the machine, both engines' decode rates and the command that reproduces them.
  • pmetal serve's pmetal_generation_tokens_per_second says what it measures. The figure is unchanged: completion tokens over each generation's whole time, the prompt included, which is not the decode rate. Its HELP text read "Completion tokens per second of each generation"; it and docs/cli/serve.md, for it and for /v1/metrics' rolling_tokens_per_second, now say so.
  • The native engines' benchmark trials run on a cache the caller builds (breaking). pmetal_runtime::{qwen3_native, llama4_native, deepseek_native, gpt_oss_native}::benchmark_trial take cache: &mut NativeCache (empty, built as for generation) after the weights, and Qwen's turboquant argument is gone, since the cache carries it; pmetal::native_inference::benchmark_native takes the affine cache's quant_config after turboquant.
  • GenerationOutput (pmetal-models) and NativeGenerationOutput (pmetal) are #[non_exhaustive], and both have a new load_time field (breaking). Code outside their crates can no longer build them with a struct literal or take them apart with a pattern that names every field. Build a GenerationOutput with GenerationOutput::new(token_ids, num_generated, stop_reason) and set the other public fields on it, and end a struct pattern with ... A NativeGenerationOutput comes from pmetal::native_inference and is read, not built. Fields added to either from now on are not breaking changes.
  • GenerationOutput (pmetal-models) gives why a generation ended as one stop_reason (breaking). Its stopped_by_token and stopped_by_length flags are replaced by stop_reason, a StopReason: StopToken, Length, Interrupted (the token callback stopped it) or Repetition (a repetition guard did), with as_str() for the name pmetal infer --json gives it and Display for the footer's words. A generation has exactly one reason, and one the flags could only give as two falses is named. Read output.stopped_by_token as output.stop_reason == StopReason::StopToken. StopReason is #[non_exhaustive]: reasons added later are not breaking changes, so a match on it needs a _ arm. Python's InferResult keeps its stopped_by_token and stopped_by_length.
  • pmetal infer's time to the first token leaves the model load out on every engine, and the load is reported on its own (#38). time_to_first_token_seconds in --json and the footer's "to the first token" were timed from the end of the runner's preparation. The architectures' own engines (Qwen3, Qwen3.5/3.6/3.8, Gemma 4, Llama 4, DeepSeek V3, gpt-oss) load their weights after that point, and so does the ANE, so on those the figure included the load; the shared model loads during the preparation, so on it the figure did not, while the footer said "model load included" on both (0.77 s to the first token after a 20 s load, on Nemotron 3.5). The first token is now timed from the start of generation without the load on every engine, as mlx-lm, llama.cpp and vLLM time it, and the load is a figure of its own: model_load_seconds in --json, and a Model load: line in the footer. On the native engines, --ane and native --mtp, time_to_first_token_seconds is smaller than before by the load; on the shared model it is unchanged, and so is seconds. The desktop app's TTFT, which reads the footer, changes the same way. Reported by @texchi2.

Fixed

  • pmetal infer's decode rate is the tokens after the first over the time from the first to the last, and both engines time their steps alike. The native engines' step metrics sorted the step times and then dropped up to ten as the warm-up; after the sort those were the fastest steps, so the average step time read high, the rate low, and the median was taken over every step. Both engines now leave out the first step in the order it ran (DecodeMetrics::from_step_times). The rate in the footer's Decode: line, which the desktop app and the terminal UI show, and decode_tokens_per_second in --json are now (n - 1) / (last token - first token) (pmetal_runtime::decode::decode_rate), so they agree with seconds. One token has no rate: decode_tokens_per_second is null and the footer has no Decode: line. Runs that measure no step times (--ane, --mtp, a draft model) now get the line too, with the rate alone. The figures differ from before, most on the native engines.
  • The architectures' own engines time a decode step through its token's readback. Their step timer stopped once the next step was queued, before the wait for the GPU, so the footer's avg= and p50= step times, and the DecodeMetrics they come from, read fast: by 3% on a warm run of Qwen3.5 0.8B (4-bit) and by 26% on a cold one, where the shared model's are within 1%. A step now runs from the start of its iteration to its token's readback, without the token callback, as on the shared model, and the last token's step is timed too. The decode rate (Decode: N tok/s and decode_tokens_per_second) comes from the token times, and this does not change it.
  • On the architectures' own engines, a stop token that ends a run is no longer counted as generated. A run that ended on EOS or another stop token counted it in pmetal infer's generated_tokens (--json) and "Generated N tokens", in num_generated (Python's InferResult, and the GenerationOutput of InferenceRunner) and in the decode rate, one more than the reply has, and one that met it in the last slot the length allows said stopped_by length. The stop token is now left out and stops the run, as on the shared model and the ANE. The engines are Qwen3, Qwen3.5/3.6/3.8, Gemma 4, Llama 4, DeepSeek V3 and gpt-oss.
  • A run its caller stops says so, on every engine. After Ctrl-C or SIGTERM, pmetal infer's footer said Stopped by: EOS token on the architectures' own engines and Stopped by: max length on the shared model; it now says Stopped by: interruption, as --json already gave stopped_by interrupted. Underneath, a run whose token callback stopped it was reported as stopped by a token on the architectures' own engines, and by the length on them and on MTP when the stop came on the last token the length allows; GenerationOutput::stop_reason is now Interrupted on every engine, as it was on the shared model.
  • --detect-repetition's stop is reported as one, with the new stopped_by value repetition. A run the guard stopped said stopped_by eos on the architectures' own engines and length on the shared model, and both counted the token that closed the loop, which the guard keeps from the reply. It now says repetition in --json and Stopped by: repetition loop in the footer, and generated_tokens counts what the reply has. Consumers of --json should expect stopped_by values to be added. In Python, InferResult for such a run (detect_repetition=True) has stopped_by_token false where the architectures' own engines said true, and a num_generated one lower.
  • pmetal infer --benchmark times the KV cache the run asks for on the architectures' own engines (#45). The native benchmark built every trial's cache plain: --kv-quant, --kv-k-bits / --kv-v-bits, --kv-quant-preset and --kv-qjl were selected and logged and then not used on Qwen3, Qwen3.5/3.6/3.8, Llama 4, DeepSeek V3 and gpt-oss, and neither was --kv-turboquant on Llama 4, so the rates and the peak memory were those of the model-dtype cache. Each trial now runs on a cache built by the same function generation builds it with, from Qwen weights prepared as generation prepares them for that cache (the Hadamard preconditioning, a mixed-bit preset's outlier permutation, the QJL matrix).
  • pmetal infer --benchmark runs on the shared model (#38). It loaded the model and then stopped with "only implemented for the native bridge path" on every architecture without an engine of its own (Nemotron 3.5 among them) and on every run the shared model takes (--lora, --fp8, --experts-dir). The shared model is now timed as the native engines are, as mlx_lm.benchmark does: a random prompt, greedy generation with the stop tokens off, one warm-up run, then the timed runs from an empty cache, each giving the prompt rate, the generation rate and the peak memory. Gemma 4's own engine still has no benchmark, and says so before it loads. What a benchmark cannot time is refused before anything loads: a run without --benchmark-prompt-tokens or with --profile-layers (both refused only after the load before), and one with --ane, --mtp or --draft-model, which a benchmark does not use (it times plain generation on the GPU, and used to do that without saying so). Reported by @texchi2.
  • InferResult.generation_seconds in the Python bindings is the time from the first token to the last, as its documentation says (#44). It was timed from the call into the engine, so it also held the prompt's prefill and, on the architectures' own engines, which load their weights as generation starts, the model's load. pmetal.infer_with_metrics with one token now reports 0.0 seconds of generation, as it should. A run of n tokens spans n - 1 intervals, so its decode rate is (num_generated - 1) / generation_seconds, and a single token has none.

Coming in 0.9.0

  • Config structs get builders and become #[non_exhaustive] in the same release, together with the enums that choose their options, so a new setting stops being a breaking change without the structs becoming harder to build than they are today
  • pmetal-distributed gets peer id and address types of its own in place of libp2p's, so a libp2p upgrade is no longer a breaking change
  • pmetal-merge's parse_dtype, patch_config_dtype, TensorWriter::with_dtype and TensorWriter::target_dtype take and return pmetal's own dtype in place of safetensors::Dtype, which they still use in 0.8

TL;DR: What's Changed

Full Changelog: v0.7.1...v0.8.0