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,638 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

Written for no agent in particular: nothing here depends on one.

Good fit 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.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/google-ai-edge/litert-samples/accuracy-safe-quantization
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for accuracy-safe-quantization

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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,638 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00092 $0.02638
Opus 5.5 $0.00037 $0.01055
Sonnet 5.5 $0.00018 $0.00528
Haiku 4.5 $0.00009 $0.00264

Measured 27d ago against content hash 128df31e7990, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 27d 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 · 176 lines

How it starts

The opening of the file, as written. The whole thing — 176 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; 0.9.0 as of 2026-10, which pins ai-edge-litert 2.2.0 on the host), 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. A blockwise recipe needs the quantized dimension divisible by the block (a 3-input linear fails block-32 with Quantized dimension 3 … is not divisible)
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

Read the full file on GitHub · 176 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. 27d ago Changed · +2 lines 128df31e7990
  2. 2mo 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 (486 stars, last pushed yesterday), licensed Apache-2.0. It adds 92 tokens to every session and 2,638 once invoked, about $0.0004 per session on Opus 5.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

adversarial-ml-evasion

Craft adversarial examples that cause trained ML classifiers to misclassify at inference time — image recognition, malware detectors, IDS, spam filters.

PurpleAILAB/Decepticon · 36 tokens

llm-redteam-overview

LLM red team category — full AATMF v3 tactic coverage (T01–T15). Routing skill: read this first to identify which tactic applies, then load the matching sub-skill. Maps to MITRE ATLAS where overlap exists.

PurpleAILAB/Decepticon · 58 tokens

misinformation

Hunt LLM misinformation / overreliance (OWASP LLM09:2025) — confident-but-wrong outputs that flow into downstream automated decisions, compliance reports, customer communications, or autonomous code commits without verification.

PurpleAILAB/Decepticon · 49 tokens

sensitive-information-disclosure

Hunt LLM sensitive-information disclosure (OWASP LLM02:2025) — leakage of PII, secrets, internal source, model details, and other-tenant data through model outputs, training-data extraction, or retrieval-side joins.

PurpleAILAB/Decepticon · 55 tokens

vector-and-embedding-weaknesses

Hunt vector / embedding weaknesses (OWASP LLM08:2025) — adversarial inputs against the RAG / similarity layer that cause cross-tenant leak, embedding-inversion privacy loss, semantic confusion, and retriever-driven prompt injection.

PurpleAILAB/Decepticon · 59 tokens

aatmf-t12-rag-poisoning

AATMF T12 — RAG & Knowledge Base Manipulation. PoisonedRAG, vector store flood, embedding collision, retrieval-bias attacks.

PurpleAILAB/Decepticon · 41 tokens