Pi And Indooruav

5 minute read

Published:

2026-02-05 Report


〇、Denoising Diffusion Probabilistic Models, NeurIPS 2020

1

因为 \(\pi_{0}\) 的核心是 Flow matching,而 Flow matching 被视为 Diffusion 的一种变体,故首先阅读了这篇发表于 NeurIPS 2020 的经典工作 DDPM。

DDPM 最初被提出用于图像生成(Image Generation)任务,其基本思想是:从一张原始的高质量图像 \(x_{0}\) 出发,通过 \(T\) 步逐步加入高斯噪声,可以得到一张完全不可辨识的噪声图像 \(x_{T}\)。这一正向加噪过程被建模为一个 Markov 过程,因为每一步状态 \(x_{t}\) 显然仅依赖于前一状态 \(x_{t-1}\)。

基于这一过程,若希望生成一张新的 RGB 图像,理论上可以从 \(x_{T}\) 出发,逐步执行 \(T\) 步反向去噪过程,最终得到一张符合真实图像分布的样本,即在 \(H\times W\times3\)​ 的高维空间中采样一个合理的分布。然而,直接进行无约束的去噪会导致生成结果仍接近随机噪声,因此需要对反向过程进行建模与约束。与正向加噪类似,反向去噪过程同样被假设为 Markov 过程,其关键点在于 \(q(x_{t-1}|x_{t}) = q(x_{t-1}|x_{t}, x_{0})\) 即在已知原始样本 \(x_{0}\) 的情况下,\(x_{t-1}\) 与更早的状态条件独立。因此, \(x_{0}\) 可被引入作为一种监督信号,用于指导去噪方向。进一步有 \(q(x_{t-1}|x_t,x_0)=\frac{q(x_{t-1},x_t,x_0)}{q(x_t,x_0)}=\frac{q(x_t\mid x_{t-1})q(x_{t-1}\mid x_0)q(x_0)}{q(x_t\mid x_0)q(x_0)}=\frac{q(x_t\mid x_{t-1})q(x_{t-1}\mid x_0)}{q(x_t\mid x_0)}\) 即在给定 \(x_{0}\) 和 \(x_{t}\) 的前提下,上式中的各项均可解析计算,因此可以确定性地推导出每一步反向去噪的条件分布(如均值和方差)。

然而,在实际生成阶段 \(x_0\) 是不可知的。因此,DDPM 的学习问题被转化为:训练一个模型 \(p_\theta(x_{t-1}\|x_t)\),使其在缺失 \(x_0\) 的信息下,通过在每一步注入噪声 \(\epsilon\) 来尽可能地拟合这个由 \(x_0\) 指导的理想后验分布 \(q(x_{t-1}\|x_t, x_0)\)。这一思想被用于 Flow matching 中。


一、\(\pi_{0}\): A Vision-Language-Action Flow Model for General Robot Control

2

(1)Motivation

\(\pi_{0}\) 旨在构建一种通用机器人模型,因为它认为人并不是专精于一项或几项类似任务的,所以机器人也应当具备一定的任务通用性。

上图是对 \(\pi_{0}\) 的 overview:

  • 首先它作为一个 VLA 模型,由 VLM 和 action expert 构成
    • VLM 经过互联网数据集的训练,具备理解 image-instruction pair 的能力
    • action expert 则通过 OXE Magic soup 和 \(\pi\) 公司自行采集的跨本体跨任务数据集进行预训练
  • 预训练结束后,模型对它见过的一些类似任务(in-distribution tasks)无需进行后训练(即微调),便具备 zero-shot 的能力
  • 基于高质量数据的后训练分为两类
    • 采用 small to moderate amounts of data(few-shot)进行微调,即可实现 unseen tasks 的泛化
    • 采用 larger datasets 进行微调,即可完成 difficult tasks
(2)Training & Reference

首先,训练数据是形如(\(\mathbf{o}_{t},\mathbf{A}_{t}\))的状态-动作对,其中:

  • \(\mathbf{o}_{t}=[\mathbf{I}_{t}^{1},…,\mathbf{I}_{t}^{n},\ell_{t},\mathbf{q}_{t}]\) 表示在 \(t\) 时刻的状态:
    • \(\mathbf{I}_{t}^{i}\) 表示环境图像输入(\(i\in [1,n]\), \(n\) 取决于部署的摄像头数量)、
    • \(\ell_{t}\) 表示输入的指令
    • \(\mathbf{q}_{t}\) 表示此时本体的状态,本文中指各关节、夹爪状态(在无人机任务中可替换为位姿信息、舵机转速等)
  • \(\mathbf{A}_{t}=[\mathbf{a}_{t},\mathbf{a}_{t+1},…,\mathbf{a}_{t+H-1}]\) 表示在 \(t\) 时刻对后 \(H\) 个时刻动作序列的预测
    • 本文中 \(H=50\)

在输入以上的训练数据后,模型对 flow matching 步 \(\tau \in [0,1]\) 和噪声 \(\epsilon \sim \mathcal{N}(\mathbf{0},\mathbf{I})\) 进行随机采样,构造带噪声的动作 \(\mathbf{A}_{t}^{\tau}=\tau\mathbf{A}_{t}+(1-\tau)\epsilon\)

# vla_scratch.policies.utils.diffusion
def sample_noise(shape, device, dtype):
    return torch.normal(
        mean=0.0,
        std=1.0,
        size=shape,
        dtype=dtype,
        device=device,
    )

# vla_scratch.policies.pi.policy
def compute_loss():
    ……
    actions = data_sample.action_chunk.actions
    selected_noise = sample_noise(
        actions.shape, actions.device, actions.dtype
    )
    u_t = selected_noise - actions
    timestep = sample_clamped_time(self.time_dist, data_sample.shape)
    noisy_actions = actions + timestep[:, None, None] * u_t
    torch.cuda.nvtx.range_pop()
    ……      

[!NOTE]

代码中构造带噪声的动作方式与原文略有出入,但意义是一样的,本报告以论文为主。

此处为 \(\mathbf{A}_{t}^{\tau}=\mathbf{A}_{t}+\tau(\epsilon-\mathbf{A}_{t})=(1-\tau)\mathbf{A}_{t}+\tau\epsilon\)。

在此框架下,构造的 \(\mathbf{A}_{t}^{\tau}\) 可类比为 Diffusion Model 中的噪声状态 \(x_{t}\),而 \(\mathbf{A}_{t}\) 则对应于原始分布中的样本 \(x_{0}\),所以模型的核心任务是学习从 \(\mathbf{A}_{t}^{\tau}\) 到 \(\mathbf{A}_{t}\) 的去噪映射;类似地,Diffusion Model 将确定的后验分布 \(q(x_{t-1}\|x_t, x_0)\) 作为拟合目标,Flow Matching 通过计算路径方程 \(\mathbf{A}_{t}^{\tau}-\mathbf{A}_{t}=(1-\tau)(\mathbf{A}_{t}-\epsilon)\) ,剔除尺度因子,仅提取其中的去噪方向,将条件向量场简化定义为 \(\mathbf{u}(\mathbf{A}_{t}^{\tau}\|\mathbf{A}_{t})=\mathbf{A}_{t}-\epsilon\) 作为网络的输出 \(\mathbf{v}_{\theta}(\mathbf{A}_{t}^{\tau},\mathbf{o}_{t})\) 的学习参考。

[!NOTE]

这里关于把 \((1-\tau)\) 丢掉有以下疑问:

既然不学习当前的含噪比,这个构造方式是不是扩充数据量的一种方式?

如果学习了 \(\tau\) 的相关信息,是否可以实现推理起始阶段步长大,推理结束阶段步长小,也就是逐步调小学习率的感觉?

基于以上分析,loss 方程被构建为 \(L^\tau(\theta)=\mathbb{E}_{p(\mathbf{A}_t|\mathbf{o}_t),q(\mathbf{A}_t^\tau|\mathbf{A}_t)}||\mathbf{v}_\theta(\mathbf{A}_t^\tau,\mathbf{o}_t)-\mathbf{u}(\mathbf{A}_t^\tau|\mathbf{A}_t)||^2\)

# vla_scratch.policies.pi.policy
def compute_loss():
    ……
    flow_mse = torch.nn.functional.mse_loss(
        u_t.to(v_t.dtype), v_t, reduction="none"
    ).mean()
    log_dict_suffix["loss/flow_mse"] = flow_mse.detach()

    loss = flow_mse + self.config.ce_loss_weight * ce_loss
    ……
    return loss, log_dict

对于推理部分,先在 \(t\) 时刻初始化一个随机动作序列,也就是噪声 \(\mathbf{A}_{t}^{0}=\epsilon\),随后根据欧拉积分准则,根据模型学到的梯度方向 \(\mathbf{v}_{\theta}(\mathbf{A}_{t}^{0},\mathbf{o}_{t})\),取步长 \(\delta\) 计算得第一步去噪结果 \(\mathbf{A}_{t}^{\delta}=\mathbf{A}_{t}^{0}+\delta\mathbf{v}_{\theta}(\mathbf{A}_{t}^{0},\mathbf{o}_{t})\),重复此步骤直到计算得 \(\mathbf{A_{t}^{1}}=\mathbf{A}_{t}\),即可执行的动作序列,也就是完成了 \(t\) 时刻的 flow matching 操作。

以上步骤可被归纳为 \(\mathbf{A}_{t}^{\tau+\delta}=\mathbf{A}_{t}^{\tau}+\delta\mathbf{v}_{\theta}(\mathbf{A}_{t}^{\tau},\mathbf{o}_{t})\) 本文中 \(\delta=0.1\),也就是会进行 10 步去噪,对该参数的选取有以下思考:

  • 由于欧拉积分准则是基于一阶泰勒展开提出的,所以其阶段误差是 \(O(\delta^{2})\),这也就意味着较大的 \(\delta\) 会带来较大的误差;
  • 同时,如果 \(\delta\) 较小,就会导致去噪步数 \(\frac{1}{\delta}\) 过大,提升计算负担。
# vla_scratch.policies.pi.policy
def sample_actions(
        self, observation: "Observation", num_steps=10
    ) -> at.Float[torch.Tensor, " batch_size action_horizon action_dim"]:  # noqa: F722
        """Do a full inference forward and compute the action (batch_size x num_steps x num_motors)"""
        torch.cuda.nvtx.range_push("VLM Encode Prefix")
        _, vlm_output, log_dict = self.encode_prefix(observation)
        suffix_input = self.construct_suffix_input(vlm_output)
        torch.cuda.nvtx.range_pop()

        bsize = observation.shape[0]
        device = observation.device
        dtype = observation.state.dtype

        actions_shape = (
            bsize,
            self.config.action_horizon,
            self.config.action_dim,
        )
        
        # 初始化噪声动作
        noise = sample_noise(actions_shape, device, dtype)
		
        # 根据 num_steps 计算 dt
        dt_float = 1.0 / num_steps
        time_float = 1.0
        dt = torch.tensor(dt_float, dtype=dtype, device=device)
        time = torch.tensor(time_float, dtype=dtype, device=device)

        # 去噪
        x_t = noise
        while time_float >= dt_float / 2:
            torch.cuda.nvtx.range_push("Predict Suffix in Sampling")
            _, v_t, _ = self.predict_suffix(
                observation.state,
                suffix_input=suffix_input,
                noisy_actions=x_t,
                time=time.expand(bsize),
            )

            x_t = x_t - dt * v_t
            time -= dt
            time_float -= dt_float
            torch.cuda.nvtx.range_pop()
        return x_t
(3)Evaluation

3

  • \(\pi_{0}\):VLM + 700k steps,即完整的,充分训练的模型
  • \(\pi_{0}\) (parity):VLM + 160k steps,保持与 baseline 相同训练步数
  • \(\pi_{0}\)-small:without VLM

可得出以下结论:

  • 在与 baseline 保持相同训练步数的情况下,\(\pi_{0}\) 表现更优
  • 在各种构型的机器人上,\(\pi_{0}\) 都有良好的性能,不像 OpenVLA 只在 UR5e 上能有一些些提升
  • 采用互联网数据集预训练后的 VLM 是有必要的
  • 充分训练的 \(\pi_{0}\) 效果很好

4

  • flat:task description
  • Human:intermediate step commands from an expert human user
  • HL:high-level commands provided by a high-level VLM

可得出以下结论:

  • 采用互联网数据集预训练后的 VLM 是有必要的,明显提升了指令的遵从能力
  • task description 属于携带高级语义的指令,指导机器人的动作效果不如人类或 VLM 提供的指令有效
  • 关于 Human 和 HL,我认为为了提高机器人的自主性,理应是采用 HL 的,但现在 HL 的效果并不好,相关改进在 \(\pi_{0.5}\) 中实现

5

  • fine-tuned:pre-training + fine-tuning
  • scratch:only fine-tuning
  • out-of-box:only pre-training

可得出以下结论:

  • 在任何情况下,fine-tuned 的效果基本上是最好的,因为大规模的预训练数据让机器人学会如何从错误中恢复,小规模的微调是让机器人高效、正确地执行特定任务
  • 在未知环境中,只经过预训练的模型表现得分几乎为 0,这表明了其在未知环境下的泛化能力极差,这点也成为了 \(\pi_{0.5}\) 的 motivation。

6

可得出以下结论:

  • 经过预训练的 \(\pi_{0}\) 在处理与预训练数据分布一致的后训练任务时,性能提升尤为明显。

二、IndoorUAV: Benchmarking Vision-Language UAV Navigation in Continuous Indoor Environments, AAAI 2025

(1)Motivation

现有的工作无法应用在室内无人机任务上,因为

  • 室内地面智能体:局限于二维空间,无法利用三维空间的信息进行推理
  • 室外无人机:环境过于开阔,无精细动作,不适用于室内这种多障碍、需要高机动的环境要求

于是提出构建 IndoorUAV,覆盖 high-level instruction grounding 和 low-level aerial control 两部分。

(2)Data collecting

7

  • 首先,从 MP3D、Gibson、HM3D、Replica 这四个 3D 室内环境数据集中采出 1075 个高质量场景,并在 Habitat simulator 中渲染

  • 然后去除环境中的网格,构建 4 自由度的无人机动作空间;选取起、终点后人为操控生成飞行轨迹,并采用轨迹反转和子轨迹重组的方式实现数据增强;随后采用不同的策略分别生成 VLN-Part 和 VLA-Part

    • VLN-Part:提取关键帧并为每帧按一定的规则生成描述,然后合并生成 base、pro 两版完整指令作为 VLN Instructions,与环境信息和位姿信息一同作为 VLN-Part
    scene_group_id/       # e.g. replica, gibson_1, hm3d_15.
    └──scene_id/          # e.g. Adrian, 226REUyJh2K.
        └──traj_id/       # Trajectory collected from the scene; the traj_-* is the inverse edtion of the corresponding traj_*.
            ├── screenshots/              # The 720P, 10FPS camera view in the trajectory.
            └── saved_transformations/    # The raw posture matrix obtained from habitat-sim. 
            ├── posture.txt               # The formatted posture information, equivalent to saved_transformations.
            ├── real_action.json          # The actual movement type and displacement magnitude per frame.
            ├── annotation.json           # Frame numbers annotated with standard action labels.
            ├── key_frames.json           # Key frame numbers and their corresponding descriptive captions.
            ├── instruction.json          # Simplified edition of the natural language instruction.
            └── instruction_pro.json      # Detailed edition of the natural language instruction.
    
    • VLA-Part:将轨迹拆成仅包含 1-3 个动作的子轨迹,为每个子轨迹生成描述,作为 VLA Instructions,与起止帧一同作为 VLA-Part
    scene_group_id/       
    └──scene_id/          
        └──traj_id/       
            └── vla_ins_*.json           # VLA instruction and the start & end frame in the corresponding VLN trajctory.
    
(3)Model architecture

8

  • 对于 VLN 任务来说,其指令过长,在执行过程中很容易产生累积误差,所以需要解构成 VLA 任务;为了保证 VLN 任务本身的连续性,在执行 Task i 时,需要将 Task i-1 的最后一帧作为起始帧输入
  • 对于 VLA 任务来说,其完美适配 \(\pi_{0}\) 的模型结构,故采用在 IndoorUAV 上微调的 \(\pi_{0}\)
(4)Evaluation

9

  • baseline:
    • VLN Model:\(a_t=\mathrm{Model}_{\mathrm{VLN}}(\mathcal{O}_{1:t},\mathcal{I})\),根据 \(t\) 时刻的指令和 \(t\) 时刻之前的所有观测结果推理 \(t\) 时刻的实时动作
    • VLA Model:\(S_{t+1:t+h+1}=\mathrm{Model}_{\mathrm{VLA}}(\mathcal{O}_1,\mathcal{O}_t,\mathcal{I},s_t)\),根据 \(t\) 时刻的指令、位姿、观测结构和动作开始时刻的观测结果推理未来 \(h\) 个时刻的动作序列
  • Easy:1 action type
  • Medium:2 action types
  • Hard:3 action types
  • Success Rate (SR):成功率,论文中设定成功标准,只关心定性结果
  • Normalized Dynamic Time Warping (NDTW):轨迹对齐度,主要关心过程
  • Navigation Error (NE):最终位置与预期位置的距离,只关心定量结果
  • Oracle Success Rate (OSR):轨迹是否经过预期点,衡量稳定性

可得出以下结论:

  • IndoorUAV-Agent 基本上在各项指标上都达到 SOTA

三、\(\pi_{0.5}\): a Vision-Language-Action Model with Open-World Generalization

(1)Motivation

10

在 \(\pi_{0}\) 的论文中,我们可以看到仅经过预训练的模型在新环境中泛化能力很差,而 \(\pi_{0.5}\) 旨在提高这一泛化能力,它认为需通过以下三个途径实现:

  • some behaviors generalize readily if they are well represented in the data with a sufficient range of scenes and objects
  • others might require adapting or modifying existing skills to use them in a new way or in a new sequence
  • others might require understanding the semantics of the scene based on prior knowledge

这样的能力无法在先前 \(\pi_{0}\) 的数据设置上实现,于是 \(\pi_{0.5}\) 提出:

  • co-training:纳入了从 \(\pi_{\theta}(\hat{\ell}\|\mathbf{o}_{t},\ell)\) 的学习,同时解决了 \(\pi_{0}\) 中 HL 效果不佳的问题
  • hybrid multi-modal examples:一条数据包含各种模态的信息
(2)Model architecture

11

在 pre-training 阶段,输入各种模态的信息,输出离散的 action token \(\pi_\theta(\mathbf{a}_{t:t+H},\widehat{\ell}|\mathbf{o}_t,\ell)=\pi_\theta(\mathbf{a}_{t:t+H}\|\mathbf{o}_t,\widehat{\ell})\pi_\theta(\widehat{\ell}\|\mathbf{o}_t,\ell)\) 其中:

  • \(\pi_\theta(\widehat{\ell}\|\mathbf{o}_t,\ell)\) 表示 High-level semantic inference,即根据 \(t\) 时刻富含高级语义的任务描述和观测结果,生成低级的直接指令

  • \(\pi_\theta(\mathbf{a}_{t:t+H}\|\mathbf{o}_t,\widehat{\ell})\) 表示根据 \(t\) 时刻生成的直接指令和观测结果,生成包含未来 \(H\) 步的动作序列

在 post-training 阶段,相比 \(\pi_{0}\) 增加由高级语义的任务描述预测高级子任务,再生成低级指令的阶段。


四、Reference

Denoising Diffusion Probabilistic Models, NeurIPS 2020

Understanding Diffusion Models: A Unified Perspective

vla-scratch

report-slides