Home / use case

Fine-tuning a local Qwen3.8-27B on one RTX 4090 to write Blender 5.2 scripts

At a glance
Hardware
One RTX 4090 with 24 GiB VRAM, also driving the desktop
Models & engines
Qwen3.8-27B, Unsloth UD-Q4_K_XL GGUF for inference (about 17 GiB at 3,000 tokens of context)
Key gotcha
You can't fine-tune the 4-bit quant directly: learning steps get rounded away or are far too large

What they built

Shimin Zhang has run Qwen3.8-27B (Unsloth 4-bit GGUF) on a local RTX 4090 for a few months. Noticing that it writes poor Blender scripts, likely because most training data uses the older v4-and-below API, they set out to fine-tune it locally to build low-poly dioramas in Blender 5.2.

The post walks through the memory math of fitting a fine-tuning pipeline on one gaming GPU: why a full BF16 fine-tune would need 332 GiB of VRAM, and how QLoRA, gradient checkpointing and loss chunking bring it down to fit in 24 GiB.

The training data was 2,000 Blender scripts generated with Sonnet 5.5 from location prompts plus a diorama style guide; the training and the tuned model both run on the local GPU.

Setup

  • One RTX 4090 with 24 GiB VRAM, also driving the desktop
  • Qwen3.8-27B, Unsloth UD-Q4_K_XL GGUF for inference (about 17 GiB at 3,000 tokens of context)
  • QLoRA: base model frozen in 4-bit, rank-16 adapters on every full attention and MLP layer
  • Blender 5.2, dataset published as ShiminZ/blender-lowpoly-dioramas, code in the Local-FineTune-Memory repo

How it works

  1. QLoRA trains only small adapter weights, cutting gradient and optimizer memory by about two orders of magnitude
  2. Gradient checkpointing saves only per-layer inputs and recomputes activations during backprop, bringing the footprint to 32 GiB
  3. Loss chunking computes the loss over 128-token sections instead of the full 3,000-token sequence with its 248,320-token vocabulary, which finally fits everything on the card
  4. Training ran about one example per batch; 2 epochs took about 6 hours overnight

Results & numbers

  • On 100 held-out prompts, scripts that ran without errors rose from 42 for the base model to 85 after tuning
  • Held-out loss went from 0.370 to 0.365 after 2 epochs, with some overfitting visible in the loss curve
  • The tuned model picked up the low-poly diorama style without it being in the prompt, including on movie-scene prompts
  • Gradient checkpointing made a pass only about 22% slower; chunked loss was about 40% slower but the whole step only about 3% slower

Gotchas

  • You can't fine-tune the 4-bit quant directly: learning steps get rounded away or are far too large
  • Existing Blender datasets on Hugging Face didn't help, possibly because they're already in the model's training data
  • The training scripts were generated with a cloud model (Sonnet 5.5); only training and inference are local
  • A LoRA adapter tends to make the model worse at tasks it wasn't tuned for, so toggle it per task
“It never occurred to me that local fine-tuning was possible on a single GPU designed for gaming”— Shimin Zhang

Do it yourself

  1. Measure how much VRAM your inference setup leaves free at your context length
  2. Load the base model frozen in 4-bit and add rank-16 LoRA adapters on attention and MLP layers
  3. Turn on gradient checkpointing
  4. Chunk the loss computation (128-token sections in the post) if the vocabulary is large
  5. Build a narrow dataset for one repeated task, hold out about 100 examples, and train overnight
  6. Compare base vs tuned on the held-out set and switch the adapter on only for that task
Source: Shimin Zhang (blog) · Published 2026-11-24 · Added 2026-11-28. This write-up summarizes the original source; see it for full details.

Similar setups

Faster local Qwen on an AMD eGPU with the llama-cpp-rdna-boosts patches

A developer running a Qwen3.8-27B fine-tune on an AMD R9700 eGPU swapped vanilla llama.cpp for a small set of AMD-specific patches in a Podman image and roughly doubled prefill speed.

devnull.land · 2026-11-27

OpenCode on a CPU-only Intel i7 laptop talking to local Ollama coder models

Idada Osaigbovo James wires OpenCode on a Dell Latitude 5430 (i7-1265U, 32 GB RAM, Iris Xe) to Ollama’s local OpenAI-compatible API and runs Qwen2.5-Coder 1.5B/7B with no cloud subscription.

Medium · 2026-11-06

Letting a coding agent tune llama.cpp on an 8 GB AMD GPU: 3x faster prompt reading for OpenCode

Cliff K had his coding agent benchmark llama.cpp backends and flags for a Qwen3.6 35B MoE on a Radeon RX 6600 XT, at the context depths OpenCode really uses, and turned the process into an open-source skill.

Cliff K (DEV Community) · 2026-11-01

Cutting a local Qwen coding agent's wait on a 16GB Mac with a memory hook

A developer running a coding agent on qwen3.5:9b through Ollama replaced its always-loaded memory index with a hook that attaches only relevant memory lines, and cut median answer time from 90.4s to 56.4s.

DEV Community (JustJinoIT) · 2026-12-02