Skip to content

Nanotune v1.8.0

Latest

Choose a tag to compare

@github-actions github-actions released this 25 Nov 12:15
· 10 commits to main since this release
e667223

What's Changed

Minor Changes

  • Added nanotune benchmark review [report], which turns failed benchmark tests into training data. It loads a saved run (the latest by default, or one named the same way benchmark compare accepts) and walks each failure one at a time, showing the prompt or full conversation, the acceptable answers, and what the model actually said. Type a corrected answer and it is appended to train.jsonl with the project's context message, the same way /keep does in nanotune chat; multi-turn failures keep their earlier turns. Leave the input blank to skip a failure, or press Esc to stop early and see how many were saved. A run with no failures says so and exits. The benchmark run itself is untouched, so a report can be reviewed any time after it was produced. Thanks to @addyCooks. Closes #178.
  • Added nanotune clean --target <fused|base|all> to also cover the shared base-model cache alongside the fused-model cache, and hardened the completeness checks behind both: an interrupted multi-shard fuse or a permission error reading a cache directory no longer produces a false "usable" or crashes nanotune status/nanotune clean. Thanks to @rohanshrma222. Closes #125.
  • nanotune data import gains a --headerless flag for CSV files. The importer used to auto-detect a header by checking whether the first row was exactly input/output, which meant a headerless file whose first data row genuinely was that literal pair got silently dropped as a "header". Passing --headerless skips auto-detection entirely so that row always imports as data; default behaviour is unchanged. Thanks to @akramcodez. Closes #136.
  • Stop a training run when validation loss stops improving, and atomically restore the exact weights evaluated as best over adapters.safetensors. Selection uses a private per-run snapshot at the MLX validation callback rather than numbered checkpoints from earlier runs. Record early-stop and restoration outcomes in training history. Patience defaults to 0, so existing runs are unchanged. Closes #207.
  • Generate a Hugging Face-style model card beside exported GGUF files, including training settings, dataset counts, and matching saved benchmark results. Publish the card atomically while preserving existing README files, and report card-generation failures as warnings without failing a completed GGUF export.
  • nanotune benchmark --json now prints the finished run as a single JSON document on stdout — the same document already written to .nanotune/benchmarks/benchmark-<timestamp>.json, so there is one schema rather than two. Progress goes to stderr, since a suite can take minutes and stdout must stay one document. The run itself moves out of the command component into runBenchmark in src/lib/benchmark-run.ts, an async generator both the Ink view and the JSON path consume, and BenchmarkResult gains an optional warning so a partial run is distinguishable from a complete one with a worse pass rate. A bad --preset now fails immediately instead of after the base model downloads. Thanks to @yashksaini-coder. Closes #69 for benchmark.
  • nanotune status --json and nanotune data validate --json now print a single JSON document to stdout, so the read-only commands can be consumed by scripts and CI. Diagnostics and the unknown-config-key warnings go to stderr; Ink never renders in this mode. The schema is documented in docs/guides/json-output.md and the ValidationResult now exposes duplicateInputs and inconsistentContextMessages counts that both views read rather than pattern-matching warning prose. Thanks to @yashksaini-coder. Closes #69 for status and data validate.
  • Persist local training run history with the effective model settings, dataset counts, duration, outcome, and separate training/validation loss reports. Records are saved before training and refreshed during the run so interrupted runs retain their history. nanotune status shows settings and outcome for the current adapter, including checkpoints from failed runs, and nanotune runs lists recent runs or exports their complete loss histories as JSON. Resumed runs reference the prior adapter run when available.
  • nanotune data validate now intersects the normalized user inputs of
    train.jsonl and valid.jsonl and warns when any appear in both. A split
    produces disjoint sets, but the two files can drift apart afterwards — a
    hand-edit, a re-import, or an interrupted split — and an example the model
    trained on scores misleadingly well in validation. The report gains a
    trainValidOverlap count and a checks.noTrainValidOverlap verdict, so the
    finding is machine-readable rather than only prose, and --eval reports the
    same overlap from the validation side. Warning-only: valid, the exit code and
    what is on disk are all unchanged.
  • Warn during data validate when an example looks longer than maxSeqLength. The check estimates tokens from the character count and does not fail validation. Closes #206.

Patch Changes

  • Appending a training example to train.jsonl or valid.jsonl no longer glues it onto the previous line when the file does not end in a newline, which corrupted both examples. nanotune data add, data import and chat's /keep now start a new line first. Thanks to @addyCooks. Closes #217.
  • Fix a crash-safety gap where an interrupted train/validation split could
    permanently lose the held-back validation examples. saveTrainingData now
    writes through the existing atomic file-write helper, and the split writes
    valid.jsonl before truncating train.jsonl, so an interruption between the
    two writes can at worst leave a recoverable duplicate — never a loss.
  • Leave the benchmark display prompt empty when a multi-turn test contains no user message, instead of showing an assistant answer or system instructions as the prompt. Closes #143.
  • nanotune benchmark --timeout now also bounds the LLM-judge call. Previously --timeout only covered inference, so a judge provider that accepted the connection but never answered would lock the whole run on a single test, with the AI SDK's default retry policy sitting on top re-issuing the request nobody was timing. Judging gets its own budget of --timeout (a second model call, not the inference one), callJudge forwards the signal into generateText so retries are cancelled too, and a timed-out judge fails the sample, leaves judgeScore unset, and records the reason ("Judge timed out after Nms") in judgeReasoning so the report does not read as the model scoring 0. Thanks to @addyCooks. Closes #132.
  • Use a unique, private temporary file for each judge configuration save so concurrent processes cannot overwrite or remove each other's pending API-key configuration. Failed saves clean up their own temporary file, and the final configuration remains atomically replaced with owner-only permissions.

Closes #145.

  • Writes to the training data are now serialized between nanotune processes, fixing silent data loss when two of them ran at once.

Starting a data import and then using /keep in a chat session, or pressing d in data list while an import was running, lost examples without any error. A split reads train.jsonl and writes both halves back through a temp file and a rename; an append landing between the read and the rename went to the file the rename had already replaced, and vanished. Every command that writes now takes a lock on .nanotune/data.lock for the length of one read-modify-write, so the second waits instead of overwriting.

Also fixed, and not named in the issue:

  • nanotune data import took the lock once per row, so a split starting halfway through would leave the rows imported before it in valid.jsonl and the rows after it in train.jsonl — an import that reported success and had silently become part of the validation set. An import is now one locked step.
  • deleteExample, updateTrainingExample, dedupeExamples and fixContextMessages lost the same way, which is data list pressing d or e, and data validate --fix, during an import.
  • nanotune train counted the validation set and then decided to split, without a lock in between. Two train runs on a fresh project both saw no validation set, both split, and the second discarded the first's.
  • data validate --fix rewrote context messages and then deduped as two separate steps, so a write in between left the reported counts describing a file that no longer matched.
  • appendTrainingExample checked whether the file ended in a newline and then appended. Two processes both seeing no trailing newline both wrote one, leaving a blank line that data validate then reported as malformed.

A lock left behind by a process that was killed is taken over by the next command, so a crash mid-import no longer leaves the project permanently unwritable. A lock held by another machine is never taken over, because on a shared home directory that process's pid means nothing here.

One deliberate consequence: /keep, data list and data validate now wait for a long data import to finish rather than writing alongside it. There is no "waiting" message, because every command that can block is an interactive screen that owns the terminal.

Reads are deliberately not locked. A read that races a write can only observe a state that genuinely existed, and locking them would stop nanotune status answering for the length of an import.

Closes #196.

  • Detach the training abort listener once a run finishes, so aborting a reused signal later no longer sends SIGINT to a closed subprocess.
  • nanotune benchmark now errors with Benchmark dataset is empty (<path>). Add at least one test. when tests.json is an empty array, before any model is loaded or downloaded. Previously the run would proceed, write a result file with passRate: null (the result of 0/0 = NaN serialised by JSON.stringify), and benchmark compare would later read it as a believable 0% regression against any healthy baseline. The dataset is now also validated before any model/sampling work, so a bad file fails immediately rather than after a multi-gigabyte download. Closes #163.
  • Fix data list edit overwriting the first turn when editing any other turn of a multi-turn example. mergeEditedTurn used to locate the turn to replace with messages.findIndex(m => m.role === 'user'/'assistant'), which always resolved to the first turn regardless of which one was being edited — the UI worked around this by only ever allowing turn 1 to be edited. mergeEditedTurn now takes an explicit turn index and locates that turn's messages by position, and data list's e key now shows a turn picker for multi-turn examples so any turn can be selected and edited without disturbing the others. Closes #135.
  • Warn about unknown configuration keys inside nested array objects and union branches.
  • Fixes found by a release smoke test. llama.cpp installs again: releases are picked from the recent list rather than GitHub's placeholder "latest", and the convert script's conversion package is installed with it. GGUF conversion now installs PyTorch when it is missing, so export and benchmark --base no longer fail with a torch import error. A download that fails no longer crashes train with a stack dump. data import exits 1 when nothing was imported, and validate --fix reports unreadable data instead of crashing. Numeric flags to benchmark and chat are checked before anything runs, so --ctx-size 4096x and --gpu-layers abc are rejected rather than passed to llama-server. Training loop settings must be positive, which stops --save-every 0 from failing deep in mlx_lm. If you upgrade: these are checked whenever config.json loads, so a hand-edited value that is now out of range (a zero or negative count, or numLayers other than -1 or a positive integer) makes every command report Invalid config.json until it is corrected. Imported records without a context message get the project's. Ctrl+C stops benchmark and export instead of leaving the work running. A data lock left by a process that crashed on the same machine is reclaimed at once, and one with no readable owner after a minute; a lock held elsewhere is reported after 60 seconds rather than 5 minutes, and a read-only project fails at once. A benchmark whose server dies mid-run leaves the interrupted test out of the score. Fixes #137, #134 and #219.
  • Fixed an issue where judge configure could save an API key without a project directory or fail to ignore it in git. Thanks to @addyCooks. Closes #127.
  • Literal API keys in judge.json that contain a $ are no longer truncated by environment-variable expansion. Only the documented ${VAR} and ${VAR:-default} forms are expanded, and an unset variable with no default now fails with an error naming the variable instead of sending a blank bearer token. Closes #128. If you upgrade: a bare $VAR (as in "apiKey": "$OPENROUTER_API_KEY") or a ${VAR} inside a longer value (as in "baseUrl": "https://${HOST}/v1") is no longer expanded and is sent as written, so the provider will reject it. Change it to a whole-value ${VAR}.
  • nanotune benchmark and nanotune chat now start llama-server with --alias <model-name>, so the server's own API (chat-completion responses, /v1/models, /props) reports which model/quantization is actually loaded instead of defaulting to the raw file path. Closes #197.
  • Small LoRA scale and dropout values are now written to the temporary lora.yaml with exactly their own digits, instead of being padded to 20 decimals by toFixed(20). Values below 1e-20 also no longer lose their digits or round to 0. Closes #151.
  • Fixes from a full run of the release smoke test on Apple Silicon. Installing PyTorch or mlx-lm inside a virtualenv no longer fails with "Can not perform a '--user' install", which broke the venv remedy that the externally-managed-environment error recommends. The exit hint on export, benchmark, benchmark compare, benchmark review, judge test, status and data validate now names the keys that really exit (Enter, Esc, and q where it applies) instead of "Press any key". benchmark review offers the latest run of your model instead of a newer --base control, and benchmark compare with no or one argument always treats a --base control as the before side (and, when the two latest runs are both controls, pairs the newest control with the newest run of your model), so an improvement is no longer reported as a regression. The init success screen no longer shows "[Esc] Cancel". The docs now state that train --resume loads the checkpoint weights and runs iterations more from a fresh counter. Also pins the transitive undici dependency of the AI SDK providers to 7.30.1 or later, which clears four high-severity advisories that were failing the package audit.
  • The MiniMax Coding Plan judge template now defaults to MiniMax-M3.1-Flash instead of MiniMax-M2.5, which MiniMax retires on November 18, 2026. Existing judge configs keep the model they were saved with; run nanotune judge configure again, or edit the model in your judge config, to switch.
  • Fixes from a pre-release review. data import skips a record whose messages aren't all text (an OpenAI tool-call turn with content: null, a numeric output) instead of importing a row that then stopped edit, dedupe, validate --fix and the first train split from loading the dataset. benchmark --json --base no longer lets pip's install output into its JSON. In partial match mode an empty reply no longer passes every test. A benchmark cut short on a category's first test no longer saves a 0/0 category, which showed as NaN% and as a −100% change in benchmark compare. An export that fails or is cancelled no longer leaves a truncated GGUF for benchmark to pick up as the newest model. The model card is refreshed on every export unless you've edited it, so it no longer describes an earlier artifact. Two processes can no longer both take over the same stale data lock, and a lock is only released by its owner. Rewriting a dataset that is a symlink writes through the link and keeps the file's permissions, instead of replacing the link with a plain file.
  • An empty string in a benchmark test's acceptable array no longer makes the test pass no matter what the model says. Under contains, startsWith and partial (and the semantic delimiter branch) an empty answer matches everything, so a stray "" in tests.json quietly inflated the pass rate. checkPass now skips blank answers, and nanotune benchmark rejects a dataset containing one at load time with Test #N: "acceptable" contains an empty string. before any model is loaded. Thanks to @addyCooks. Closes #164.
  • A benchmark test that sets both prompt and messages is now rejected before the run starts, naming the test. Previously the messages conversation was dropped without a word and the test ran as a single-turn prompt. A test with a prompt and an empty messages array now sends that prompt to the LLM judge instead of an empty one. Thanks to @inahus99. Closes #142.
  • nanotune status, nanotune train, nanotune export, nanotune data validate and nanotune data list no longer crash with a React reconciler stack trace when config.json is malformed, and nanotune data validate no longer crashes when train.jsonl contains a bad line — instead each command reports the file (and line, where applicable) and exits with code 1. Malformed lines in train.jsonl are preserved so the mutating helpers never silently delete user data; --fix/--rewrite-context and edit/delete skip when the data does not fully parse. Thanks to @addyCooks. Closes #126.
  • Require isEval on every helper in src/lib/data.ts that writes to the dataset. A caller that forgot the flag used to silently append to, or overwrite, the wrong file; the type checker now catches it at compile time. Read-only helpers (loadTrainingData, countExamples, validateTrainingData, the exporters) keep the isEval = false default — a missing flag shows the wrong set but destroys nothing. No runtime behaviour change. Thanks to @addyCooks. Closes #129.
  • Retry transient network failures while installing llama.cpp, instead of failing the
    whole run. A single 502 from GitHub releases or a reset socket mid-transfer
    previously discarded an entire multi-gigabyte download, and the user started from
    zero. installLlamaCpp now wraps its four fetches in a 3-attempt exponential
    backoff (1s and 2s waits, with server Retry-After hints honoured), and only genuine transients are retried:
    server errors, 408/425/429, a 403 that carries Retry-After (GitHub's
    unauthenticated rate limit), and reset/timeout socket errors. A 404 on a missing
    asset still fails immediately, because retrying it only makes the user wait for
    an error that cannot change. Failed transfers never publish partial scripts or
    archives. Ctrl+C is never retried. Addresses the llama.cpp installation portion
    of #215; Hugging Face model downloads remain a separate follow-up.
  • nanotune chat, benchmark and benchmark --json no longer hang for up to the full startup timeout (60s by default) after reporting that llama-server exited during startup. The health-check loop that raced against the child's exit was never cancelled, so it kept polling a dead port until its own deadline. It is now aborted as soon as the race ends. Thanks to @addyCooks. Closes #220.
  • nanotune now reaps orphaned .tmp-<pid> files left behind by a crashed or SIGKILL'd atomic write. The temp file created by writeFileAtomic is normally removed in the same call, but a process killed between its temp write and rename never reaches the cleanup — those leftovers used to accumulate forever in .nanotune/benchmarks/. On startup every command sweeps dead-pid temps in the benchmarks directory, and writeFileAtomic itself sweeps dead-pid temps for its own target path before each write, so a crashed run is healed on the next invocation. Live-pid temps are left alone, so concurrent writes remain safe. Thanks to @ig-imanish.
  • Include the JSON parser's syntax detail when training data contains malformed JSON.
  • nanotune data validate (including --fix and --json) and nanotune data list no longer crash with a raw TypeError when a line of train.jsonl parses as JSON but has the wrong shape (null, an object without messages, a null message, or a non-string role/content). Such lines are now reported as Example N: invalid structure and, like unparseable lines, are left untouched on disk. Thanks to @addyCooks. Closes #218.
  • nanotune data validate --fix and --rewrite-context now run their dataset rewrites exactly once per invocation. Previously the call to collectValidation lived directly in the component's render body; a render body carries no guarantee about how many times it runs, and any future state, context, or parent re-render would have replayed the entire train.jsonl write without a user action behind it. The command now computes its report behind a useRef and renders from that, so the first frame already reflects the fixed file and useAutoExit reads the same value the user saw. Separately, saveTrainingData now writes through the same writeFileAtomic helper used for configs and benchmark reports, so an interrupted save can no longer leave train.jsonl truncated. Thanks to @addyCooks. Closes #133.

Contributors

This release shipped thanks to @addyCooks, @akramcodez, @AniketR10, @DeepamJha, @Devesh36, @Dhirenderchoudhary, @ig-imanish, @inahus99, @Piyushrathoree, @rohanshrma222, @sagarpjpt, @SAY-5, @tusharui, @will-lamerton and @yashksaini-coder.

First-time contributors: @AniketR10, @DeepamJha, @Devesh36, @Dhirenderchoudhary, @ig-imanish, @inahus99, @Piyushrathoree, @sagarpjpt, @SAY-5, @tusharui and @will-lamerton. Welcome, and thank you!

Install

npm install -g @nanocollective/nanotune

Full Changelog: v1.7.0...v1.8.0