Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 8 min read Case study mediumAdept

Transformers Model Integration Contracts

Model Integration Contracts (MICs) package fast CPU integration tests for Transformers: a shrunk fixture model built from a real checkpoint's config (keeping every layer kind, tokenizer files and weight format), a runnable Markdown usage path, and human-reviewed baseline outputs. Replaying frozen MICs over five months of commits, a 66 MB UMT5 fixture caught an SDPA regression that let the decoder attend to future tokens, a bug that sat in main for two months. The check took 13.4 seconds on CPU, and it caught the bug only because the contract ran through the default SDPA path rather than eager attention. Overfitting fixture weights on a few examples raised Whisper's injected-fault detection from 18/24 to 24/24, though the tradeoffs are unsettled and the CI job is currently non-blocking.

Assumes: Hugging Face TransformersPyTorch model basicsCI testing

Related posts

  • Transformers now runs llama.cpp quants

    Hugging Face mediumAdept

    Hugging Face transformers can now load GGUF (llama.cpp) quantized checkpoints via `from_pretrained(..., gguf_file=...)` and serve them through `transformers serve` with an OpenAI-compatible API. Weights stay packed on Apple Silicon, and ggml's Metal kernels are reused via the `kernels` library for quantized matmul, fused RMSNorm, flash attention, gated delta nets and MoE top-k routing. Two `generate` changes, dropping all-ones padding masks and deferring the stopping check asynchronously, cut CPU-GPU synchronization for all models. Benchmarks on an M2 Max show throughput close to llama-bench for Qwen3.5 dense and MoE checkpoints, though llama.cpp remains the recommended engine for pure local inference. The initial packed path is MPS-only, and padded batching is still slower.

  • Accelerating Gemini Nano models on Pixel with frozen Multi-Token Prediction

    Google Research hardMaster

    Google retrofits a Multi-Token Prediction (MTP) head onto frozen, already-deployed Gemini Nano v3 models to speed up on-device speculative decoding on Pixel 9 and 10 phones. A lightweight transformer head attached to the final layers drafts future tokens from the backbone's hidden states and cross-attends directly to the main model's KV cache. This removes drafter prefill latency and saves about 130MB per instance compared with a standalone drafter. Because the backbone stays frozen and drafts are verified, output is bit-for-bit identical to the base model, and no per-task drafter fine-tuning is needed. Reported gains are 50%+ speedups over comparable standalone drafters, up to 55% better token acceptance on structured tasks like smart replies, and nearly two extra accepted tokens per pass in production features like Notification Summaries and Proofread.

  • Run, Test, and Evaluate Models and MCP Locally with Docker + Promptfoo

    Docker mediumAdept

    Promptfoo, Docker Model Runner and Docker MCP Toolkit can be combined to evaluate LLM apps entirely on a dev machine. Three worked configs are shown. The first compares local Gemma3 against Claude Opus 4.1 using llm-rubric and similarity assertions, graded by local smollm3 and mxbai embeddings instead of OpenAI. The second tests MCP tools directly (GitHub, Fetch, Playwright, YouTube transcript) through the MCP gateway. The third red-teams a GitHub-summarizer agent with MCP, PII, BOLA and BFLA plugins plus jailbreak and prompt-injection strategies, which exposed a tool-discovery vulnerability that was fixed with a prompt guideline.

  • Productizing Large Language Models

    Replit mediumAdept

    Replit runs transformer models from ~100M parameters (search, spam) through 1-10B (GhostWriter code autocomplete) to 100B+ in production, and shares lessons on making them usable. Nonsense and repetition loops are handled with temperature and frequency penalty tuning, cycle detection, multi-temperature sampling, reranking with a second model, and fine-tuning on user feedback. Quality is tracked with HumanEval, loop and nonsense rates, and A/B tests. Inference cost is cut with FasterTransformer, distillation and quantization, and GPUs are run at 70-80% utilization on Kubernetes so request queues stay bounded while autoscaling has headroom.

  • Welcome Muse Spark Open: open-weight frontier multimodal mixture-of-experts model from Meta

    Hugging Face mediumAdept

    Muse Spark Open is Meta's open-weight multimodal mixture-of-experts model with ~816B total and ~42B active parameters, 256 experts per layer with 8 routed per token, a 1M-token context, and text, image, audio and video inputs producing text output, aimed at agentic coding. The architecture uses 62 layers with grouped-query attention (128 query and 16 KV heads), QK-norm, gated residuals, a 1.8B perception encoder and a convolutional audio encoder emitting 12.5 tokens per second. The KV cache costs about 250 KB per token, or ~266 GB at 1M tokens. BF16 weights (~1.5 TB) need 4×8 H200 nodes and NVFP4 fits a single B200 node. Transformers examples cover tensor and expert parallelism, reasoning-effort levels, image, video and audio inputs, and tool calling.

The quest for software engineering knowledge.

Look:
Layout: