cd /news/machine-learning/cpu-trainer-open-source · home › topics › machine-learning › article
[ARTICLE · art-176707] src=discuss.huggingface.co ↗ pub= topic=machine-learning verified=true sentiment=· neutral

Cpu trainer open source

A CPU-only diffusion training experiment found that halving U-Net width cut update time to 22.90-24.39 ms from 31.27-32.75 ms at batch 4 with 4 threads, while BF16 autocast slowed updates to 54.73-59.41 ms, the author reported on a Colab Intel Xeon CPU allocation running PyTorch 2.14.1+cu130. Raising batch size to 8 lifted throughput to 192-203 latent draws/s versus 122-128 at batch 4, and a separate two-thread test estimated 2,000 updates at 193-200 s eager, 276 s with a fresh compile and 190 s with a reused cache. The author cautioned that quality equivalence is unproven and that zero terminal SNR with a matching velocity target improved prompt response across two paired seeds but still produced rough samples.

recommendation

Profile thread count and batch size before changing precision: 4 threads at batch 8 beat 1-2 threads, and BF16 autocast was slower than FP32 on this CPU loop.

more in playbook: Inference and self-hosting
read2 min views2 publishedNov 26, 2026

For now, I tried a few things with CPU-only training in mind: I would keep the basic CPU-only scratch design. The cached 4x16x16 latents are already a useful optimization. I reconstructed the displayed code to compare cost per U-Net update and quality per training budget separately.

Short repeated runs on a Colab Intel Xeon CPU allocation (PyTorch 2.14.1+cu130 executing on CPU, using cached real-image latents):

Configuration ms/update Latent draws/s
Original width, batch 4, 4 threads, FP32 31.27-32.75 122-128
Same, 1 thread 56.16-59.40 67-71
Same, 2 threads 40.78-42.32 95-98
Original width, batch 8, 4 threads 39.47-41.70 192-203
Half width, batch 4, 4 threads 22.90-24.39 164-175
Original width, batch 4, 4 threads, BF16 autocast 54.73-59.41 67-73

Ranges are short-run medians, not confidence intervals. Batch 8 increased throughput, width 32 reduced update time, BF16 was slower. Quality equivalence is unproven. Data preparation was ~0.16 ms (0.5%) in one reference run; workers would be more relevant with on-the-fly image preprocessing.

Separate two-thread CPU test, estimated 2,000 updates: 193-200 s eager, 276 s fresh compile, 190 s reused cache. Start eager.

For quality, zero terminal SNR with a matching velocity target increased prompt response in two paired training seeds, but samples remained rough. I used a T4 for quality comparisons, not CPU speed evidence. This requires new training; the speed changes are independent.

  1. Measure the actual training loop | Main limit | First option | |---|---| | Seconds/update | Thread count, batch throughput, profile | | Repeated setup | VAE and latent/token cache | | Compute/RAM per update | Width or physical batch | | Rough images | Reconstructions, matched schedule/target/sampler | | Weak prompt response | Same-noise controls, known words | | Slow generation | CFG batching, preview steps | | Long repeated fixed-shape runs | Compilation including startup/reuse |

CPU model, PyTorch version and update timing would help tailor settings.

── more in #machine-learning 4 stories · sorted by recency
── more on @pytorch 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/cpu-trainer-open-sou…] indexed:0 read:2min 2026-11-26 · —