A 24 GB RTX 4090 or a 32 GB RTX 5090 can pretrain a network for a specific task, fine-tune an existing language model or run experiments with vision architectures. Memory determines whether a configuration can complete a step. Data, throughput and available time determine whether it produces a useful result. Published work provides examples of all three tasks. One project that trained a two-billion-parameter model on RTX 5090 cards scaled up to 96 GPUs.
Classifying Spanish-language support requests, segmenting microscopy images and training a general assistant from scratch are very different undertakings. The examples below will help you decide what to try on a PC and what to look for behind a headline claiming that a “7B model fits in 24 GB”.
What does training a model on a consumer GPU involve?
| Task | What the model learns or does | What to measure |
|---|---|---|
| Classical machine learning | A classifier or regressor learns from features, vectorised text or tabular data. | CPU baseline performance, preparation time and metrics on unseen examples. |
| Pretraining from scratch | All weights start from an initialisation and learn from a corpus. | Data volume, validation loss, total time and capabilities at the end of training. |
| Full fine-tuning | Every weight of an existing model can be updated. | Weights, gradients, optimiser state, activations and changes in other capabilities. |
| LoRA or QLoRA fine-tuning | Adapters are trained on top of a frozen base model. QLoRA stores much of the base in four bits. | Peak memory, context length, tokens per second and quality relative to the same base model. |
| Inference | The trained model produces a response or prediction. | Memory for weights and context, latency and throughput at the expected load. |
For tabular data or classification, start with a simple baseline. Whether a GPU helps depends on the implementation. XGBoost offers CUDA algorithms, while TF-IDF and logistic regression on a CPU may suffice for a small text dataset. With a language model, a file that fits for inference can still run out of memory on the first training step. XGBoost CUDA guide · Valinkey guide to hardware for machine learning, training and inference.
Published results on desktop RTX cards
| Task | GPU and configuration | Reported result |
|---|---|---|
| Pretraining a Transformer roughly the size of GPT-2 124M | 1 RTX 4090, modified NanoGPT, FineWeb-Edu and local attention | 917.5 million tokens processed in about 115 minutes. The optimisation project provides code, a training log and weights. Log and checkpoint |
| Fine-tuning for multilingual grammar correction | 1 RTX 4090, four-bit Gemma 2 9B IT, QLoRA, rank 128, microbatch size 4 and four accumulation steps | Two adapters for separate tasks, two epochs per adapter and about three hours per epoch. The paper gives no peak VRAM measurement. Staruch, NLP4CALL 2025, section 4 |
| Full fine-tuning of LLaMA 7B | 1 RTX 3090, LOMO optimiser, sequence length 1,024 and batch size 1 | Peak allocated memory of 13.61 GB and 769.92 tokens/s in the authors’ throughput test. LOMO, ACL 2024, table 2 |
| Vision pretraining for microscopy segmentation | 1 RTX 5090, AFFMAE, approximately 65 million parameters and 187,270 unlabelled images | 138 hours against 281 for ViT-MAE on the same card at 512 × 512. The protocol specifies 400 epochs and an effective batch size of 256. AFFMAE v2, sections 4 and 7 |
The NanoGPT run used blocks of 32,768 tokens with local attention and windows of up to 1,792. Processing a block that way has a different computational cost from dense attention across a single context of 32,768 tokens. The 115-minute result applies to this architecture and corpus. Use the project’s code and configuration to reproduce it. NanoGPT 1GPU Speedrun repository.
In Spain, UPC’s inLab FIB documented fine-tuning Qwen3-8B and other models on a 16 GB RTX 4080 using quantisation, RS-LoRA, FlashAttention-2, activation checkpointing and gradient accumulation. The application had to handle documents exceeding 140,000 tokens. Its method limited each step to a context of 20,000 tokens, an important distinction when sizing memory. A separate team including CSIC, UAM and research centres in La Rioja fine-tuned BART models on an RTX 3090 to simplify Spanish text. They reported differences between automatic metrics and human evaluations. inLab FIB, May 2026 · CLARA-MeD study, LREC-COLING 2024.
How to estimate training VRAM
Add weights, gradients, optimiser state, activations and temporary workspace. For a dense model with 7 billion parameters, the weights alone occupy about 14 GB in BF16 or an ideal minimum of 3.5 GB at four bits. Real quantisation adds scales and metadata and may leave layers at higher precision. An illustrative AdamW budget uses 16 bytes per parameter for a BF16 weight, BF16 gradient, FP32 master copy and two FP32 moments. That totals 112 GB for full fine-tuning before activations and temporary allocations. Other implementations may use different formats, shard state or offload it. Here GB denotes decimal gigabytes and GiB uses powers of 1,024. Transformers guide to training memory.
LoRA inserts low-rank matrices into selected layers and optimises those matrices. For a 4,096 × 4,096 projection, a rank-16 adapter introduces 131,072 parameters, compared with 16,777,216 in the original weight matrix. QLoRA stores the base model in quantised form and backpropagates gradients to the adapters. The original paper fine-tuned a 65B model on a single 48 GB GPU with this method. When applying a published result, check which layers are quantised and which microbatch size and sequence length your setup supports. LoRA · QLoRA.
Activation memory depends on the work done in each step. Activation checkpointing saves fewer intermediate states in the forward pass and recomputes some of them when calculating gradients. Smaller microbatches and gradient accumulation can maintain a larger effective batch at the cost of time. An eight-bit optimiser reduces the size of its state. Offloading to system RAM can avoid some VRAM peaks and increases PCIe traffic. PyTorch checkpointing · Eight-bit optimisers.
What LOMO and GaLore demonstrate
LOMO combines gradient calculation and parameter updates to reduce gradient storage. The 13.61 GB result for LLaMA 7B applies to the method, sequence length and batch size in the table. The same paper reports a 65B experiment with eight RTX 3090 cards and ZeRO-3. With a sequence length of 1,024 and batch size 1, it reports 19.18 GB allocated and 4.93 tokens/s per GPU for that distributed configuration. GaLore projects gradients to reduce optimiser state while updating model weights. Its LLaMA 7B test reports 22 GB of memory, with checkpointing allowing more tokens per microbatch. LOMO, section 3.2 · GaLore, ICML 2024 · Authors’ training recipe.
Q-GaLore reports pretraining a 7B model from scratch on a 16 GB RTX 4060 Ti with about 5.2 billion tokens and 40,000 steps on C4. This demonstrates a pretraining run within that memory budget. To judge its relevance, compare the steps, loss and coverage of the corpus with your target. That run used fewer steps than the study’s 150,000-step protocol. Q-GaLore, section 4.2.2.
Architecture and software changes that make larger models practical
Efficient attention and long sequences
FlashAttention computes exact attention in blocks, avoiding the need to write the entire score matrix to VRAM. With batch size 1, 32 heads and BF16, materialising just that matrix would take 1 GiB at 4,096 tokens and 4 GiB at 8,192. Dense attention computation still grows quadratically with sequence length. Windowed attention instead changes which positions can interact within each layer. Check the forward and backward kernels that actually run on your GPU. A Blackwell RTX card and a B200 accelerator can have different kernel support despite sharing an architecture name. FlashAttention · FlashAttention-2 and repository support · FlashAttention-4 measurements on B200.
Vision Transformers and the two X-ViT papers
A basic Vision Transformer using 16 × 16 patches produces 196 spatial tokens from a 224 × 224 image and 784 from a 448 × 448 image. That is four times as many tokens and sixteen times as many dense attention pairs, before adding the classification token. Merging tokens inside the network can have a significant effect on cost. AFFMAE combines local attention with adaptive token merging. In microscopy pretraining at batch size 32 it reports 14.5 GB against 29.7 GB for ViT-MAE. The study also reports runtime and segmentation quality. Original ViT paper · AFFMAE, tables 2 and 5 · Code and configurations.
Two papers use the name X-ViT. Bulat and colleagues presented a video model at NeurIPS 2021 whose attention mixes spatial and temporal information. Lee and Song used the name in 2022 for a vision Transformer that factorises attention without softmax. Check whether the paper deals with video sequences or still images when looking up the name. Video X-ViT · Linear-attention X-ViT.
Experts, recurrent state and mixed precision
A mixture of experts (MoE) selects part of the network for each token. The Gemma 4 26B A4B model card reports 25.2 billion total parameters and 3.8 billion active. Storing all weights together in BF16 would take 50.4 GB, even though about 3.8 billion parameters are active per token. An ideal four-bit representation would take 12.6 GB before scales and other allocations. Expert placement, load imbalance and moving tokens between experts all affect training. Mamba explores selective recurrent states to scale linearly with sequence length. Some hybrid architectures retain attention layers. Each approach changes a different part of the cost and needs testing against the target task. Gemma 4 model card · Mamba · Nemotron 3 Super hybrid architecture.
Mixed precision selects a format by operation. Some multiplications can run in FP8 while sensitive operations or state stay in BF16 or FP32. Kernel support, numerical scales and validation quality matter. Total memory also depends on buffers and copies retained in other formats. NVIDIA guide to FP8 training.
What changes when you combine RTX cards?
In conventional data parallelism, each GPU holds a model copy and works on different data. FSDP2 or ZeRO-3 can shard weights, gradients and optimiser state and exchange data at each step. RTX 4090 and 5090 cards lack NVLink. Two 24 GB cards can share work when the software supports it, and each retains its own local memory. Slot topology, support for direct GPU communication and transfer sizes affect throughput. Check the CUDA environment, inspect the topology with nvidia-smi topo -m and measure collective operations with nccl-tests before comparing one and two cards. FSDP2 · ZeRO · NCCL troubleshooting · Valinkey CUDA guide. If you are buying second-hand, see how to test PCIe on a used RTX card to interpret link speed and lane count under load.
Puro-2B illustrates a larger undertaking on consumer GPUs. The authors pretrained a dense Transformer with about 2 billion parameters. Their main run used 24 RTX 5090 cards for 10.43 days in the first phase and 96 for 7.16 days in the second. The table totals about 1.40 trillion tokens and 22,514 active GPU-hours. Matrix operations ran in FP8 with other state in BF16/FP32, eight cards per node and 400 Gb/s InfiniBand links between nodes. Using their local rate and active hours, the authors estimate the equivalent rental cost at US$6,891. That figure covers compute for this run. Equipment, data and operation require their own budgets. Puro-2B v2, sections 2 and 3 and appendix B.
A Spanish-language fine-tuning experiment with Salamandra 2B
Objective. Classify the intent of a short query in Spanish. Use the Barcelona Supercomputing Center’s Salamandra-2B-Instruct and the es-ES subset of MASSIVE. Select 1,000 training examples with a fixed seed and aim to represent every class. Keep validation and test sets separate. Evaluate the base model, the QLoRA adapter and a TF-IDF/logistic regression baseline on the same examples. The labels allow you to measure accuracy and macro F1, which weights each class equally. Salamandra model card · MASSIVE and JSONL download.
| Parameter in the worked example | Starting value |
|---|---|
| Maximum length and microbatch | 128 tokens, one sequence per microbatch |
| Accumulation | Eight microbatches per update |
| Epochs and updates | Three epochs of 1,000 examples, 375 updates |
| Tokens processed | 240,000 if the templated examples average 80 useful tokens. The ceiling is 384,000 if each example is padded to 128. |
| Adapters | Rank 16 on q, k, v, o, gate, up and down projections in all 24 layers. About 14.9 million trainable parameters, roughly 0.66% of the model. |
| Frozen weights | An ideal estimate of about 2.70 GB if linear layers use four bits and both vocabulary matrices stay in BF16. About 4.80 GB if both stay in FP32. |
Adapter size is the sum of rank × (input dimension + output dimension) across projections. The frozen-weight estimate starts with about 1.205 billion linear parameters at 0.5 bytes each and about 1.049 billion parameters in the two vocabulary matrices at two or four bytes. Add scales, adapter gradients and optimiser state, activations and temporary storage. The 128-token limit covers the full example, including instructions and response. Check how many tokens contribute to the loss after masking the prompt and how many are lost to truncation. Salamandra configuration · Preparing PEFT for quantisation.
Turning the estimate into a test
- Record the environment. Note the GPU, driver, PyTorch, CUDA, Transformers, PEFT and quantisation library versions, the seed and the model and dataset revisions. Run one complete step with a gradient and an optimiser update. Record the precision of the layers left unquantised.
- Measure 25 to 50 updates after warm-up. Record peak allocated and reserved memory in PyTorch, GPU memory used by the process, system RAM and useful tokens per second. Include a batch with the longest sequences. A run that fits short examples may fail later. Estimate training time by dividing the token budget by the measured rate using the same token-counting convention. Time validation and checkpoint saving separately. Measuring CUDA memory in PyTorch.
- Compare against both baselines. Choose the configuration on the validation set and evaluate the test set once. Report accuracy, macro F1 and the percentage of responses containing a valid label. Inspect errors in classes with few examples. If the CPU baseline performs equally well for the application, you can save the training compute.
- Use the measurement to calculate cost. Multiply the average power of the whole computer in kW by hours and the electricity rate. At an illustrative 120 useful tokens/s, 240,000 tokens would take about 33 minutes of training. At an average 450 W from the wall, that is 0.25 kWh, or €0.06 at €0.24/kWh, before validation and saving. For rented hardware, use billed GPU-hours and add storage for the data and checkpoints. Compare the cost of reaching the same target metric.
This is a calculated scenario for one GPU. The BSC reports that supervised fine-tuning of Salamandra 2B took around twelve hours on 16 H100s with ZeRO-3. The example here reuses that model and trains adapters for one narrow task. Measure a complete step and the result on the task before deciding to increase context length, corpus size or the number of trainable parameters. Salamandra technical report, section 4.1.2.




