← LVGenStudio

Build log · LVGenStudio

Starting over, on the same machine that never changed

Product architecture, orchestrated with Claude Code

A week off, and I came back to the question that started this whole project in the first place, before any of the detours: can this Mac do local video generation at all, cleanly, on the model I already knew worked?

One thing changed in how I work from here. I'd been asking Claude for things directly and taking whatever came back. From this stretch on, I started routing the harder asks through ChatGPT first — get the instruction structured and precise before Claude ever saw it, so what came back was actually answering the question I meant, not a plausible-sounding guess at it.

I asked Claude to check the hardware first, because the answer depends entirely on it. M1 Pro, 8 CPU cores, 14 GPU cores, 32 GB unified memory. The GPU can only actually address 25 GB of that — the rest belongs to macOS. That 25 GB ceiling turned out to be the main character in this story, and it stayed the main character for the next nine days too.

The package that wasn't the package

First useful thing Claude found, and it cost nothing to learn: there's a package with the right name on the normal Python index, and it is not the engine we needed. The real one only installs from GitHub. Typing the obvious install command gets you someone else's video-loading utility, and you don't find out for hours.

I had Claude read the real engine's source instead of trusting its description. It confirmed the model I wanted was genuinely supported, and — this is the part that mattered — that the engine frees the text encoder from memory before loading the video model. Those two never being resident together at once is the only reason 32 GB has a chance here.

The safety net that failed its own test, twice

Before downloading anything, I told Claude to build a watchdog first — something that kills a run before it takes the laptop down. This turned into the most instructive thing built all week, because of how it broke.

The obvious design watches how much memory the process is using. Claude flagged that as wrong on this hardware: model weights are memory-mapped, so the kernel can drop and reload those pages for free, inflating the number without any real danger. What actually freezes a Mac is memory that can't be dropped, forcing real swap. So the guard Claude built watches swap growth and the system's own free-memory floor instead, and treats the process's reported usage as advisory only.

That decision paid off exactly once, later the same stretch: during a real failure the conventional number never went above 11 GB while the machine was already sliding into swap. A normal watchdog would have seen nothing wrong at all.

Then the guard failed its own test, twice. It detected the breach correctly and reported it could not kill the process. The bug, once Claude found it: the runaway program had already died from the first signal, but on macOS a dead process lingers in the table until its parent collects it. The liveness check was reading a corpse as alive, escalating, and signalling something already dead — which returns "permission denied" and looks exactly like failure.

Claude fixed it by reading process state properly. I made a point of not accepting it as done until it had actually been tested against a real kill — a safety net that's never been made to fail is a safety net with an unknown hole in it.

Two bugs that were sitting in the comments

The download itself stalled silently at zero bytes for a while — a newer transfer backend that installs itself automatically and doesn't work reliably here. Claude disabled it, done in half an hour.

The real blocker was worse. First generation attempt died in under a second, free memory dropping 14 GB in that one second. Claude traced it: the text encoder ships compressed to save space, and the loader converts every weight to full precision on load — doubling an 11.4 GB file to roughly 23 GB, briefly holding both copies at once. The code comment calling that cost "negligible" is true for speed and fatal for memory on a 32 GB machine. It's almost certainly why the model's own documentation says you need 64 GB.

I had Claude write a replacement loader that keeps the original precision. That single change is what made local generation possible here at all, and it lives in our own code rather than the installed library, so a reinstall can't quietly undo it.

First real output

256×256, 17 frames, 10 steps, 51 seconds. Coloured mush. Expected — a fraction of the intended steps and resolution — it proved the plumbing worked, nothing more.

Then it started working properly. 512×512, 25 frames, 12 minutes — a coherent halved fruit on a wooden table, real imagery. 832×480, 49 frames, 43.6 minutes — a woman walking across a living room, red shirt, blue jeans, green sofa, sunlight through a window. Nearly everything I'd asked for, in frame. Badly backlit though — she read as a silhouette.

40 steps, 43.6 minutes — correct scene, correct wardrobe, badly backlit.

Claude ran a second pass at 30 steps, same seed, took 32 minutes and was better lit. Worth being precise about why, because I had to ask: same seed does not mean "same video, more polish." The seed sets the starting noise; changing the step count changes the whole path taken from it afterward. Those are two different takes, not one refined.

Same seed, fewer steps, five minutes faster and better lit — a different take, not a refinement of the first.

Then the portrait. An elderly man, photorealistic — individual eyebrow hairs, skin pores, beard stubble, a catchlight in the eye, warm side lighting. Genuinely good, and it became the baseline I've measured everything since against.

832×480, 49 frames, 42.2 minutes. The accepted baseline for the rest of this stretch.

Day one closed at roughly 21 minutes of compute per second of finished video, memory peaked at 11 GB with zero swap.

Where the second day's speed actually went

I asked Claude to profile it properly rather than guess where the cost was. The obvious assumption is that attention is the expensive part of a transformer. Measured at the real production shape, it wasn't — feed-forward layers took nearly half of every step, attention's raw maths barely a sixth. The measured parts added up to within 7% of the real total, which is what made the breakdown worth trusting instead of a guess.

The model ships compressed to 8-bit to save memory. Measured at this workload's actual shape, that compression runs 30% slower, not faster — every weight gets reused thousands of times per call, so the operation is compute-bound and the decompression is pure overhead. Expanding to 16-bit once at load time, no download needed: 20% faster denoising. Not a free swap though — the output is a genuinely different video, same seed and prompt, different face. A one-percent difference per step compounds across forty of them into a different sample. Claude first reported that per-step figure to me as reassuring. It wasn't, and I pushed back on that — the compounding risk should have been flagged the first time, not after I asked why the output changed.

Several other ideas Claude tried that week measured out to nothing — a different float format that won every isolated test and lost badly on the real model, four explanations tested and disproved; a batching change that came back inside the day's own run-to-run noise, which turned out to be 6–11% here, not the fraction of a percent quick repeats suggest.

There was also a real speedup sitting right there — a version of the model that runs in four steps instead of forty, about twenty times less compute. I had Claude check the licence before I let myself get attached to it. It's noncommercial-only, and neither the model page nor its usual mirror says so anywhere visible — the terms live only in a file inside the source repository. That check took ten minutes and would have been the single largest speedup in the project. It's not one I get to take.

The bigger model, and the decoder that lied about being right

I moved us to the larger, faster-per-frame model next — properly Apache-2.0, with a four-step accelerator that doesn't carry a licence trap. I had Claude preserve everything about the old setup first — exact sources, checksums, every prompt and setting — before deleting 5 GB that could be regenerated from that record.

The accelerator itself doesn't fit the way you'd expect. Merging it the normal way decompresses every layer it touches back to full precision — an 8 GB compressed expert becomes 28.58 GB, bigger than the entire GPU budget, for one of the two experts the model needs. Claude found that by reading the accelerator's own file index with a small range request instead of downloading 28 GB to find out. Computing the adjustment separately at runtime instead, leaving the base compressed, measured three to five times more accurate than merging and re-compressing would have been — the correction is smaller than one compression step, so re-compressing mostly re-rolls the compression grid for nothing.

Then the decoder produced 52 frames where I'd asked for 49. Claude's first fix produced exactly 49, and it was ready to call that done. I pushed back — a correct count is not the same thing as correct pixels — and had Claude build a separate, independently verified reference to check against before accepting it. Compared module by module: the fix had the right count and the wrong content on frame zero, and — the real defect — carried no temporal history into any frame after the first, same as the original bug it was meant to fix. The frame count was a symptom. The missing history was the disease.

Claude rebuilt it properly the next day — per-frame decoding, correct history threading. First comparison against the reference came back 95.6% error. The fault turned out to be in the test itself, not the code: the reference's normalisation was written without a scaling factor it actually applies. Fixed, the real result was a mean difference of 9 parts in a hundred million and a correlation of 1.00000000. Floating-point noise. A correct implementation that would have been thrown away as broken if I'd let the first number stand.

One more real bug on the way to the finish line: the bigger model needs both its experts in memory at once, 17.89 GB before any actual work starts, and it failed to load even with 21 GB free. Claude fixed it by loading one expert at a time and releasing it before the next loads — down to 8.95 GB. Then a second bug, its own: the residency tracker was holding a reference to the last expert, keeping 9.4 GB alive through decode that should have been freed. Fixing that took swap growth from 4.72 GB to zero.

The bigger model's first clean run, one command, no manual steps. 33.4 minutes.

33.4 minutes, one command. Slightly better per second of finished footage than the earlier baseline, purely from a lower frame rate — a real quality trade, not free speed. The opening-frame artefact that had plagued every earlier clip was gone. And honestly, watching both side by side: the original portrait still looked better. Deeper detail, more convincing eyes. Four steps against forty is still four steps against forty.

What four days actually proved

Build the safety net first, and make Claude actually test that it fires, not just claim it does — this one failed its own test twice before it worked. Read the licence before the benchmark — the single biggest available speedup was ruled out by a file nobody would think to check. A correct frame count is not a correct frame. And twice this stretch, the largest apparent failure turned out to be a fault in how the thing was being measured, not in what was built — which is exactly why I keep asking for the check before accepting the claim.

Two working engines by the end of it. The economics hadn't fundamentally moved — roughly 11 minutes of compute per second of finished video at best. That's the machine talking, not the software.

Next A verdict, and the correction I owed myself

This is a running log of building LVGenStudio, a local video generation studio for Mac. Written as I go, including the parts that didn't work. Everything here is dated, and anything I later find out was wrong gets a retraction rather than a quiet edit.