QLoRA on Qwen3.8-27B with one 24 GB card: what loads, and what each sequence length costs
A 4-bit Qwen3.8-27B trained a rank-16 LoRA adapter on one 24 GB RTX 4090 at sequence lengths of 2,048, 4,096 and 8,192 tokens. The default load was refused. The runs that worked kept the whole model on the card, moved the input embedding to system RAM and skipped the vision tower. Every run also used Windows shared GPU memory, so these are measurements of what ran, not proof of a clean fit.
This was a rehearsal on made-up text. We measured memory and time. We claim nothing about the quality of a trained adapter.
Setup
- Model:
unsloth/Qwen3.8-27B-unsloth-bnb-4bit, loaded in 4-bit. - Card: one RTX 4090, 24,563 MiB. The same card drives the desktop, which held 1,173 to 2,140 MiB before each run. The processor has no integrated graphics.
- System: Windows with WSL2 (Ubuntu), 48 GB of RAM assigned to WSL.
- Software: Unsloth 2026.11.12, PyTorch 2.14.1 (CUDA 13.2 runtime), transformers 5.17.0, peft 0.22.0, bitsandbytes 0.50.2, Triton 3.8.0.
- Adapter: rank 16, alpha 16, no dropout, on the attention and MLP modules of the language layers. That is 116,727,808 trainable parameters, which Unsloth reports as 0.43% of the model.
- Training: batch size 1, gradient accumulation 4, 8-bit AdamW, bf16, Unsloth's gradient checkpointing, 20 optimizer steps.
Method
Each run was a separate process with one sequence length. The data was 80 examples of random syllables in the model's chat format, each cut to exactly the sequence length, so we gave every step the same shape.
We tracked each run by PyTorch memory, optimizer step timing and card memory:
- PyTorch's peak allocated and peak reserved memory during training.
- The time of each optimizer step. One optimizer step is four examples. We left the first step out of the mean because it includes kernel compilation.
- The card's dedicated and shared memory as Windows reports them, sampled through the run.
What loads
| Load settings | Result |
|---|---|
| Unsloth defaults | Refused: part of the model went to the CPU, and the 4-bit loader cannot quantize that part |
| Defaults plus embedding offload | Refused, same error |
| Whole model pinned to the card, embedding offload | Loaded and trained at 2,048 tokens |
| The same, text only (vision tower skipped) | Loaded and trained at 2,048, 4,096 and 8,192 tokens |
The two refused runs used automatic device placement. We did not test pinning the model to the card without the embedding offload, so we cannot say whether the offload is required or only helpful.
The offloaded input embedding is 248,320 by 5,120 in bf16, which is 2,425 MiB of system RAM. Skipping the vision tower lowered allocated memory after load from 18,904 MiB to 18,022 MiB.
Results
| Sequence length | Vision tower | Peak allocated | Peak reserved | Per optimizer step | Step range | Shared GPU memory, peak in training |
|---|---|---|---|---|---|---|
| 2,048 | loaded | 20,871 MiB | 22,100 MiB | 11.34 s | 10.61 to 14.64 s | 3,903 MiB (whole run) |
| 2,048 | skipped | 20,010 MiB | 21,380 MiB | 10.46 s | 10.42 to 10.80 s | 1,682 MiB |
| 4,096 | skipped | 20,737 MiB | 21,388 MiB | 19.98 s | 19.92 to 20.29 s | 2,867 MiB |
| 8,192 | skipped | 22,152 MiB | 23,018 MiB | 40.82 s | 40.81 to 40.85 s | 5,365 MiB |
Step time scaled with sequence length. In tokens per second, counting four examples per step, the text-only runs come to about 783, 820 and 803.
We measured peak allocated memory growing by 727 MiB from 2,048 to 4,096 tokens and by 1,415 MiB from 4,096 to 8,192.
Shared memory
On this system the driver does not fail when the card fills. It moves memory into Windows shared GPU memory, which is system RAM. Before each text-only run, shared memory stood at 49 to 170 MiB. During training it rose to 1,682, 2,867 and 5,365 MiB.
Dedicated memory peaked at 22,607 MiB, 23,078 MiB and 24,120 MiB in the three text-only runs. The card's own total is 24,563 MiB, so the 8,192-token run filled it.
Step times in the text-only runs stayed within 0.4 s of each other after the first step, so the spill did not show as stalls. We have no run without spill to compare against, so we cannot say what it cost in speed.
With the vision tower loaded, step times were less even: 10.61 to 14.64 s.
Kernels
Qwen3.8-27B mixes full-attention blocks with gated linear-attention blocks. Triton compiles the linear-attention kernels and caches them on disk. The first step of each run took 16 to 57 s. Later steps ran at a steady time.
Converting the adapter for llama.cpp
The adapter from the 8,192-token run is 467,047,680 bytes as safetensors. llama.cpp v1.1.0's convert_lora_to_gguf.py converted it to a 233,524,416-byte F16 file with 992 tensors, covering both block types:
- 16 full-attention blocks: query, key, value and output projections.
- 48 linear-attention blocks: the tensors llama.cpp names
attn_qkv,attn_gate,ssm_alpha,ssm_betaandssm_out. - All 64 blocks: the three MLP projections.
We needed two fixes to get there:
- The converter's
--base-model-idoption, which fetches the base configuration by model name, failed, because the transformers version it pins does not know this architecture. - We pointed it at a local directory with only the configuration and tokenizer files, and that worked. The converter looks for weights that are not there if the directory also lists the weight files.
We have not yet loaded the converted adapter in llama.cpp. Until that is done, the conversion is only shown to produce a file.
Limits
- Random syllables, 20 steps, one run per setting. There is no run-to-run spread and no quality result. Loss fell during every run, which shows only that gradients reached the adapter.
- The desktop shared the card and held a different amount before each run. A card with nothing else on it has 1.1 to 2.1 GiB more room than these runs had.
- Peak allocated and reserved figures come from PyTorch and do not include memory other processes hold on the card.
- The 2,048-token run with the vision tower has no training-phase shared-memory figure; 3,903 MiB is its peak over the whole run, including the load.
- WSL2 moves memory to system RAM instead of failing. On a system that fails at the limit, the 8,192-token run may not complete.
Open questions
- Whether the converted adapter loads and changes output in llama.cpp, including on the linear-attention blocks.
- Step time and memory with real training text, where examples vary in length.
- The same runs on a card that is not driving a display.