paste this link into your ai. it will know what to do.
Fine-tune Thinking Machines' Inkling 2 Mini (thinkingmachines/Inkling-2-Mini, 26.4B-A3.4B/5.4B looped MoE) with LoRA on Tinker — and serve on Tinker at native 1M context, or merge losslessly in ~5.5s on a laptop CPU into standalone weights and native 17.6 GB NVFP4 GGUF (+ mmproj + DSpark) for local llama.cpp (Apple Silicon / single 24 GB GPU), vLLM, SGLang, or optional Hugging Face release. Covers the 0.6.0 silent tokenizer-fallback trap, tool-bearing thinking data, conversational self-distillation, behaviour probes, and benchmark traps.
Fine-Tuning thinkingmachines/Inkling-2-Mini on Tinker
End-to-end workflow for fine-tuning Inkling 2 Mini (26.4B total / 3.4B unique active / 5.4B effective active looped MoE; 24 physical layers with middle layers 6..17 looping 3× per token; NVFP4/MXFP8 routed experts; 1M native context; Apache 2.0) for tool-calling and reasoning agents. Built from what shipped migtissera/Tess-4.5-26B-A3B and migtissera/Tess-4.5-26B-A3B-GGUF.
For building raw JSONL trajectories from agent logs or anonymizing PII per session before starting here, pair with drost-ai/tinker-ai-skill. Everything specific to Inkling-2-Mini is self-contained in this folder.
Ground Rules
- Never spend money without showing the cost estimate and getting explicit confirmation.
prepare_dataset.py,conversational_slice.py --dry-run,train.py(without--train),merge_lossless.py, andmerge_check.py renderare 100% offline and free. - Never upload weights anywhere unless the user explicitly asks, and always create private repos first. Serving on Tinker (native 1M context), self-hosting locally (
llama.cppon Mac or a single 24 GB GPU, vLLM, or SGLang), and publishing open weights are three equal ways to finish. - Decide the adapter shape before training. The released 20.16 GB checkpoint stores routed experts in NVFP4 (
layers 0–19) and MXFP8 (layers 20–23), while the 24 physical layers' attention projections +unembedare BF16 (145tensors). - If the user may ever want standalone weights or GGUFs (to run locally, self-host, or share), keep
--adapter release(default:lora_rank=32,train_attn=True,train_mlp=False,train_unembed=True, ~26.1M params /99.5 MB). It merges losslessly in FP32→BF16 in ~5.5 seconds on a laptop CPU. - Use
--adapter full(lora_rank=8, experts adapted) only when the user confirms they will serve exclusively on Tinker. Read [references/adapter-shape.md](references/adapter-shape.md). - Guard against the
0.6.0silent tokenizer bug.tinker-cookbook < 0.7.1/tml-renderers < 0.5.0did not registerInkling-2-Miniand silently fell back toO200kBaseChatTokenizerinstead ofH200kBaseChatTokenizer. Requiretinker>=0.40.1,tinker-cookbook>=0.7.1,tml-renderers>=0.5.0, and render every row throughscripts/inkling2.py. - No 256K transplant step is needed on Tinker. Unlike
Inkling-2-Small,thinkingmachines/Inkling-2-Minitrains up to65,536tokens ($0.75/M) and itssampler_weights/<step>natively serves the full1,048,576(1M) context window on Tinker ($0.15 / $0.015 cached / $0.50per M tokens).
Workflow
Run commands from this skill's directory (or invoke scripts/*.py / scripts/*.sh by path). .env is loaded automatically.
0. Environment & Offline Sanity Checks
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install -r requirements.txt
cp -n .env.example .env # user fills in TINKER_API_KEY (and WANDB_API_KEY if desired)
python scripts/merge_lossless.py selftest1. Ask Two Up-Front Questions
- Where will the model run? - Tinker only (native 1M context, zero local hardware) → either
--adapter release(recommended default) or--adapter full. Stop after Step 5. - Local / self-hosted (llama.cppon Mac or 24 GB GPU, vLLM, SGLang) or open weights → must use--adapter release(r32, frozen experts). - What is the data? Rows of
{"messages": [...], "tools": [...], "group": "<session-id>"}in JSONL. Check the five data rules in [references/training.md](references/training.md): - Full tool registry declared on every row (--tools-fileif needed). - Grounded<|thinking|>on every assistant turn carrying loss weight (reasoning_contentis normalized automatically). - Exact serving system prompt, with paths/usernames randomized per session (never a constant/home/user). - Session IDs in"group"so windows of one session never straddle train and val.
2. Validate, Render, and Split the Dataset (Offline)
python scripts/prepare_dataset.py --input path/to/rows.jsonl --name my-runInspect <out-dir>/my-run.report.json and any ADVICE: lines:
- Check
rows_opening_with_tool_callandassistant_turns_with_thinking. - Report
tokens.trainandestimated_train_cost_per_epoch_usd($0.75 / Mtrain tokens; e.g.46.9Mtokens =$35.17).
3. Add a Self-Distilled Conversational Slice (Recommended; Paid Sampling)
If >90% of fresh sessions open with a tool call, the fine-tune will call Bash on "Hey there!". Sample ~10% plain-text greeting, conceptual, planning, and ambiguous scenarios from thinkingmachines/Inkling-2-Mini itself:
# Free dry run first: show sample scenarios and cost bound (<$1 typical for 150 rows)
python scripts/conversational_slice.py --source-rows path/to/rows.jsonl --n 150 --out data/conversational --dry-run
# After user confirms cost:
python scripts/conversational_slice.py --source-rows path/to/rows.jsonl --n 150 --out data/conversational
python scripts/prepare_dataset.py --input path/to/rows.jsonl --input data/conversational.jsonl --name my-runDetails in [references/behaviour.md](references/behaviour.md).
4. Smoke-Test Offline, Confirm Cost, Then Train on Tinker
# Always run offline smoke test first (free):
python scripts/train.py --dataset data/datasets/my-run --adapter release
# Only after user approves the printed plan & cost estimate:
python scripts/train.py --dataset data/datasets/my-run --adapter release --train --wandb-project my-projectDefaults (lr=1e-4, linear decay, batch_size=8, epochs=1, lora_rank=32 on release) come from the Tess-4.5-26B-A3B run (test/nll 0.874 → 0.808, held-out NLL 0.792 → 0.738). Confirm [lora] async create_lora_training_client_async ... train_mlp=False appears in startup logs.
5. Behaviour Probe: Base Model First, Then Every Checkpoint
python scripts/probe.py --dataset data/datasets/my-run --model thinkingmachines/Inkling-2-Mini -n 8 --allow 3
python scripts/probe.py --dataset data/datasets/my-run \
--model tinker://<run-id>:train:0/sampler_weights/final -n 8 --allow 1If the user is serving on Tinker, stop here. Their OpenAI-compatible model name is tinker://<run-id>:train:0/sampler_weights/final at https://tinker.thinkingmachines.dev/services/tinker-prod/oai/api/v1 (native 1M context). Remind them to delete unused intermediate checkpoints (000020…000120) once they pick a winner.
6. Lossless Local Merge (~5.5 Seconds on Laptop CPU)
Only run Steps 6–8 if the user wants local/self-hosted weights or plans to publish. Needs ~42 GB disk, ~32 GB RAM, no GPU:
tinker checkpoint download tinker://<run-id>:train:0/weights/final --output ./adapters
# (Extract the .tar archive into ./adapters/final/ if downloaded as a tarball)
hf download thinkingmachines/Inkling-2-Mini --local-dir ./base/Inkling-2-Mini
python scripts/merge_lossless.py check \
--adapter-dir ./adapters/final \
--base-index ./base/Inkling-2-Mini/model.safetensors.index.json
python scripts/merge_lossless.py merge \
--base-dir ./base/Inkling-2-Mini \
--adapter-dir ./adapters/final \
--out-dir ./merged/my-inkling2-mini7. Verify the Merged Weights
- On
llama-serveror vLLM: runscripts/probe.py --dataset data/datasets/my-run --model <served-alias> --base-url http://127.0.0.1:8787/v1 --api-key-env NONE -n 8 --allow 1. - On SGLang (exact token-by-token logprob check): run
scripts/merge_check.py(render→tinker→sglang→compare) to verify masked NLL matches Tinker within kernel noise.
8. Serve Locally (llama.cpp NVFP4 GGUF, vLLM, or SGLang) — and Optionally Publish
See [references/export-merge-serve.md](references/export-merge-serve.md) and [references/long-context.md](references/long-context.md) for full hardware recipes:
# Convert merged HF -> 17.6 GB native NVFP4 GGUF + 642 MB mmproj + 749 MB DSpark
LLAMA_CPP=~/src/llama.cpp PYTHON=.venv/bin/python \
./scripts/make_gguf.sh ./merged/my-inkling2-mini ./gguf/my-inkling2-mini My-Inkling2-Mini
# Serve on Apple Silicon Mac (32 GB+): 256K ctx + vision + DSpark (~49-68 tok/s)
PROFILE=metal LLAMA_CPP=~/src/llama.cpp \
./scripts/serve_gguf.sh ./gguf/my-inkling2-mini/My-Inkling2-Mini-NVFP4.gguf
# Serve on a single 24 GB GPU (RTX 4090): flat 23.3 GiB at 256K ctx, q8_0 KV, --fit off (~74-92 tok/s)
PROFILE=cuda24 LLAMA_CPP=~/src/llama.cpp \
./scripts/serve_gguf.sh ./gguf/my-inkling2-mini/My-Inkling2-Mini-NVFP4.ggufIf and only if the user asks to publish on Hugging Face, create --private repos first, verify remote lfs.oid SHA-256 hashes against local files, include Apache 2.0 attribution to thinkingmachines/Inkling-2-Mini, and never make a repo public until explicitly instructed.
Reference Index
- [references/model-facts.md](references/model-facts.md) — 26.4B-A3.4B/5.4B looped MoE layout, 145 BF16 targets,
0.6.0tokenizer trap, native 1M Tinker window, pricing - [references/adapter-shape.md](references/adapter-shape.md) —
--adapter release(r32, 99.5 MB) vs--adapter full(r8), sync+async SDK patch,adapter_config.jsonquirk - [references/training.md](references/training.md) — Five data rules, group split,
lr=1e-4curves ($35.17), checkpoint cleanup - [references/behaviour.md](references/behaviour.md) — Stopping greeting tool-call drift with
conversational_slice.pyandprobe.py - [references/long-context.md](references/long-context.md) — 64K train → native 1M Tinker sample, 98.6% prompt caching, Mac & 24 GB GPU KV budgets
- [references/export-merge-serve.md](references/export-merge-serve.md) — 5.5s local merge, native NVFP4 GGUF (
PR #33062),llama-server/ vLLM / SGLang, private-first HF upload - [references/evaluation.md](references/evaluation.md) —
Tess-4.5-26B-A3Bbenchmarks (82.4%SWE-Bench Pro Hard,67.2%LongBench v2 @ 1M) & Harbor/Pier traps - [references/lessons-learned.md](references/lessons-learned.md) — Distilled post-mortem of every bug hit along the way
keep it where your ai can reach it.
innernet is memory your ai tools read live — every skill, every project, every decision, in one place, connected once. save this skill to yours, or publish one of your own as a link like this.