Dreamer Series - Part 4
Series directory (currently at Part 4):
- (Part 1) Understanding Dreamer: How World Models Learn to ‘Imagine’
- (Part 2) Dreamer’s Actor-Critic: Policy Optimization in Imagination
- (Part 3) DreamerV3 Training Tips: Lessons from Real-World Debugging
- (Part 4) DreamerV3 GPU Selection Guide: From VRAM Requirements to Cost-Effectiveness Analysis
The previous article covered many GPU-related engineering issues: what to do when VRAM runs out, how to set up mixed precision, how to debug OOM errors. But there’s a more fundamental question we didn’t address: what kind of GPU do you actually need?
This article analyzes the actual VRAM usage and compute characteristics of DreamerV3 to help you understand which GPUs are suitable for different scenarios. The content is based on my hands-on training experience with RTX 5090D (32GB) and AutoDL cloud GPUs.
1. DreamerV3’s GPU Requirements
Before choosing a GPU, let’s first understand which GPU resources DreamerV3 actually consumes.
VRAM Usage Analysis
DreamerV3’s VRAM usage mainly comes from the following components:
Model Parameters and Training State
DreamerV3’s model size isn’t particularly large. Using the default configuration as an example:
- RSSM: deter=4096, stoch=32, classes=32, hidden=4096
- Actor/Critic: 3-layer MLP, units=1024
- Encoder/Decoder: depends on the task (pixel inputs are much larger)
For typical control tasks, model parameters are usually not the main source of VRAM consumption—compared to activations and optimizer states, parameter storage is relatively small. However, during training you need to store parameter + gradient + Adam’s m and v, totaling about 4-8x the parameter count itself.
The real VRAM hog is the intermediate states of training batches. Understanding this data flow is important:
sampled sequence (from replay buffer, CPU)
↓
encoder (pixel → latent)
↓
RSSM unroll (prior/posterior rollout)
↓
imagination (actor generates actions in latent space)
↓
actor/value update
The intermediate activations throughout this entire pipeline reside in GPU VRAM. This is why increasing batch_length affects VRAM much more than increasing replay_size—the former directly increases the sequence length for each forward/backward pass, while the latter only increases the amount of data in CPU memory.
Actual Measurements
The following VRAM data is based on DreamerV3 commit
e3f02248, JAX 0.4.x, CUDA 12.x, RTX 5090D (32GB), usingnvidia-smito observe peak allocation, withXLA_PYTHON_CLIENT_PREALLOCATE=true(default pre-allocation). The numbers recorded here reflect JAX’s GPU allocation, not the model’s true peak demand—the actual model may require less VRAM, but XLA arena allocation takes some extra. Values may vary across different configurations and are for reference only.
Using RTX 5090D (32GB) as an example, typical VRAM usage for training DreamerV3:
| Task | Obs Type | batch_size | batch_length | imag_length | VRAM Usage |
|---|---|---|---|---|---|
| DMC state | state (low-dim) | 16 | 64 | 15 | ~18-22 GB |
| DMC state | state (low-dim) | 32 | 64 | 15 | ~25-28 GB |
| DMC state | state (low-dim) | 16 | 64 | 25 | ~24-27 GB |
| Atari | 84×84 pixel | 16 | 64 | 15 | ~20-25 GB |
As you can see, a 24GB GPU (such as RTX 3090/4090) is a comfortable starting point for most default experiment configurations. A 16GB GPU (such as RTX 4080) isn’t incapable of running formal experiments—some state-based control tasks with small batch sizes and short sequences can work fine, you just need to reduce batch size or imagination length.
Compute Characteristics
DreamerV3’s computation has several notable characteristics:
JAX + XLA Compilation
JAX uses the XLA compiler, which compiles the computation graph on the first run. This means:
- Slow initial startup (a few minutes of compilation time)
- Fast training speed after compilation
- GPU’s FP32/TF32 performance is more relevant than the advertised “AI TOPS”
For DreamerV3 training, the priority order of GPU performance metrics is:
- VRAM Capacity: determines what configurations you can run
- GPU Compute Throughput (FP32/TF32 Tensor Core): actual compute speed, TF32 makes a noticeable difference for large MLP training
- VRAM Bandwidth: can become a bottleneck with large batch sizes or large models
- Software Ecosystem Compatibility: JAX/CUDA version matching, compilation efficiency
Don’t use Tensor Core INT8 TOPS to compare DreamerV3 training performance—DreamerV3 primarily uses FP32/TF32, so INT8 performance has very limited reference value.
Imagination Phase Parallelism
Imagination rollout has temporal dependencies (each step depends on the previous step’s latent state), so it cannot be fully parallelized across time. But this doesn’t mean the entire computation is sequential—the batch dimension, latent samples, and matrix operations within the network can still leverage GPU parallelism. This means:
- Larger batch sizes can better utilize GPU parallelism
- But VRAM also grows linearly
Encoder/Decoder is the Compute Bottleneck
For pixel input tasks (like Atari), the Encoder and Decoder computation far exceeds the RSSM’s internal computation. Enabling bfloat16 matmul precision for some matrix operations may improve throughput, but this is not equivalent to full AMP (Automatic Mixed Precision)—actual benefits depend on model implementation and hardware. Key probabilistic model computations such as RSSM and KL loss are generally recommended to stay in float32 to avoid training stability issues.
2. GPU Options for Different Scenarios
Consumer GPUs
RTX 4090 (24GB) / RTX 3090 (24GB)
This is currently the most cost-effective choice for running DreamerV3 (assuming reasonable market prices for new/used cards).
- 24GB VRAM is sufficient for default configurations of most tasks
- RTX 4090 already provides excellent training speed for DreamerV3’s model scale
- RTX 5090D’s advantage lies more in the 32GB VRAM headroom and larger experiment configuration space
- RTX 3090 used prices are reasonable, suitable for budget-constrained researchers
- No additional electricity and maintenance costs (compared to multi-GPU servers)
Suitable for: individual research, prototype validation, small-to-medium scale experiments
RTX 4080 (16GB) / RTX 4070 Ti (12GB)
Can run DreamerV3, but requires configuration adjustments. Here’s a conservative configuration that might work (actual results depend on observation type, encoder scale, sequence length):
# Recommended configuration for 16GB VRAM
batch_size: 8 # reduce from 16 to 8
imag_length: 10 # reduce from 15 to 10
batch_length: 256 # also reduce sequence length appropriately
Suitable for: learning DreamerV3, debugging code, validating ideas. Not ideal for formal experiments.
RTX 5090D (32GB)
The GPU I’m currently using. The 32GB VRAM provides more headroom for adjustments:
- For some control task configurations, you can try larger batch sizes (32 or even higher, though actual limits depend on batch_length, encoder scale, etc.)
- You can try longer imagination (25-30 steps)
- Pixel input tasks (Atari) run comfortably
- 32GB VRAM has some surplus for DreamerV3, allowing other experiments
However, RTX 5090D is relatively expensive. If you’re buying a GPU specifically for DreamerV3, the RTX 4090 offers better value.
Professional GPUs
A100 (40GB/80GB) / H100 (80GB)
Professional GPU advantages:
- Large VRAM (40GB/80GB) allows running larger-scale experiments
- Higher memory bandwidth (helpful for large batch training)
- ECC memory support (more stable for long training runs)
But the price is much higher. For individual researchers running default DreamerV3 experiments, the cost-effectiveness is limited. However, in institutional/team cluster environments, they still have value—multi-task concurrency, long-term stable operation (ECC memory), large batch experiments, and cluster scheduling advantages become apparent.
Unless you need to:
- Run large-scale experiments across multiple seeds
- Train very large models (e.g., modified DreamerV3-large)
- Run multi-task parallel training
Otherwise, A100/H100 isn’t very cost-effective for DreamerV3.
Cloud GPUs
AutoDL / Other Cloud GPU Platforms
If you don’t want to buy a GPU, or need to occasionally run large experiments, cloud GPUs are a good choice.
Taking AutoDL as an example (prices vary by platform, time slot, and whether you use spot instances, the following are for reference only):
- RTX 5090D: approximately $0.35-0.42/GPU hour
- A100 80GB: approximately $0.55-0.85/GPU hour
- Pay per use, no cost when not in use
Cost Comparison
Assuming 18 hours of training per day, estimating RTX 5090D at approximately $0.35/GPU hour (actual prices please refer to the platform):
- Daily cost: approximately $6.30
- Monthly cost: approximately $189
- Yearly cost: approximately $2,240
If you buy an RTX 5090D yourself (approximately $2,200-2,800):
- One-time investment: approximately $2,500
- Electricity (at 300W, $0.08/kWh): approximately $0.58/day
- About 12-15 months to break even (compared to cloud GPU)
Note: Cloud GPU cost estimates don’t include cloud storage, data storage, and long-term instance fees—actual spending may be higher.
In high-utilization continuous training scenarios (e.g., 18 hours per day), purchasing a physical GPU may approach cloud GPU total costs in about a year; but in low-utilization situations (debugging periods, nighttime runs, occasional downtime), cloud GPUs are usually more cost-effective.
3. VRAM Optimization Strategies Recap
If your GPU VRAM isn’t enough, besides adjusting configurations, here are some strategies:
Gradient Checkpointing
Use @jax.remat to mark compute-intensive functions, trading compute for VRAM:
@jax.remat
def expensive_function(x):
# ...
Adds about 20-30% training time, but significantly reduces VRAM usage.
Mixed Precision (Use with Caution)
Only use bfloat16 for encoder/decoder:
from jax import config
config.update("jax_default_matmul_precision", "bfloat16")
Note this is not equivalent to PyTorch AMP—it only affects matmul internal precision. RSSM internal computation is recommended to stay in float32.
Reducing Batch-Related Parameters
The most direct approach:
batch_size: 8 # reduce from 16 to 8
batch_length: 256 # reduce from 512 to 256
imag_length: 10 # reduce from 15 to 10
But be aware: too small a batch_size affects gradient estimation stability, and too short an imag_length affects long-term credit assignment.
4. Practical Considerations for Multi-GPU Training
DreamerV3’s Multi-GPU Status
DreamerV3’s official JAX implementation’s default configuration primarily targets a single accelerator. While JAX itself supports jax.pmap, jax.shard_map, PJRT and other parallelism mechanisms, the official code doesn’t provide out-of-the-box multi-GPU configurations.
More Practical Approach
For most researchers, data parallelism is more practical than model parallelism:
- Run different experiments on different GPUs (different hyperparameters or seeds)
- Each GPU trains independently, no interference
- No code rewriting needed
For example, if you have 4 RTX 4090s:
- GPU 1: seed 42, default configuration
- GPU 2: seed 123, default configuration
- GPU 3: seed 456, default configuration
- GPU 4: hyperparameter tuning experiment
This way you can run 3 seed experiments for formal results + 1 tuning experiment simultaneously, much more efficient than a single GPU.
When Multi-GPU Parallelism is Needed
Only these situations warrant considering model parallelism:
- Model is too large to fit on a single GPU (DreamerV3 default configuration usually doesn’t have this problem)
- Need extremely large batch sizes (e.g., batch_size=256)
- Doing large-scale distributed training research
5. Don’t Ignore Hardware Beyond the GPU
DreamerV3 isn’t purely a GPU task. Replay buffer data loading, environment simulation, and data preprocessing all depend on CPU and memory. If the CPU is too weak or memory insufficient, the GPU may not be fully utilized, reducing training efficiency.
CPU
Environment parallelism and data collection can become CPU bottlenecks, depending on the environment implementation—vector env parallelization approach (multiprocessing/threading), simulator backend, and data loading pipeline all affect CPU requirements. Insufficient core count will directly slow down training.
- Minimum: 8 cores (can run, but environment simulation may become a bottleneck)
- Recommended: 12-16 cores (balanced training efficiency)
- If you’re running multiple environment instances simultaneously (e.g., multi-seed parallel), you’ll need more cores
Memory (RAM)
The replay buffer is stored in CPU memory. Taking replay_size=5e6 as an example, storing pixel image trajectories may occupy 20-40 GB of memory—but image size and storage format have a huge impact on usage: 84×84 uint8 vs 128×128 RGB float32 differ by orders of magnitude.
- Minimum: 32 GB (can run, but replay buffer size is limited)
- Recommended: 64 GB (replay buffer can be larger, multi-task parallelism is also more comfortable)
Storage (SSD)
Dreamer experiments frequently generate large amounts of files: checkpoints, video recordings, TensorBoard logs, replay dumps, etc.
- Recommended: At least 1 TB NVMe SSD
- Mechanical hard drives will seriously affect checkpoint saving and log writing speed
- If you frequently save checkpoints, SSD random write performance also affects experiment efficiency
- If running Atari and saving training videos, space consumption is especially fast
A Typical Balanced Configuration
Using RTX 4090 as an example, a relatively balanced host configuration:
| Component | Recommendation |
|---|---|
| CPU | 12-16 cores (e.g., AMD Ryzen 9 or Intel i7/i9) |
| Memory | 64 GB DDR5 |
| SSD | 1 TB NVMe |
| GPU | RTX 4090 24GB |
| PSU | 850W+ |
Some people have bought high-end GPUs but paired them with office-grade CPUs and 16GB of memory, resulting in poor training efficiency—the bottleneck isn’t the GPU, but the CPU and memory.
6. Specific Recommendations
Limited Budget (< $1,100)
Recommended: Used RTX 3090 (24GB)
- Used price approximately $700-950 (varies by market and channel)
- 24GB VRAM is sufficient for DreamerV3 default configurations
- Performance adequate for learning and research
- Downside: high power consumption (350W), needs good cooling
Value Priority ($1,600-2,200)
Recommended: RTX 4090 (24GB)
- New card price approximately $1,800-2,200 (varies by region and channel)
- Strong TF32 performance, fast training speed
- 24GB VRAM sufficient for most experiments
- Relatively low power consumption (320W)
- Currently the most cost-effective choice for running DreamerV3
Sufficient Budget ($2,200-2,800)
Recommended: RTX 5090D (32GB)
- Price approximately $2,200-2,800 (varies by region and channel)
- 32GB VRAM provides more adjustment headroom
- Can run larger batches, longer imagination
- Suitable for researchers who need to frequently tune parameters
Occasional Use / Don’t Want to Buy a GPU
Recommended: AutoDL Cloud GPU
- RTX 5090D: approximately $0.36/GPU hour
- Pay per use, no cost when not needed
- Suitable for students or researchers who occasionally run experiments
- Less cost-effective in the long run compared to buying a GPU
Not Recommended
12GB VRAM GPUs
Such as RTX 4070 (12GB). While they can run DreamerV3, batch limitations are obvious and there’s insufficient room for parameter tuning. You’ll spend a lot of time figuring out “how to fit the configuration into VRAM” rather than focusing on experiments and algorithms. For DreamerV3 training, 12GB is an awkward capacity.
Consumer Low-VRAM Flagships
Some GPUs have strong compute performance but limited VRAM (such as certain 16GB or even 12GB high-end cards). In DreamerV3 training, VRAM capacity is usually more important than peak compute power—insufficient VRAM directly limits what configurations you can run, while insufficient compute just makes training slower. For users whose primary goal is training world models, it’s not recommended to prioritize low-VRAM variants—when choosing a GPU, prioritize VRAM capacity first, then compute performance.
Compatibility Reminder Before Purchase
If you’re considering buying the latest architecture GPU (such as RTX 50 series), it’s recommended to first confirm JAX/jaxlib/CUDA support status. In the early period after a new GPU launches, there may be issues like CUDA driver support lag, jaxlib wheel mismatches, etc. Before buying, check the JAX installation guide to see if your target GPU architecture is supported. It’s worth noting that in the early period after a new GPU launches, PyTorch typically adapts faster than the JAX ecosystem—if you also use PyTorch, you can monitor support progress on both sides.
GPU Selection Decision Tree
If you’re still unsure what to buy, you can refer to this simple decision flow:
You want to train DreamerV3?
│
▼
Long-term high-frequency training?
│
┌────┴────┐
│ │
No Yes
│ │
Cloud Buy GPU
GPU │
▼
Sufficient budget?
│
┌────┴────┐
│ │
No Yes
│ │
RTX 4090 RTX 5090D
(24GB) (32GB)
│ │
▼ ▼
Most experiments Larger batch
default configs Longer imagination
Core logic: First decide between buying a GPU or cloud GPU, then choose VRAM size based on budget. For DreamerV3, the first priority when choosing a GPU is VRAM, second is compute power.
7. Connecting the Series
World Model Intro → RSSM Deep Dive → RSSM Code Series (6 posts)
↓
Dreamer Series #1: Overall Architecture
↓
Dreamer Series #2: Actor-Critic
↓
Dreamer Series #3: Training Tips
↓
Dreamer Series #4: GPU Selection (this post)
GPU selection is the hardware foundation for DreamerV3 training. Choose the right GPU, combined with the engineering experience from the previous training tips article, and your experiments will run smoothly and efficiently.
If you haven’t read the previous articles, I recommend starting with Dreamer Overall Architecture, Actor-Critic Explained, and Training Tips before reading this GPU selection guide—you’ll get more out of it.
8. Summary
DreamerV3 GPU selection can be summarized as:
- 24GB VRAM is a comfortable starting point for most default configurations: RTX 3090/4090 are the most cost-effective choices
- 32GB VRAM provides headroom: RTX 5090D suits researchers who need to frequently tune parameters
- Cloud GPUs are flexible but expensive long-term: suitable for occasional use or those who don’t want to buy a GPU
- Multi-GPU data parallelism is more practical: run different experiments on different cards, simpler than model parallelism
- Don’t ignore hardware beyond the GPU: CPU 12-16 cores, 64GB RAM, 1TB NVMe SSD is a balanced configuration
Choosing a GPU is essentially a trade-off between budget and requirements. If your main goal is learning and researching DreamerV3, an RTX 4090 is sufficient. If you need to run large-scale experiments or multi-seed comparisons, then consider higher-end cards or cloud GPUs.
Hope this guide helps you make a reasonable GPU selection. If you have specific hardware questions, feel free to discuss in the comments.
Comments