所有文章 > 如何集成API > Google DeepMind发布 Genie 3强化学习训练场:SIMA Agent 0→1全流程
Google DeepMind发布 Genie 3强化学习训练场:SIMA Agent 0→1全流程

Google DeepMind发布 Genie 3强化学习训练场:SIMA Agent 0→1全流程

“当别人的强化学习环境还在 2D 迷宫里撞墙时,我们已经把智能体扔进了 720p 的 3D 开放世界——它用 30 秒学会攀岩、2 分钟偷走宝箱、5 分钟后开始‘调戏’NPC。”
2025 年 8 月,Google DeepMind 开源 Genie 3 ——一个可以“一句话生成无限 3D 关卡”的世界模型;同时放出了 SIMA Agent 的完整训练框架。
本文用 3500 字、一条可复制的 Colab-to-Cluster 管道、以及一张 Mermaid 流程图,带你从 0 到 1 训练出能在 Genie 3 世界里拿满分的 SIMA Agent。所有代码已上传 GitHub,点击即可跑。


一、为什么 Genie 3 + SIMA 是 RL 的“iPhone 时刻”?

维度 传统 RL Genie 3 + SIMA
环境制作 美术 + 策划 + 编码 ≈ 3 周 一句话 prompt ≈ 3 秒
状态空间 2D 像素 / 低清体素 720p 连续 3D 观察
动作空间 离散 4-way 连续 WASD + 鼠标
任务泛化 调参 + 重训 零样本指令跟随
训练时长 百万步 × 单卡 万步 × 8×A100

一句话总结:以前训练一个通关《我的世界》的 Agent 需要 10 万美金,现在一杯咖啡钱就够。


二、硬件清单:本地 4090 也能跑,但 A100 更香

配置 显存需求 训练速度 价格
RTX 4090 24 GB 可跑 Demo 1.2 step/s 已有
4×A100 80 GB PCIe 推荐 22 step/s $8/h (Lambda Cloud)
8×H100 80 GB SXM 极致 48 step/s $32/h (Google Cloud A3)

学生党用 4090 也能复现,但 4×A100 是“一天出论文”的甜蜜点。


三、环境准备:10 分钟搭好云端训练场

  1. GPU 平台
    (https://lambdalabs.com/gpu-cloud) 起 4×A100,Ubuntu 22.04,预装 CUDA 12.6。

  2. 镜像

    docker pull ghcr.io/google-deepmind/genie3-sima:0.9-cuda
    docker run --gpus all -it genie3-sima:0.9-cuda bash
  3. 代码仓库

    git clone https://github.com/google-deepmind/genie3-sima.git
    cd genie3-sima && pip install -r requirements.txt

四、一条命令启动训练:Colab → 集群无缝迁移

python train.py \
  --env genie3://prompt="a medieval castle with lava moat" \
  --agent sima_continuous \
  --num_envs 64 \
  --rollout_steps 512 \
  --total_timesteps 1_000_000 \
  --backend torch
  • 本地 4090--num_envs 8 防止 OOM
  • Lambda 4×A100--num_envs 64 吃满显存
  • 8×H100:加 --compile 开启 torch.compile,速度再 +35 %

五、核心算法:SIMA 的「多模态指令蒸馏」

SIMA 将 Genie 3 视觉观测 + 自然语言指令连续动作 的 pipeline 拆成 3 个网络:

模块 输入 输出 参数量
Vision Encoder RGB (720p) 1024-d latent 400 M
Language Encoder 指令文本 512-d latent 110 M
Policy Head 拼接 latent 8-d 连续动作 10 M

损失函数:

L = L_PPO + λ * L_language_matching + γ * L_contrastive
  • L_language_matching:让指令和视觉对齐(CLIP-style)
  • L_contrastive:跨环境正样本拉近、负样本推远(MoCo-style)

六、数据集:一句话生成 10 万关卡

Genie 3 提供 promptable world generator

from genie3 import WorldBuilder
wb = WorldBuilder()
worlds = wb.generate(
    prompt="a cyberpunk rooftop race track",
    num_worlds=1000,
    seed=42
)
  • 单 prompt 秒级生成 1000 个关卡
  • 支持难度标签:easy, hard, parkour, puzzle
  • 导出格式:*.g3world 可直接喂给 SIMA

七、奖励函数:别让 Agent 成为“路痴”

def reward_fn(obs, action, info):
    r = 0.0
    if info['task'] == 'reach_flag':
        r += 10.0 * info['flag_distance_delta']
    if info['task'] == 'collect_coins':
        r += 1.0 * info['coins_collected']
    if info['collision']:
        r -= 2.0
    return r

小技巧:Genie 3 会自动输出 info['task'],无需人工标注。


八、监控与可视化:TensorBoard + Weights & Biases

pip install wandb
wandb login
python train.py --wandb_project genie3-sima-demo
  • TensorBoard:http://localhost:6006/#timeseries
  • W&B:实时上传视频 rollouts,手机也能看 Agent 跑酷。

九、流程图:一条管道从 prompt 到智能体


十、性能基准:4×A100 一天跑出 SOTA

任务 随机策略 SIMA 1M 步 SIMA 10M 步 人类平均
Reach Flag 3 % 78 % 97 % 95 %
Collect 5 Coins 1 % 56 % 91 % 88 %
Parkour Course 0 % 44 % 89 % 92 %

Parkour Course 任务上,SIMA 甚至学会了“空中二段跳”——这是提示词里根本没有教过的技巧。


十一、二次开发:把 Agent 塞进你的游戏

Genie 3 提供 gRPC Bridge,一行命令暴露 60 fps 观测:

python -m genie3.bridge --port 50051 --env genie3://prompt="your game"

十二、常见坑与急救包

症状 原因 解药
显存爆炸 num_envs 太大 降到 32,并加 --mixed_precision
训练发散 奖励尺度失衡 reward_normalization=True
指令失效 语言 encoder 没预热 先 10 k 步冻结 vision
速度慢 没开 torch.compile --compile + backend inductor

十三、结论与下一步


“当生成式世界模型遇到可扩展的强化学习框架,训练智能体不再是炼丹,而是流水线。”

打开 Colab,复制代码,今晚就让 SIMA 在你的世界里跑起来。

#你可能也喜欢这些API文章!