Skip to content

Releases: heed-build/hunch

Hunch 0.2.1

Choose a tag to compare

@Mpdreamz Mpdreamz released this 28 Oct 15:40
b7ccb35

Hunch 0.2.1 adds on-device head training: fine-tune a checkpoint's decision head on your own labelled examples, judge it on examples it never saw, and keep it only if it helps.

.package(url: "https://github.com/heed-build/hunch", from: "0.2.1")

Added

  • DecisionModel.evaluate(_:): accuracy and mean loss of the head in use on labelled examples
  • DecisionModel.trainHead(on:options:progress:): fine-tunes the decision head (two layers, the question type embedding, the option scorer) with AdamW; the encoder and the action head stay frozen; cancelling restores the starting head
  • saveHead(to:metadata:), loadHead(from:), Options(head:), resetHead(): a head is a safetensors file (about 50 MiB for the English checkpoint) that only loads on the checkpoint it was trained from
  • TrainingExample, TrainingOptions, TrainingProgress, TrainingReport, Evaluation, HunchError.invalidTraining

Inference output is unchanged. Measured on an Apple silicon Mac with the English checkpoint: 81 examples, 3 epochs, 5.2 s.

Build notes

  • Swift before 6.4 must build with --build-system swiftbuild; the older native build system does not compile MLX's Metal shaders. The README's "Shipping the Metal shaders" covers apps, tests and CI.

License

Apache-2.0; see NOTICE and THIRD_PARTY_NOTICES.md. Model weights are not included.

Hunch 0.2.0

Choose a tag to compare

@Mpdreamz Mpdreamz released this 28 Oct 13:10
d8965ac

Hunch answers typed questions about a piece of text (pick one of some options, place it on a scale, say how likely a statement is) in one forward pass of a small encoder, on Apple silicon, without a server, Python or a network call at inference time. It runs Laya checkpoints with MLX Swift.

This is Hunch's first release. Tags 0.1.0 to 0.1.2 belong to laya-mlx-swift, which Hunch forks.

.package(url: "https://github.com/heed-build/hunch", from: "0.2.0")

What changed from laya-mlx-swift

  • The library is Hunch, with a Question / Answer / DecisionModel API (choice, score, noul)
  • Special tokens come from the tokenizer config, which fixes wrong answers on the multilingual checkpoint
  • Temperatures are clamped to [0.5, 5]; calibration files and per-language temperatures load
  • A too-long state can keep its end (Truncation.keepEnd); an empty state adds no tokens
  • MLX errors are thrown instead of ending the process; inference runs on a queue of its own; unload() frees the weights
  • Checkpoints download from their origin (convaiinnovations/laya, convaiinnovations/laya-multilingual) at pinned revisions, every file checked by sha256, and an existing directory is never deleted
  • TerminalText.clean prepares terminal screens for questions about them
  • The README covers requirements, limits, and how an app built with SwiftPM ships MLX's Metal shaders

Requirements

macOS 14 or later on Apple silicon; Xcode 26 or later with the Metal toolchain to build (xcodebuild -downloadComponent MetalToolchain). The English checkpoint is about 807 MiB on disk and peaks near 1.8 GB in memory.

License

Apache-2.0. Hunch is a fork of MstyAI/laya-mlx-swift and follows laya-mlx; the model, prompt format and calibration method are Laya's, by Convai Innovations and the Laya contributors. Their notices are in NOTICE, dependency notices in THIRD_PARTY_NOTICES.md. This repository contains no model weights or tokenizer files. Hunch is not affiliated with or endorsed by Convai Innovations or the Laya project.