explaingit

tsuyu122/usaf

Analysis updated 2026-05-18

15PythonAudience · researcherComplexity · 5/5LicenseSetup · hard

TLDR

USAF is a Python method for fine tuning large Mixture of Experts AI models on a consumer GPU with as little as 12GB of memory.

Mindmap

mindmap
  root((USAF))
    What it does
      Fine tunes MoE models
      Runs on consumer GPUs
      Trains experts and router
    Key ideas
      Sparse weight selection
      RigL reselection
      Resident expert caching
    Tech stack
      Python and PyTorch
      CUDA and DirectML
      4-bit quantization
    Use cases
      Train on AMD hardware
      Bring your own MoE model
      Benchmark vs LoRA

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Fine tune a Mixture of Experts model like Qwen3-30B-A3B on a single consumer GPU with 12GB or more of VRAM.

USE CASE 2

Train an MoE model on an AMD graphics card using DirectML when CUDA only tools will not run.

USE CASE 3

Quantize and prepare a custom MoE model's expert weights to bring your own model into this fine tuning pipeline.

USE CASE 4

Compare sparse training against LoRA and QLoRA using the project's benchmark tables before choosing a fine tuning approach.

What is it built with?

PythonPyTorchCUDADirectMLHuggingFace Transformers

How does it compare?

tsuyu122/usaf0pen-sourcer/hearth13127905/deep-learning-based-air-gesture-text-recognition-
Stars151515
LanguagePythonPythonPython
Setup difficultyhardmoderatemoderate
Complexity5/53/53/5
Audienceresearchervibe coderdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires a GPU with 12GB or more VRAM (or 32GB RAM for CPU-only), Python 3.10+, and PyTorch 2.0+.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice and state any changes made.

In plain English

USAF, short for Ultra Sparse Adaptive Fine-Tuning, is a Python project that lets someone fine tune large Mixture of Experts, or MoE, AI models on consumer grade graphics cards instead of expensive data center hardware. MoE models are a type of AI model that only activate a small subset of their internal weights, called experts, for any given input, which is what makes it possible to train a fraction of them at a time. The author built this because they only had a consumer AMD graphics card with 12GB of memory, and existing fine tuning methods either would not fit on that hardware or could not train the parts of an MoE model that matter most. USAF trains about 26 million parameters out of a model that has 4.8 billion, while also training the router, the small network that decides which experts handle each piece of input. The project states it is the only method among common options like LoRA, QLoRA, DoRA, and full fine tuning that runs on AMD hardware and touches both the expert weights and the router at the same time. On a test run using the Qwen3-30B-A3B model on a 12GB AMD card, 180 training steps reduced the model's loss by 30 percent and improved performance on both the training data and separate held out data, which the author points to as a sign of genuine learning rather than memorization. The method works by finding the small percentage of weights with the highest impact, periodically swapping out underperforming ones during training using a technique called RigL, and keeping frequently used data in memory to avoid slow repeated calculations. To get started, users install a few Python packages and run a training script, with hardware detected through environment variables for AMD, NVIDIA, or multiple GPUs. The project currently works out of the box with Qwen3-MoE models, and includes a step by step process for preparing a dataset, quantizing expert weights, and configuring a run for other MoE model families such as Mixtral. The author lists larger MoE models they would like to test but do not have the hardware for, and invites people with access to that hardware to reach out. USAF is released under the Apache 2.0 License.

Copy-paste prompts

Prompt 1
Explain how USAF trains only 26 million of a model's 4.8 billion parameters and why that still changes the router.
Prompt 2
Walk me through preparing a dataset and quantizing expert weights to fine tune my own MoE model with USAF.
Prompt 3
Explain the difference between USAF and LoRA in terms of which weights each method actually trains.
Prompt 4
Show me the environment variables I need to set to run USAF training on an NVIDIA GPU with CUDA.
Prompt 5
Explain what RigL dynamic reselection does during training and why the active weight set changes over time.

Frequently asked questions

What is usaf?

USAF is a Python method for fine tuning large Mixture of Experts AI models on a consumer GPU with as little as 12GB of memory.

What language is usaf written in?

Mainly Python. The stack also includes Python, PyTorch, CUDA.

What license does usaf use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice and state any changes made.

How hard is usaf to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is usaf for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.