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 — 57 skills, 2 commands, 2 agents, 5 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 57 skills, 2 commands, 2 agents, 5 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.5 $0.00048 $0.00628
Sonnet 5.5 $0.00024 $0.00314
Haiku 4.5 $0.00012 $0.00157

Measured 2mo ago against content hash a8d911568dc3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 (19 stars, last pushed 4d ago), licensed MIT. It adds 120 tokens to every session and 1,571 once invoked, about $0.0005 per session on Opus 5.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

ml-kit-genai-prompt-api

Analyzes Android codebases to implement ML Kit GenAI Prompt API. Use this skill to send natural language requests on-device to Gemini Nano, use structured output with Prompt API, implement prefix caching, optimize the current prompt, or apply best practices.".

android/skills · 57 tokens

working-with-coreai

Use this skill whenever the user mentions coreai-torch, TorchConverter, coreai-build, AIModel, AIProgram, .aimodel, or wants to export/compile/run a PyTorch model on Apple silicon (iPhone, iPad, Mac). Also triggers for "deploy on device", "optimize for on-device performance", onboarding new models to Core AI, or…

apple/coreai-models · 91 tokens

litert-runtime

Configures and implements LiteRT (.tflite) on-device inference on Android in Kotlin using the CompiledModel API on CPU and GPU. Use this skill for any Android LiteRT or .tflite task, including Gradle setup, image classification or vision/audio/embedding helpers, TensorBuffer reuse, CPU memory optimization, Bitmap…

android/skills · 150 tokens

model-authoring

Empirical rules for authoring PyTorch models for on-device execution on Apple platforms, covering energy-efficient inference, scalable compute, and correctness testing. Use this skill whenever the user is writing, debugging, or reviewing PyTorch model code intended for on-device execution — even if they don't…

apple/coreai-models · 95 tokens

datachain-knowledge

Use whenever datasets, cloud storage buckets, or data pipelines are mentioned — creating, saving, querying, listing, exploring, deleting, or processing data in S3, GCS, Azure Blob, or local storage. Also use when running any script that may create datasets as a side effect. Maintains a knowledge base at dc-knowledge/…

datachain-ai/datachain · 104 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+.

hashgraph-online/awesome-codex-plugins · 38 tokens