xiaohongshu
xiaohongshu
gpu-aware-training-config
GPU-aware PPO training configuration for A100/H100. Trigger when training is slow or GPU utilization is low.
Full skill instructions
| Item | Details |
|---|---|
| Date | 2025-12-18 |
| Goal | Fix extremely slow A100 training (FPS 4,500 vs expected 30,000-50,000) |
| Environment | Google Colab A100, PyTorch 2.x, CUDA |
| Status | Success - 10x+ speedup achieved |
Training was extremely slow on A100 Colab GPU despite using "quick_test" mode. Investigation revealed that get_auto_config(training_mode="quick_test") was returning a generic config with n_envs=256 and torch.compile=False, completely ignoring GPU capabilities.
The original get_auto_config() function had training modes that completely bypassed GPU detection:
# WRONG - ignores GPU capabilities
def get_auto_config(total_timesteps, training_mode="auto"):
if training_mode == "quick_test":
return NativePPOConfig(
n_envs=256, # Too low for A100!
compile_policy=False, # Missing 3-6x speedup!
# ... generic settings
)
Training modes must layer on top of GPU-specific settings, not replace them:
def get_auto_config(total_timesteps=1_000_000, training_mode="auto"):
# Step 1: ALWAYS detect GPU first
gpu_tier = _detect_gpu_tier() # "h100", "a100", "high", "medium", "low"
# Step 2: Get GPU-appropriate base config
if gpu_tier == "h100":
config = _get_h100_base_config()
elif gpu_tier == "a100":
config = _get_a100_base_config()
# ... etc
# Step 3: Apply training mode ADJUSTMENTS (not replacements)
if training_mode == "quick_test":
config.total_timesteps = 10_000_000
config.validation_interval = 25
# BUT KEEP GPU-specific n_envs, compile_policy, etc!
| GPU Tier | n_envs | n_steps | minibatch | compile | FP8 | Expected FPS |
|---|---|---|---|---|---|---|
| H100-80GB | 2048 | 512 | 8192 | True | True | 80,000-120,000 |
| A100-80GB | 2048 | 512 | 8192 | True | False | 50,000-80,000 |
| A100-40GB | 1024 | 512 | 4096 | True | False | 40,000-60,000 |
| RTX 4090 | 1024 | 512 | 4096 | True | False | 30,000-50,000 |
| RTX 3090 | 512 | 512 | 2048 | True | False | 20,000-35,000 |
| Generic | 256 | 512 | 2048 | False | False | 5,000-15,000 |
Training modes should ONLY adjust these parameters:
| Mode | timesteps | n_epochs | validation_interval | Notes |
|---|---|---|---|---|
| quick_test | 10M | 10 | 25 | Fast iteration |
| standard | 50M | 12 | 50 | Development |
| production | 200M | 15 | 100 | Full training |
| extended | 500M | 20 | 200 | Maximum learning |
def _detect_gpu_tier() -> str:
"""Detect GPU tier for optimal configuration."""
if not torch.cuda.is_available():
return "cpu"
gpu_name = torch.cuda.get_device_name(0).lower()
vram_gb = torch.cuda.get_device_properties(0).total_memory / 1e9
# Check for H100 (compute capability 9.0+)
compute_cap = torch.cuda.get_device_capability(0)
if compute_cap[0] >= 9:
return "h100"
# Check for A100
if "a100" in gpu_name:
return "a100"
# Tier by VRAM
if vram_gb >= 40:
return "high"
elif vram_gb >= 20:
return "medium"
else:
return "low"
| Attempt | Why it Failed | Lesson Learned |
|---|---|---|
| Training mode completely replaces config | Lost GPU-specific optimizations | Modes should layer adjustments, not replace |
| n_envs=256 on A100 | Only 5-12% GPU utilization | Need 1000+ envs for GPU saturation |
| compile_policy=False in quick_test | Missing 3-6x speedup | Always enable torch.compile on modern GPUs |
| Fixed config for all GPUs | Wasted resources or OOM errors | Detect GPU and scale accordingly |
| Checking GPU only in "auto" mode | quick_test/standard modes got generic config | ALWAYS detect GPU, regardless of mode |
If training is slow, check these in order:
If you see slow training on A100, the config should show:
n_envs: 1024+
torch.compile: True
compile_mode: reduce-overhead
If any of these are wrong, the get_auto_config() function isn't detecting the GPU properly.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience