Analysis updated 2026-05-18
Shrink a Ternary Bonsai language model for faster training and smaller size.
Fine tune a ternary model fully or with a LoRA adapter approach.
Save and merge a LoRA-trained ternary model back into deployable form.
| electroglyph/ternary_qat | aarav90-cpu/fetchit | adammartinez271828/x4-analysis | |
|---|---|---|---|
| Stars | 10 | 10 | 10 |
| Language | Python | Python | Python |
| Setup difficulty | moderate | easy | easy |
| Complexity | 4/5 | 2/5 | 2/5 |
| Audience | researcher | developer | general |
Figures from each repo's GitHub metadata at analysis time.
Requires installing a compatible PyTorch version first and understanding LoRA or full fine-tuning workflows.
ternary_QAT is a Python tool for shrinking the numbers inside an AI language model so it takes up less space and can run faster, while still letting you keep training it. Normally, the weights inside a language model are stored as regular decimal numbers. This project converts them into just three possible values: negative one, zero, or positive one, grouped in small batches along the model's structure. That conversion follows a format used by a specific family of models called Ternary Bonsai, and the project checks that its output matches that format exactly. It works with models loaded through the Transformers library, and it is specifically built to work alongside a training tool called Unsloth. Once installed, you load a model as usual, then call a function that swaps out the model's linear layers so that the ternary conversion happens automatically every time the model processes data during training. The project supports two main ways of training. You can fine tune the whole model directly, or you can use a technique called LoRA, where the main model is converted to the ternary format and frozen in place while small separate adapter pieces are trained normally in full precision. When you are ready to save a LoRA-trained model, the tool provides steps to properly combine the adapter back into the ternary model. One important detail the author calls out is that training with this ternary approach needs a much higher learning rate than normal fine tuning, roughly ten to fifty times higher. The suggested starting point is around seven ten-thousandths, with room to experiment upward depending on the size of the training data and the settings used. Example code for LoRA training, full fine tuning, and Unsloth usage is included in the project's examples folder. The tool is installed through pip, and users are advised to install their own version of PyTorch first so the wrong version is not installed automatically.
A tool that shrinks an AI model's numbers to just three values so it is smaller and faster while still trainable.
Mainly Python. The stack also includes Python, PyTorch, Transformers.
Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.
Mainly researcher.
This repo across BitVibe Labs
Verify against the repo before relying on details.