accuracy-safe-quantization

accuracy-safe-quantization is a skill for Claude Code, Codex from google-ai-edge/litert-samples. It costs 92 tokens per session (2,541 once invoked), scanned A, original, Apache-2.0.

A procedure for shrinking converted LiteRT machine-learning models by changing their number format to fp16, int8, or int4 while checking their results.

In plain words
What is it for?
Use it to choose a quantization recipe, export the smaller model, compare it with the original float model on a task check, and verify it on the target device.
Why use it?
It helps reduce model file size without accepting unverified accuracy loss or deployment failures.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/google-ai-edge/litert-samples/accuracy-safe-quantization
Any agent
npx skills add google-ai-edge/litert-samples --skill accuracy-safe-quantization
Clone the repo
git clone --depth 1 https://github.com/google-ai-edge/litert-samples

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for accuracy-safe-quantization

README.md
[![agentmods](https://agentmods.dev/badge/skills/google-ai-edge/litert-samples/accuracy-safe-quantization.svg)](https://agentmods.dev/skills/google-ai-edge/litert-samples/accuracy-safe-quantization)
Your own site
<a href="https://agentmods.dev/skills/google-ai-edge/litert-samples/accuracy-safe-quantization"><img src="https://agentmods.dev/badge/skills/google-ai-edge/litert-samples/accuracy-safe-quantization.svg" alt="Measured on agentmods" height="20"></a>
Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,541 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00092 $0.02541
Opus 5 $0.00046 $0.01270
Sonnet 5 $0.00018 $0.00508
Haiku 4.5 $0.00009 $0.00254

Measured 5d ago against content hash 8dad72da9177, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

accuracy-safe-quantization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/accuracy-safe-quantization/SKILL.md · 174 lines

How it starts

The opening of the file, as written. The whole thing — 174 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Accuracy-safe quantization

A quantization is done when three things hold, in this order:

  1. it exports and the file shrinks by what the recipe predicts,
  2. output parity with the float source holds on a task-level check, not just a smoke test,
  3. the quantized model still passes the deployment check on the target runtime and device.

Quantization rewrites the graph, so step 3 is a fresh obligation every time: re-run the same CompiledModel verification you used to accept the float conversion (see the gpu-clean-conversion skill), then the on-device numerical check.

All recipes below are ai-edge-quantizer (pip install ai-edge-quantizer), plain Python, no build step. Worked examples live in this repo under models/bonsai/bonsai_image_4b/converted/ and models/qwen/qwen3_tts/converted/.

Choosing a lane

Start with the lightest recipe that meets the size budget, and move down only on evidence:

Budget / model Recipe
~2× smaller, zero risk fp16 float-casting. Weights cast to fp16, compute stays float. On a GPU that already computes in fp16 this is close to free numerically — verify anyway
~4× smaller — encoders, conv nets, diffusion blocks Dynamic-range int8 channelwise. int8 weights, float activations; this shape rides the GPU delegate
Dynamic int8 lost quality (conditioning, embeddings) Weight-only, same bits. Inserts an explicit DEQUANTIZE so the matmul runs in float and activations are never quantized — more quality, some latency
~7× smaller — LLM / autoregressive decoders int4 blockwise-32 + OCTAV, embeddings int8. Never channelwise for a decoder: it looks fine on short outputs and degenerates over long generations
Data-free int4 still fails the task gate Calibrated ingest. Take a GPTQ checkpoint and preserve its grid with DEQUANTIZED_WEIGHT_RECOVERY — see the routing table

Full-integer static quantization (static_wi8_ai8 — quantized activations, calibration data required) is a different lane aimed at NPU/AOT targets and is not covered here.

Read the full file on GitHub · 174 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 174 lines · 92 tokens per session scan A 8dad72da9177

Subscribe to this mod's changes

accuracy-safe-quantization is a skill published in the GitHub repository google-ai-edge/litert-samples (416 stars, last pushed yesterday), licensed Apache-2.0. It adds 92 tokens to every session and 2,541 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

repomix-explorer

Analyze or explore a codebase (remote or local repository) by packing it with the Repomix CLI, then reading and searching the generated output. Use when the user wants a high-level understanding of an unfamiliar or large repo, not a targeted edit. Trigger for: Structure/overview: "analyze this repo", "what's the…

yamadashy/repomix · 227 tokens

repomix

Pack and analyze codebases into AI-friendly single files using Repomix. Use when the user wants to explore repositories, analyze code structure, find patterns, check token counts, or prepare codebase context for AI analysis. Supports both local directories and remote GitHub repositories.

yamadashy/repomix · 58 tokens

agent-carnet

Use this skill when the user asks to save, recall, find, or organize notes. Triggers on: 'remember this', 'save this', 'note this', 'what did we discuss about...', 'check the notebook', 'find in carnet'. Also use proactively when discovering findings worth preserving across sessions.

yamadashy/repomix · 67 tokens

google-agents-cli-scaffold

This skill should be used when the user wants to "create an agent project", "start a new ADK project", "build me a new agent", "add CI/CD to my project", "add deployment", "enhance my project", or "upgrade my project". Part of the agents-cli skills suite. Covers agents-cli scaffold create, scaffold enhance, and…

google/agents-cli · 135 tokens

graph-mutation-plan

Cookbook for composing an applygraphmutations plan — stable entitykey patterns, the canonical label/edge vocabulary, evidence/invalidation/confidence discipline, and a worked example. Load this when building a non-trivial mutation plan.

potpie-ai/potpie · 51 tokens

opsec

Operational security management — traffic shaping, scan rate limiting, source IP management, tool signature avoidance, evidence handling, anti-detection patterns.

PurpleAILAB/Decepticon · 30 tokens