solo-model-shrink

solo-model-shrink is a skill for Claude Code from fortunto2/solo-factory. It costs 120 tokens per session (1,571 once invoked), scanned A, original, MIT.

A model-conversion workflow for making a trained neural network smaller and usable on devices such as phones, browsers, and other edge hardware. It covers formats such as ONNX and Core ML, plus reduced-precision formats such as int8.

In plain words
What is it for?
It is for exporting models, reducing their size, converting them for Apple devices or ONNX-compatible systems, benchmarking on-device performance, and delivering model downloads when needed.
Why use it?
It helps when a machine-learning model is too large for an app or needs to run directly on a device.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: built for openclaw.

Part of the solo plugin — 45 skills, 2 commands, 3 agents, 3 hooks shipped together

Good fit It is for exporting models, reducing their size, converting them for Apple devices or ONNX-compatible systems, benchmarking on-device performance, and delivering model downloads when needed.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fortunto2/solo-factory/model-shrink
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 fortunto2/solo-factory --skill model-shrink
Clone the repo
git clone --depth 1 https://github.com/fortunto2/solo-factory

Made for: Claude Code.

Or install solo, the plugin that ships this one along with the rest of its 45 skills, 2 commands, 3 agents, 3 hooks.

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 solo-model-shrink

README.md
[![agentmods](https://agentmods.dev/badge/skills/fortunto2/solo-factory/model-shrink/github.svg)](https://agentmods.dev/skills/fortunto2/solo-factory/model-shrink)
Your own site
<a href="https://agentmods.dev/skills/fortunto2/solo-factory/model-shrink"><img src="https://agentmods.dev/badge/skills/fortunto2/solo-factory/model-shrink/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 solo-model-shrink

Your own site · 80×15
<a href="https://agentmods.dev/skills/fortunto2/solo-factory/model-shrink"><img src="https://agentmods.dev/badge/skills/fortunto2/solo-factory/model-shrink.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 120 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,571 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.00120 $0.01571
Opus 5 $0.00060 $0.00785
Sonnet 5 $0.00024 $0.00314
Haiku 4.5 $0.00012 $0.00157

Measured 10d ago against content hash a8d911568dc3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

solo-model-shrink scanned grade A with 1 finding 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 10d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

one-curl measurement on a real device over Wi-Fi.
skills/model-shrink/SKILL.md · 101 lines

How it starts

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

model-shrink — ship a trained model to phones and browsers

A PyTorch checkpoint becomes: an eval, an ONNX int8 file (web/Android), a Core ML package (Apple), an on-device number, and a download-on-demand delivery. Every step below was paid for once; the order is the method.

Workflow

  1. Eval before anything. Ground truth + one scalar metric (F-measure, accuracy — whatever the task has) + a script that runs any model variant against it. Every later decision — quantize? fp16? distill? — is this script's output, never a guess. Keep 5–10 held-out samples as a smoke set.
  2. Export ONNX at a fixed shape (torch.onnx.export, one export per batch size — see Gotchas). Verify against the original: max abs diff and the eval score. onnxruntime CPU is the portable baseline: web (onnxruntime-web WASM), Android (ORT mobile), desktop.
  3. Quantize weights to int8 (onnxruntime.quantization / ct.optimize.coreml.linear_quantize_weights). Weights-only int8 is usually free — measured twice on a 20M-param transformer: F 0.872→0.871 (ONNX) and 0.864→0.863 (Core ML), 4x smaller. Re-run the eval anyway; "usually" is not "always".
  4. Apple: convert to native Core ML (coremltools), never the ORT Core ML execution provider (see Don't). Conversion of transformer-ish models fails on Python-int shape math; the fixes that work:
    • Replace einops layers/rearrange with explicit permute/reshape.
    • Bake shapes as constants: capture tuple(int(s) for s in x.shape) on a module attribute during a warm eager pass, use those ints in forward — the trace then contains zero aten::size/aten::Int ops. Fixed export shape makes this sound.
    • Derive dims from weights (linear.out_features), not from tensors.
    • After EVERY replacement: run the model, assert max abs diff ≈ 0 vs the original. A stack of "obviously equivalent" rewrites drifts; a stack of asserted ones doesn't.
  5. Identify failing ops by graph census, not by reading code. When the converter names a node (blocks/0/partial/76), dump ts.inlined_graph, filter nodes by scope and kind (aten::Int, aten::size, prim::NumToTensor), and match. The class you think is in the call path may be a similarly-named neighbour that is never called — a patch that changes nothing (diff 0.000e+00 because the code never ran) looks exactly like a patch that is perfectly equivalent.
  6. Benchmark on the target device, with the model's native window size and deterministic non-zero input. Compare compute units (cpuOnly, GPU, ANE) per model — a rotary-attention transformer measured 2x FASTER on iPhone CPU than on the ANE, and the ANE's first load cost 43s of one-time compilation. Dev-machine numbers do not transfer; a busy dev machine's numbers don't even reproduce.
  7. Deliver as a download, not in the bundle. Tens of MB belong in a FaceModelStore-style on-demand store: download → MLModel.compileModel → Application Support (excluded from backups) → validate by loading before declaring installed. An .mlpackage is a directory: host it as its files under one base URL (Manifest.json, Data/com.apple.CoreML/model.mlmodel, Data/com.apple.CoreML/weights/weight.bin) and pin that list with a test.
  8. Leave a bench door open: a debug HTTP endpoint in the app that loads the installed model and times N predicts turns every future variant into a one-curl measurement on a real device over Wi-Fi.

Read the full file on GitHub · 101 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. 10d ago First seen · 101 lines · 120 tokens per session scan A a8d911568dc3

Subscribe to this mod's changes

solo-model-shrink is a skill published in the GitHub repository fortunto2/solo-factory (18 stars, last pushed today), licensed MIT. It adds 120 tokens to every session and 1,571 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). 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

axiom-foundation-models

Use when implementing on-device AI with Apple's Foundation Models framework — prevents context overflow, blocking UI, wrong model use cases, and manual JSON parsing when @Generable should be used. iOS 26+, macOS 26+, iPadOS 26+, axiom-visionOS 26+.

ComeOnOliver/skillshub · 67 tokens

axiom-foundation-models-ref

Reference — Complete Foundation Models framework guide covering LanguageModelSession, @Generable, @Guide, Tool protocol, streaming, dynamic schemas, built-in use cases, and all WWDC 2025 code examples.

ComeOnOliver/skillshub · 49 tokens

axiom-ios-ai

Use when implementing ANY Apple Intelligence or on-device AI feature. Covers Foundation Models, @Generable, LanguageModelSession, structured output, Tool protocol, iOS 26 AI integration.

ComeOnOliver/skillshub · 42 tokens

axiom-ios-vision

Use when implementing ANY computer vision feature - image analysis, object detection, pose detection, person segmentation, subject lifting, hand/body pose tracking.

ComeOnOliver/skillshub · 34 tokens

axiom-ios-ml

Use when deploying ANY machine learning model on-device, converting models to CoreML, compressing models, or implementing speech-to-text. Covers CoreML conversion, MLTensor, model compression (quantization/palettization/pruning), stateful models, KV-cache, multi-function models, async prediction, SpeechAnalyzer…

ComeOnOliver/skillshub · 74 tokens

foundation-models-on-device

Apple FoundationModels framework for on-device LLM — text generation, guided generation with @Generable, tool calling, and snapshot streaming in iOS 26+.

Jamkris/everything-gemini-code · 38 tokens