Skip to content
All work

Live2026

Stitch Math

Catches counting mistakes in knitting patterns, size by size.

  • TypeScript
  • Gemma 4
  • Qwen3.5-4B LoRA
  • Ollama

The problem

Knitting designers often write one pattern in many sizes. If one row's stitch count is wrong in a single size, knitters only find out halfway through the sweater. Checking every row in every size by hand is slow, and an AI chatbot, the obvious shortcut, is bad at counting.

What I did

I split the job in two. The AI reads each written row and turns it into a list of stitches, and ordinary code does the counting for every size, pointing to the exact row where the numbers stop adding up.

I also fine-tuned a small open model (Qwen3.5-4B) on 2,000 practice lines, so the whole check can run on a laptop with nothing sent online. I built it for the DEV Hacktoberfest open-source AI challenge.

What happened

I tested it on 8 correct patterns and 24 copies with one mistake hidden in each. It found 22 of the 24 mistakes with 1 false alarm. The AI on its own found 18, but raised 17 false alarms.

The small fine-tuned model read 108 of 112 real pattern lines correctly, and with it the checker still found 21 of the 24 mistakes.

Next projectLab-E