Skip to content
Local AI5 min read

A 4B model on my Mac learned the style, not how to draw

I wanted a model running on my Mac to draw SVGs ready to animate in Rive. I fixed the format in one night; drawing well, I didn't. What I measured, what failed, and four MLX traps you can skip.

I wanted a model that runs on my Mac, an M5 with 16 GB, and gives me SVGs ready to animate in Rive: separate named parts, pivots at the joints, and nothing Rive ignores. After a night of experiments, the format was solved. Drawing well was not.

I'm writing it down because several numbers go against intuition, and because some of the traps aren't documented anywhere.

First, an honest judge

My first metric was pass or fail: the SVG converts to Rive with no warnings, compiles, and is well framed. It works for format, but it lies about quality. One model reached 81% pass with a magnifying glass that was an orange circle and a fox that was a bear.

So I added a judge: a local model with vision looks at each drawing and answers yes or no to "does this clearly show what was asked?". I use the probability of yes, not a 0 to 10 score. Asking a small model for a number gave 9 to a good drawing and 7 to a broken one. Before trusting it, I tested it on 24 drawings made by a more capable model: it recognized 83%. That's the bar. One detail that matters: the judge is Qwen3.5-4B, the same model that comes out on top below, so it may favor its own drawings.

With that judge, the ranking of models that fit in 16 GB changed:

  • Qwen3.5-4B: 31% recognizable.
  • Granite 4.2 8B: 12% (on 8 briefs), at twice the size and less than half the tokens per second.
  • Qwen3-4B-Instruct-2507: 0%.

Editing weights fixed the format and cost content

On November 2, MIT researchers published a post on "Weight-Space Programming": a large model reads another model's weights and edits them directly, with no gradients, to fix specific failures. I tried it at a small scale.

My model wrapped the SVG in code fences and added SMIL animations that Rive doesn't read. Running forward passes over its own answers, I found which neurons pushed those tokens and removed only that direction from them: 655 thousand weights, 0.0156% of the model, across four layers.

It worked for what I aimed at. Code fences went from 13 to 0, and the Rive pass rate went from 6% to 31%. But recognizability dropped from 31% to 6%: those neurons also carried part of the drawing. In the Hacker News discussion, someone described something similar with a terminal-command model: the edit fixed some mistakes and broke others.

A script won

Then I wrote a deterministic sanitizer. It strips SMIL, filters, CSS and full-bleed backgrounds, turns styles into attributes, and groups loose parts. With that, the same Qwen3.5-4B, without touching a single weight, went from 6% to 50%.

If the problem is format, code beats editing weights: it's cheaper, testable, and doesn't change what the model knows.

Fine-tuning copies the style, not the hand

For taste I built a teacher set: a Claude model drew illustrations with a short palette, dark ink, margins and pivots, and I threw out the ones that didn't match the brief. 231 survived, and I trained a LoRA on Qwen3-4B with them.

On 16 briefs it never saw, the fine-tuned model was 81% valid for Rive and used 329 tokens per drawing against about 1,080 for the base: a third. It picked up the palette, the framing and the structure. But the judge recognized almost nothing. The style transferred; the ability to draw the right shape didn't. In a 4B model, freehand geometry is the bottleneck.

Four traps that cost me hours

  • MLX memory isn't where you look. On Apple Silicon, the unified memory the GPU uses isn't counted in the RSS that ps reports. My watchdog measured RSS and saw nothing while the process hit 14 GB and the Mac went to swap. The MEM column in top does include it. And one heavy job at a time: training, evaluating and running agents together froze the machine.
  • Qwen3.5 won't train in 16 GB with mlx-lm. Its linear attention uses a Metal kernel at inference, but in training it walks the sequence token by token in Python and keeps every state: by my estimate, on the order of 15 GB per layer for 1,500 tokens. I split it into checkpointed blocks, with identical outputs and gradients, and the peak still sat at 14 GB. That one is still open.
  • The learning rate. mlx-lm's LoRA ships with a scale of 20 by default. At 1e-4 the model broke before finishing one epoch; at 2e-5 it learned without trouble.
  • The chat template. Qwen3-2507's template writes an empty reasoning block into every past answer, but not into the generation prompt. The model learned to write it itself. The fix is to prefill that block in the inference prompt.

What I'm keeping

Generating several candidates and keeping the best one helps, and it's cheap if you generate them in a batch: in one test, four 300-token candidates took 15 seconds and a single one took 10. I drop the ones Rive rejects and the judge picks the most recognizable. In my tests it raised the judge's average probability, although on the hard subjects none passed the halfway mark yet.

The general lesson: measure what you care about, not what's easy to measure. "It compiles" isn't "it looks good". This is 16 briefs, so read the numbers as direction, not statistical truth. Next is solving the memory of Qwen3.5 training, since it's the best drawer that fits on this Mac.

Obed Vargas

Builds AI agents and open-source tools

Next noteAnimations you can interrupt mid-flight, with no bounce