# Can a 129M music model write guest parts a DJ would keep? A work report on strudel-lm

Date: 2026-11-24
URL: https://blog.nenkoru.com/posts/strudel-guest-decks/

> TL;DR: strudel-lm is a 129M-parameter model that writes short Strudel loops (bass, chords, lead, drums) to play over a DJ's track. It was pretrained on MIDI turned into Strudel code and fine-tuned on house, techno and progressive. In blind swipes by its one listener, the fine-tuned model (FT3) got 37% of its parts marked "fits" against 26% for the previous small model, on the same moments of the same tracks. The confidence intervals overlap, so that is a lead, not a verdict. A new batch of cards, whole programs picked best-of-6 by a critic and a taste model, now waits for swipes and will decide between FT3 and FT4. Done mostly by an AI agent (Claude) under the author's direction.

## How to read this

- **Humans:** the TL;DR above is the whole story. The section "What worked and what didn't" has the lessons.
- **Agents picking up the work:** read "State of the work" first, then "What to try next". Section names are stable anchors.
- **AI use:** this work was largely AI-run. The section "AI use" at the end says what was done by which model.
- **Code:** not public. File names below refer to the project's `tiny/` (models, data, training), `deckc/` (the deck pages, batches, rendering) and `js/` (the Strudel dialect and renderer).
- **Numbers:** one listener and small samples. Every swipe rate below comes with its 95% interval; read the interval, not the point.

## State of the work

- **Goal.** "AI guest decks": while a DJ plays a track, a small model writes a part (a bass line, chords, a lead, percussion) that joins on the next 8-bar phrase and pumps the track up. The model writes code in a strict Strudel dialect, and Strudel's engine plays it.
- **Best model so far.** `base130ft3` (FT3): a 129M model fine-tuned on house, techno and progressive. In blind swipes it beat the previous small model, 37% vs 26% "fits", with overlapping intervals.
- **Open choice.** FT3 writes better chords; FT4 writes better bass. In an automatic check they tie (34 vs 35 usable parts of 96).
- **Waiting on.** 48 new swipe cards: 24 from FT3 and 24 from FT4, generated as whole programs and picked best-of-6. They are published on the swipe page with 134 not-yet-rated older cards.
- **Data.** The audio-to-MIDI pass over a Jamendo (Creative Commons) electronic music set finished: 752 transcribed tracks, up from 290 at the start of this round.
- **No training was started in this round.** The next fine-tune and a taste-model retrain wait for the author's go.

## Background

### Strudel and the dialect

[Strudel](https://strudel.cc) is a live-coding music environment in the browser (a JavaScript port of TidalCycles). A part is a short expression such as a mini-notation pattern plus a sound and a few effects. The model writes a small, strictly parsed subset of it (the "dialect"). The page parses the model's text with its own grammar and never `eval`s it. That keeps the output to about 400 tokens per 4 bars instead of audio tokens every 40 ms, so the model can be small.

### The deck

A page plays a track; guest decks join it. Each guest deck plays one requested part for 1, 2 or 4 phrases. Parts start on the track's phrase lines, take its key, and are levelled per role (BS.1770 loudness, a target per role). Where the track has a kick, a silent lane ducks the guest parts on every beat, the usual house and techno sidechain.

### The models

| Model | What it is |
| --- | --- |
| previous small model | a character-level transformer, 320 wide, trained on the Mac on MIDI-derived lines plus a rule-made style corpus, with "hear" words (what the track plays) in the prompt |
| `base130` | TinyLMv2, 16 layers × 768, context 2048, BPE with 4096 tokens, 129M parameters. Pretrained on two V100s on MIDI converted to the dialect: about 5.7B tokens, validation loss 0.640 |
| `base130ft` (FT1) | fine-tuned on genre programs (cleaned Jamendo transcriptions, the electronic part of Lakh, NRG-CP, Groove, Strudel programs), genre lines and a replay of general data |
| FT2 | FT1 with three times the replay |
| **FT3** | replay of both lines and programs, tags shuffled |
| FT4 | FT3 with less one-note bass, Freesound loops (3122 parts) and drum lines |

### The swipe page

A private phone page. Each card is one moment of one of the author's own tracks: 8 bars before, the guest part, 8 bars after, prerendered into one AAC file so the phone only decodes audio. Swipe right if the part fits, left if not. Twins (two parts for the same moment) give preference pairs. Every swipe is stored with the model name, the prompt and the code, so models can be compared on the same cards.

## Results

### Automatic checks (48 programs and 96 page-format prompts per model)

| Model | Loss: genre programs | Loss: general data | Notes in key | Usable parts of 96 | Chords | Bass | Lead | Drums |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| base130 | 5.12 | **0.635** | 79.6% | 29 | 11/24 | 6/24 | 12/24 | 0/24 |
| FT1 | **1.12** | 0.992 | 92.9% | – | – | – | – | – |
| FT2 | 1.13 | 0.975 | 91.6% | 24 | 9/24 | 2/24 | 9/24 | 4/24 |
| FT3 | 1.13 | 0.813 | 90.8% | 33–34 | **15–18/24** | 1–6/24 | 11–12/24 | 2/24 |
| FT4 | 1.13 | **0.789** | **94.6%** | 35 | 11/24 | **7/24** | 14/24 | 3/24 |

A "usable" part parses, has 8+ notes in 4 bars, and for melodic roles 2+ distinct notes with 80%+ in key. FT3 appears in two samples, hence the ranges. Every fine-tune finishes 48/48 programs with balanced brackets. At 24 parts per role, gaps of a few parts are noise; only the bass gap between FT3 and FT4 looks real.

### Blind swipes: FT3 vs the previous model

Same swipe batch (version 49), the same moments of the same tracks, one listener, repeat cards excluded.

| Model | "Fits" | Share | 95% interval |
| --- | --- | --- | --- |
| **FT3** | 14 / 38 | **37%** | 23–53% |
| previous small model | 17 / 66 | 26% | 17–37% |

- **Moments with at least one part that fits:** FT3 11 of 20, previous model 12 of 33.
- **Chords:** FT3 5 of 15, previous model 9 of 20. This is the one role where FT3 did not win, against its automatic score.
- **Listener consistency:** on repeat cards the same verdict came back 20 of 27 times (74%). That caps how sharp any swipe comparison can be.
- **Swipe archive:** 661 swipes in all since early November, 363 of them new since the last export.

### Jamendo audio to MIDI

| | Before | After |
| --- | --- | --- |
| Transcribed tracks | 290 (stopped at part 90 of 100) | 752 (all 100 parts) |
| Demucs | reloaded per track | loaded once per worker |
| Workers | 1 GPU | 2, one per GPU |
| Time per track | about 4 min | about 68 s per worker, now bound by basic-pitch on the CPU |

## What worked and what didn't

- **Fine-tuning a bigger pretrained model worked.** FT3 beats the previous small model in blind swipes, and every fine-tune is in key 91–95% of the time against 80% for the base.
- **Forgetting is real but fixable.** Loss on general data went 0.64 → 0.99 after the first fine-tune. Tripling the replay barely helped (0.975). Replaying the *line* format as well as programs did (0.81, then 0.79).
- **The automatic check and the listener disagree on chords.** FT3's best automatic role (chords) was its weakest in swipes. The rule check rewards being in key and dense enough; it says nothing about fitting the track.
- **Monotone bass comes from the data.** Many bass lines in the corpus are one note in 16ths (`f1*16`), and the models copy that. Cutting those lines (FT4) moved bass from 1 to 7 of 24.
- **Drums in the line format never worked** (0–4 of 24 for every model). Whole programs, where drums sit next to the other parts, are the next attempt.
- **Whole programs, then cut by role.** The model is strong on whole programs (48/48 finish, brackets balance). This round generated 1024 programs per model over 16 key/style combinations and cut them into parts by their role comments. FT3 gave 1043 bass parts (194 of them one note), 878 leads, 775 chords, 517 drum parts and 359 others.
- **Best-of-6 by two judges.** Each card's part was picked from six candidates by the rank sum of a rule critic and a taste model: a logistic regression on 197 earlier swipes, 70% accurate in cross-validation. Whether that helps is what the next swipes test.
- **A silent failure, caught.** Four Jamendo parts failed transcription, but a `grep | tail` pipeline swallowed the exit code. They were marked done and their archives deleted. The script now checks the exit code, keeps the archive and doesn't mark the part. The four parts were redone.
- **Out of memory next to another model.** Generation shared a V100 with a running LLM server and ran out of memory. Computing logits for the last position only, in fp16, brought the peak to 0.54 GB.

## What to try next

Ranked by expected value per hour.

### 1. Swipe the new cards

48 piece cards (24 FT3, 24 FT4) and 134 unrated older cards are on the page. 24 cards per model will show a direction; separating a 15-point gap with confidence takes roughly 100 swipes per model, so expect another batch.

### 2. Retrain the taste model with the new swipes

363 new swipes are exported. Refit the logistic model on all of them (197 → about 560), check cross-validation, and use it for the next best-of-N batch. Cheap: seconds on a laptop.

### 3. The next fine-tune (FT5)

- The 752 Jamendo transcriptions, cleaned into loops, in the genre corpus.
- The Freesound loops at a higher weight.
- More general lines in the replay (forgetting is still 0.64 → 0.79).
- Track sections (build, drop, break) in the prompt; today a section in the prompt often gets an empty reply.
- Mix FT3's and FT4's data to keep both the chords and the bass.

### 4. Preference training when there are enough pairs

DPO on twin cards once there are about 300 swipes of the new model. An earlier DPO run on *critic-made* pairs fell apart (parse rate 1.00 → 0.56 while the critic score rose: the Goodhart signature), so listener pairs come first and critic pairs at most as a supplement.

### 5. Later

- Export a small model to run in the browser page.
- Speed up basic-pitch (a GPU build or more CPU workers) if more audio is transcribed.

## Constraints the work kept to

- **The listener decides.** Rule scores and critics pick candidates; only swipes compare models.
- **The author's tracks stay private.** The swipe page with them is private, and nothing from them is published.
- **Shared GPU server.** Low priority, pinned cores, two cores always free, and the author's LLM server is never touched.
- **Fresh swipe batches.** Each batch gets a new seed (≥ 30) and a check that no card id repeats an earlier batch.
- **No training without the author's word.**

## Compute

- **Laptop:** Apple M3 Pro, 36 GB. Pages, batch assembly, analysis. Nothing heavy without the author's word.
- **GPU server:** 2 × V100 32 GB, shared with a running LLM server. Pretraining and fine-tunes, generation (fp16), Demucs; basic-pitch runs on its CPUs. The swipe cards of this round were also rendered there (Node + superdough offline, ffmpeg to AAC): 48 cards, 47 MB.

## Known traps

- **`grep | tail` hides failures.** A pipeline returns the last command's status. Check the real command's exit code before marking work done.
- **Swipe page size.** One published version holds about 256 MB and 511 files. Old cards that are already rated must be dropped when new ones go in.
- **Relative paths in batch scripts.** A wrong relative path to the taste model in the batch script had to be fixed this round. Check that a best-of-N run actually used both judges.
- **Rule score ≠ fit.** Don't promote a model on the automatic check alone; the chord result above is the counterexample.
- **Licences.** Strudel is AGPL-3.0; parts of the training data are CC BY-NC-SA. Fine for research; check before shipping anything.

## Project files (for whoever continues)

| File | Role |
| --- | --- |
| `HANDOFF.md` | current state, constraints, next steps |
| `reports/ft/README.md` | pretraining and FT1–FT4 evaluation |
| `tiny/piecegen.py` | whole-program generation (last-position logits, fp16) |
| `tiny/taste.py`, `tiny/taste.json` | the taste model and its weights |
| `deckc/batch.mjs` | swipe batch assembly, best-of-N by critic + taste |
| `tiny/jamendo.sh`, `tiny/audio2midi.py` | Jamendo download and transcription, two workers |
| `deckc/loudness.py`, `deckc/prerender.py` | levelling and card rendering |
| `deckc/rate/index.html` | the swipe page |
| `ratings3`–`ratings8/` | swipe exports |

## AI use

This work was done mostly by AI, under human direction. Read the results with that in mind.

| Part | Who did it |
| --- | --- |
| Goals, constraints, what to pursue, every swipe, what to publish | the author |
| Design, most of the code, running training and data jobs, debugging, analysis | Claude (Anthropic), working as a coding agent in Claude Code, directed by the author |
| Some routine code in this round (first drafts of whole-program generation and best-of-N selection, the two-worker transcription changes, tests) | a local Qwen model (qwen3.8-27b) given a written spec, with Claude checking the diff and running the tests |
| This report and post | written and published by Claude from the project's notes, logs and swipe exports, at the author's request; not separately reviewed by the author before going live |
| Swipe verdicts | one human listener (the author); no model judges the final comparisons |
| Critic and taste scores | rules plus a logistic model fit on the author's swipes; they only pick candidates |

The models under test (base130 and its fine-tunes, the previous small model) are research subjects, not authors. The transcription tools (Demucs, basic-pitch, beat_this) are third-party models used as tools.
