{"slug": "cpu-trainer-open-source", "title": "Cpu trainer open source", "summary": "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.", "body_md": "For now, I tried a few things with CPU-only training in mind:\n\nI 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.\n\nShort repeated runs on a Colab Intel Xeon CPU allocation (PyTorch 2.14.1+cu130 executing on **CPU**, using cached real-image latents):\n\n| Configuration | ms/update | Latent draws/s | \n|---|---|---|\n| Original width, batch 4, 4 threads, FP32 | 31.27-32.75 | 122-128 | \n| Same, 1 thread | 56.16-59.40 | 67-71 | \n| Same, 2 threads | 40.78-42.32 | 95-98 | \n| Original width, batch 8, 4 threads | 39.47-41.70 | 192-203 | \n| Half width, batch 4, 4 threads | 22.90-24.39 | 164-175 | \n| Original width, batch 4, 4 threads, BF16 autocast | 54.73-59.41 | 67-73 | \n\nRanges 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; loader workers would be more relevant with on-the-fly image preprocessing.\n\nSeparate two-thread CPU test, estimated 2,000 updates: 193-200 s eager, 276 s fresh compile, 190 s reused cache. Start eager.\n\nFor 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.\n\n1. Measure the actual training loop\n| Main limit | First option | \n|---|---|\n| Seconds/update | Thread count, batch throughput, profile | \n| Repeated setup | VAE and latent/token cache | \n| Compute/RAM per update | Width or physical batch | \n| Rough images | Reconstructions, matched schedule/target/sampler | \n| Weak prompt response | Same-noise controls, known words | \n| Slow generation | CFG batching, preview steps | \n| Long repeated fixed-shape runs | Compilation including startup/reuse | \n\nCPU model, PyTorch version and update timing would help tailor settings.", "url": "https://wpnews.pro/news/cpu-trainer-open-source", "canonical_source": "https://discuss.huggingface.co/t/cpu-trainer-open-source/192506#post_3", "published_at": "2026-11-26 09:45:07+00:00", "updated_at": "2026-11-26 10:14:30.838563+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "ai-infrastructure"], "entities": ["PyTorch", "Colab", "Intel Xeon", "U-Net", "T4"], "also_reported_by": [], "takeaway": "On CPU, halving U-Net width cut updates to 22.90-24.39 ms from 31.27-32.75 ms and batch 8 raised throughput to 192-203 latent draws/s, while BF16 autocast slowed updates to 54.73-59.41 ms.", "recommendation": {"advice": "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.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/cpu-trainer-open-source", "markdown": "https://wpnews.pro/news/cpu-trainer-open-source.md", "text": "https://wpnews.pro/news/cpu-trainer-open-source.txt", "jsonld": "https://wpnews.pro/news/cpu-trainer-open-source.jsonld"}}