DTG-MA skills: LoRA-level accuracy in a 1.7 MB file

Languages: English · Русский · 中文

DTG-MA skill against a LoRA adapter

A LoRA adapter for Qwen3.5-0.8B weighs 43 MB. On the same tasks, with the same data and the same training budget, a skill made with DTG-MA weighs 1.7 MB (for one task 0.38 MB), and its accuracy is at LoRA's level. The skills are baked, applied and served by cortiq, an open engine for running LLMs locally.

DTG-MA is US patent application No. 19/452,464, "Dynamic Task-Guided Mask Activation (DTG-MA) Compression", filed January 19, 2026 (patent pending). cortiq opens part of the method; the application covers more than the open code (see PATENTS.md).

How it started

The first experiment was an attempt to "compile" a network for one task: keep only what the task needs, the way a compiler drops unused code. A professor on a forum suggested a strict test, linear differential equations, where an answer is either exactly right or wrong. Trainable gates on the neurons of a frozen model were expected to make it smaller and a little worse; accuracy went up instead. That effect became the patent application.

The idea

  • The base model stays frozen and quantized. Its weights never change.
  • For a task, a gate σ(m) is trained on each output row of each projection (--mask-scope linear) or on each FFN neuron (--mask-scope ffn): one number per row.
  • The skill file keeps only those numbers: 399,936 of them for Qwen3.5-0.8B, 1.7 MB.
  • skill apply multiplies each row of the base by its gain and re-encodes it in the base's own codec. The result has the size and the speed of the base: no adapter at run time, no extra matrix products.

How a cortiq skill is made

Five ways to apply a skill

Five ways to apply a skill

A skill file carries identity keys of the exact base it was cut against; skill apply refuses a different or re-quantized base instead of building a silent chimera.

1. Fold into the model. A standalone specialist with the base's size and speed.

cortiq skill apply base.cmf emo.skill.cmf -o emo.cmf
cortiq run emo.cmf -p "I finally got the job!"

2. Overlay: one base, a shelf of skills. The base tensors stay byte for byte; the skill is unpacked beside them as skill.<id>.*, re-encoded copies of the projections it changes (about 490 MB for an all-projection skill next to the 796 MB Qwen3.5-0.8B base; the skill file itself is 1.7 MB). --skill picks one per run, --skill none runs the base.

cortiq skill apply base.cmf emo.skill.cmf --overlay -o shelf.cmf
cortiq run shelf.cmf --skill emo -p "..."
cortiq skill list shelf.cmf

3. Server: a skill per request. serve --skill emo runs every request with one skill. A file with a router policy chooses per request from the last user message: each skill gets its own lane of pipelines with its own KV cache, and a skill runs only when it beats the base by the policy's margin; otherwise the base answers.

cortiq serve shelf.cmf --skill emo     # one skill for every request
cortiq serve shelf.cmf                 # router policy: the file picks per request

4. Blend and switch. --blend auto mixes the two best skills by their routing scores; --route-dynamic switches the active skill in the middle of generation as the context changes (--trace prints each switch).

5. Hard mask: smaller and faster than the base. Without --soft-fold the bake closes neurons and defragments the file: closed neurons are neither stored nor computed. A Qwen3.5-0.8B specialist for Russian technical text: 705 MB against 733 MB, 89.7 against 86.0 tokens/s, perplexity −14.7 % on held-out text.

Bake your own skill

cargo install cortiq-cli --locked --features cuda
cortiq convert --model Qwen/Qwen3.5-0.8B --quant q8_2f --output base.cmf

export CMF_GPU=cuda
cortiq skill bake base.cmf --files train.txt --held-files held.txt \
  --record-start '<|im_start|>system' --length-buckets \
  --answer-after $'<think>\n\n</think>\n\n' --answer-end '<|im_end|>' --checkpoint-accuracy \
  --mask-scope linear --mask-init 2.0 --lr-a 0.1 --lin-l1 0.02 --through-attn \
  --steps-a 750 --batch 8 --steps-b 0 --soft-fold --no-defrag \
  --checkpoint-dir ckpt --output specialist.cmf

cortiq skill export specialist.cmf --base base.cmf --id emo --gains-from ckpt/phase-a-step-750.json -o emo.skill.cmf

train.txt holds chat records (system, user, assistant); the loss and the held-out accuracy count only the answer after --answer-after. The bake runs on an NVIDIA card (CMF_GPU=cuda); a folded or overlaid skill runs on every cortiq back end. More in SKILLS.md.

Measured against LoRA

Qwen3.5-0.8B on one RTX 3060 (12 GB). Both sides got the same records in the same order, the same number of steps and the same loss. LoRA: r=16 on every linear layer, 10.8 M parameters, 43.3 MB, trained in PyTorch.

Accuracy and file size per task

Differential equations (100 problems per set, 32 greedy tokens after a bare prompt). The base model solves 0 of 100; given its chat template and 300 tokens, 66 and 44. The 0.38 MB skill: 100 on coefficients seen in training and 96 on new ones. LoRA: 100 and 100.

Differential equations

Emotion of a message (dair-ai/emotion, 6 classes, 16,000 training texts, 2 epochs, 2,000 test texts):

base model cortiq skill, 1.7 MB LoRA r=16, 43.3 MB
one-word answer, accuracy 53.3 % 92.6 % 92.5 %
one-word answer, balanced accuracy 42.0 % 91.5 % 85.4 %
JSON answer, accuracy 46.9 % 92.5 % 93.3 %
JSON answer, balanced accuracy 43.5 % 90.0 % 89.3 %
valid JSON with one of the six labels 91 % 100 % 100 %

Emotion accuracy

Recall per emotion

Training time

Accuracy within noise, wins on size and speed

  • Accuracy: every gap to LoRA is within the noise of its test. On 2,000 emotion texts the noise is about ±1.2 points and the gaps are 0.1 and 0.8; on 100 equation problems the noise is about ±4 points and the gap is 4. On balanced accuracy the skill is ahead: 91.5 % against 85.4 %.
  • Size: 1.7 MB and 0.38 MB against 43.3 MB, 25 to 115 times smaller.
  • Training: 12 and 16 minutes against 18 and 21.5 minutes on the same card, and the skill's time already includes its held-out checks.
  • Inference: an applied skill runs at exactly the base model's speed. A LoRA adapter adds extra matrix products to every layer, or, merged, costs a full copy of the model per task.

Should there be a skill shop?

A skill is a 1–2 MB file for the model you already run: dozens of them fit beside one base, one downloads in a second, and skill apply turns it into a specialist or an overlay in seconds. Would you use a catalog of ready skills for popular open models? Which skills first, and how should it work: a free catalog with paid custom bakes, pay per skill, a subscription, or only the open tools? Tell us in the Community tab.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support