logo Mr.Robota 具身智能学习手册 中文
Chapter 12: 12 Interview Questions

1. You must be familiar with the principles and differences of algorithms such as DDPG, PPO, TD3, and SAC.

These four algorithms are the most commonly used reinforcement learning algorithms in continuous control (such as robot control).

PPO (Proximal Policy Optimization)

  • Principle: PPO is a on-policy policy gradient algorithm. It uses a clipping mechanism to limit the update steps of old and new policies, preventing policy updates from failing.

  • Core formula:

    LCLIP(θ)=E^t[min⁡(rt(θ)A^t,clip(rt(θ),1−ϵ,1+ϵ)A^t)]L^{CLIP}(\theta) = \hat{\mathbb{E}}_t \left[ \min(r_t(\theta)\hat{A}_t, \text{clip}(r_t(\theta), 1-\epsilon, 1+\epsilon)\hat{A}_t) \right]
  • Numerical calculation example:

Assume that at time step tt, the GAE calculates a dominance function A^t=10\hat{A}_t = 10 (positive, indicating this action is good).

Set the truncation hyperparameter ϵ=0.2\epsilon = 0.2.

If the new network is too aggressive, resulting in a probability ratio between old and new policies of rt(θ)=1.5r_t(\theta) = 1.5 (the probability of the new policy taking this action is 1.5 times that of the old policy):

  1. Original target: 1.5×10=151.5 \times 10 = 15

  2. Truncation target: clip(1.5,0.8,1.2)×10=1.2×10=12\text{clip}(1.5, 0.8, 1.2) \times 10 = 1.2 \times 10 = 12

  3. Take the minimum value: min⁡(15,12)=12\min(15, 12) = 12

**Conclusion**: Even if the network wants to be updated significantly to 15, PPO forces it to be truncated to 12, ensuring the stability of training.

DDPG (Deep Deterministic Policy Gradient)

  • Principle: An Actor-Critic algorithm with an off-policy policy. The Actor outputs deterministic actions, and the Critic evaluates Q-values.

  • Core formula (Updated by Critic):

    yi=ri+γQϕ′(si+1,μθ′(si+1))y_i = r_i + \gamma Q_{\phi'}(s_{i+1}, \mu_{\theta'}(s_{i+1}))
  • Numerical calculation example:

    Assume the robot takes a step forward and receives a reward ri=1.0r_i = 1.0. Discount factor γ=0.99\gamma = 0.99.

    The target network (Target Actor and Target Critic) predicts the optimal Q value for the next state as Qϕ′=100Q_{\phi'} = 100.

    Calculate the TD target value (Note 1): yi=1.0+0.99×100=100.0y_i = 1.0 + 0.99 \times 100 = 100.0.

If the Q value predicted by the current Critic network is 90, the Mean Squared Error (MSE) Loss will be (100.0−90)2=100(100.0 - 90)^2 = 100.

TD3 (Twin Delayed DDPG)

  • Principle: To address the issue of over-estimated Q values in DDPG, a dual Q network, delayed update, and target policy smoothing are introduced.

  • Core formula (truncated double Q learning and smoothing):

    y=r+γmin⁡j=1,2Qϕj′(s′,a′)y = r + \gamma \min_{j=1,2} Q_{\phi'_j}(s', a')
    a′=μθ′(s′)+ϵ,ϵ∼clip(N(0,σ),−c,c)a' = \mu_{\theta'}(s') + \epsilon, \quad \epsilon \sim \text{clip}(\mathcal{N}(0, \sigma), -c, c)
  • Numerical calculation example:

    The target Actor gives the next action araw=0.5a_{raw} = 0.5. Add noise ϵ=0.05\epsilon = 0.05 (after truncation), and the final target action is a′=0.55a' = 0.55.

    Enter a′a' into two target Critic networks:

    Assume that Critic 1 predicts the Q value to be 105105, and Critic 2 predicts the Q value to be 9595.

TD3 takes the minimum value to suppress overestimation: min⁡(105,95)=95\min(105, 95) = 95.

Final TD target y=r+γ×95y = r + \gamma \times 95.

SAC (Soft Actor-Critic)

  • Principle: A reinforcement learning algorithm for the maximum entropy of alternative policies, which encourages exploration.

  • Core formula (the entropy term in the objective function):

    J(π)=E[r(st,at)+αH(π(⋅∣st))]J(\pi) = \mathbb{E} \left[ r(s_t, a_t) + \alpha \mathcal{H}(\pi(\cdot|s_t)) \right]
  • Numerical calculation example:

Assuming there are two discrete possible actions in the current state, the policy output probability distribution is [0.9,0.1][0.9, 0.1].

Computing information entropy: H=−(0.9ln⁡0.9+0.1ln⁡0.1)≈0.325\mathcal{H} = -(0.9 \ln 0.9 + 0.1 \ln 0.1) \approx 0.325.

If the temperature coefficient is α=0.2\alpha = 0.2, the “soft reward” additional item for this step is 0.2×0.325=0.0650.2 \times 0.325 = 0.065.

If the policy becomes more random [0.5,0.5][0.5, 0.5], the entropy H≈0.693\mathcal{H} \approx 0.693, and the additional reward becomes 0.1380.138. SAC rewards exploration behavior in this way substantially.


2. Understand concepts such as GAE (Generalized Advantage Estimation) and PG (Policy Gradient).

PG (Policy Gradient)

  • Formula: ∇θJ(θ)=E[∇θlog⁡πθ(at∣st)R(τ)]\nabla_\theta J(\theta) = \mathbb{E} \left[ \nabla_\theta \log \pi_\theta(a_t|s_t) R(\tau) \right]

  • Numerical calculation examples:

    Assume a total reward of R(τ)=100R(\tau) = 100 per round. The probability of a certain action ata_t is π(at)=0.2\pi(a_t) = 0.2.

log⁡(0.2)≈−1.6\log(0.2) \approx -1.6. The update magnitude of the gradient will be multiplied by 100100. If the total reward for the same action in another trajectory is only 1010, the update strength becomes 1010. The network will gradually tend to increase the probability of the action in high-reward trajectories.

GAE (Generalized Advantage Estimation)

  • Principle: Balance the bias and variance of TD error.

  • Core formula:

    δtV=rt+γV(st+1)−V(st)\delta_t^V = r_t + \gamma V(s_{t+1}) - V(s_t)

    A^t=∑l=0∞(γλ)lδt+lV\hat{A}_t = \sum_{l=0}^\infty (\gamma \lambda)^l \delta_{t+l}^V

  • Numerical calculation example (hand calculation of 2-step trajectory):

    Let γ=0.99\gamma = 0.99 and λ=0.95\lambda = 0.95.

There are three states s0,s1,s2s_0, s_1, s_2 (end).

Reward: r0=1,r1=2r_0 = 1, r_1 = 2.

Value network prediction: V(s0)=2.0,V(s1)=3.0,V(s2)=0.0V(s_0) = 2.0, V(s_1) = 3.0, V(s_2) = 0.0 (end state is 0).

  1. Calculate the single-step TD error for each step (δ\delta):

    δ0=1+0.99×3.0−2.0=1.97\delta_0 = 1 + 0.99 \times 3.0 - 2.0 = 1.97

    δ1=2+0.99×0.0−3.0=−1.0\delta_1 = 2 + 0.99 \times 0.0 - 3.0 = -1.0

  2. Reverse recursive calculation advantage (AA):

    Last step: A1=δ1=−1.0A_1 = \delta_1 = -1.0

    Second-to-last step: A0=δ0+γλA1=1.97+(0.99×0.95)×(−1.0)=1.97−0.9405=1.0295A_0 = \delta_0 + \gamma \lambda A_1 = 1.97 + (0.99 \times 0.95) \times (-1.0) = 1.97 - 0.9405 = 1.0295

Conclusion: The advantage value of action a0a_0 is positive (1.0295), so it should be encouraged; the advantage value of action a1a_1 is negative (-1.0), so it should be suppressed.

Pythonimport torch
# 带入上述数值验证伪代码
rewards = torch.tensor([1.0, 2.0])
values = torch.tensor([2.0, 3.0])
next_value = 0.0
dones = torch.tensor([0.0, 1.0])
gamma, lam = 0.99, 0.95
# (循环逻辑见原始回答,计算结果与手算完全一致)




1. Macro Perspective: The “Coach and Athlete” in Reinforcement Learning

We can imagine the entire process as a process where a coach (GAE/value network) guides athletes (policy network).

Policy Gradient (PG) —— Athlete Training

The core logic of PG is very simple: “If you win this round, the probability of all my actions in this round will increase; if you lose, it will decrease.”

  • It doesn’t care whether the action itself is good or not; it only cares about the result.
  • Pain point: If a game has 1,000 steps, the 5th step is executed brilliantly, but the 999th step results in a mistake and a loss. The PG will punish that brilliant move in the 5th step as well because the outcome is “loss”. This is high variance.

Generalized Advantage Estimation (GAE) —— Coach’s Review

GAE is designed to address the above pain points. It no longer uses “final result” to evaluate each step, but instead assesses based on “how much better this step is than I expected.”

  • It combines “current immediate rewards” and “predictions for the future”.
  • It is like a rational coach, telling the athlete: “Although you lost in the end, your manipulation in step 5 actually increased your winning rate from 20% to 60%—that extra point!”

2. Complete Pipeline (Iteration Process)

In actual PPO or A2C algorithms, data flows as follows:

Step 1: Interaction (Sampling)

The athlete (policy network πθ\pi_\theta) plays NN steps in the environment.

  • Output: A set of data {st,at,rt,st+1}\{s_t, a_t, r_t, s_{t+1}\} is obtained (state, action, reward, next state).
  • State: At this point, the network parameters θ\theta are fixed and not updated.

Step 2: Evaluation (Scoring - GAE Takes Effect)

Now we need to score each action in this NN step with ata_t. This score is the advantage function AtA_t.

  1. Value estimation: Input sts_t into the “value network VV”, which will predict how many points each state value is worth.
  2. Calculate TD error (δ\delta): Check if the actual reward received rtr_t plus the expectation for the future exceeds the current expectation.
  3. GAE smoothing: Using the λ\lambda parameter, add up the errors for now, one second later, and two seconds later with weighting.
    • After this step, each action ata_t will have a precise A^t\hat{A}_t (positive numbers indicate better than expected, negative numbers indicate worse than expected).

Step 3: Learning (Update - PG in action)

With the score A^t\hat{A}_t, we need to go back and modify the muscle memory of the athlete (policy network).

  1. Calculate gradient: Find the probability log⁡π(at∣st)\log \pi(a_t|s_t) of selecting action ata_t under state sts_t.

  2. Weighted update:

    更新量=∇θlog⁡π(at∣st)×A^t\text{更新量} = \nabla_\theta \log \pi(a_t|s_t) \times \hat{A}_t

  • If A^t\hat{A}_t is positive (good ball!), the gradient direction will increase the probability of that action.
  • If A^t\hat{A}_t is negative (bad ball!), the gradient direction will decrease the probability of that action.
  1. Gradient ascent: Update θ\theta, making the network smarter.

Step 4: Loop

Use the updated “athlete” to play again, and repeat step 1.


3. Why Must GAE Be Used? (Deep Intuition)

What would happen if we only used PG without adding GAE?

  • PG (REINFORCE) without GAE:

Use R(τ)R(\tau) (the total score of the whole game) to multiply by each action.

  • Disadvantages: The updates are extremely slow and unstable. It’s like taking a 3-hour exam, and at the end you only get a total score—you have no idea which questions were correct and which were wrong.

  • With the GAE PG:

    Multiply each action by A^t\hat{A}_t.

  • Advantages: It assigns a “small fraction” to each question (each action). The λ\lambda parameter acts like a control valve:

    • When λ=0\lambda=0, it only considers the next second, which is very forward-looking but potentially short-sighted.
    • When λ=1\lambda=1, it looks at the overall situation, which is very fair but may be disrupted by random factors (noise).
    • GAE takes an intermediate value, achieving a perfect balance between bias and variance.

Summary: How was your calculation process integrated?

  1. V(s)V(s) network provides the expected “baseline line”.
  2. δt\delta_t (TD Error) calculates the “gap between reality and ideal”.
  3. GAE (Advantage) uses γλ\gamma \lambda recursion to connect these gaps into a line, determining the nature of the action (good or bad).
  4. PG (Policy Gradient) uses this qualitative result to fine-tune the weights in the neural network.

3. Be able to clearly explain the design concept of the reward function, as well as how to handle the Sim-to-Real gap.

Design Concept of Reward Function

  • Formula:

    Rt=ωtaskI(success)+ωshapeexp⁡(−α∣∣pee−pobj∣∣2)−ωpen∣∣τt∣∣22R_t = \omega_{task} \mathbb{I}(success) + \omega_{shape} \exp(-\alpha || p_{ee} - p_{obj} ||_2) - \omega_{pen} || \tau_t ||^2_2
  • Numerical calculation example:

    Assume the grasping task weight ωtask=100\omega_{task} = 100, distance guidance ωshape=5\omega_{shape} = 5, smoothness parameter α=10\alpha = 10, and penalty weight ωpen=0.1\omega_{pen} = 0.1.

    Current robotic arm end coordinate pee=(0.5,0,0.5)p_{ee} = (0.5, 0, 0.5), target object coordinate pobj=(0.5,0,0.4)p_{obj} = (0.5, 0, 0.4).

    The square of the torque output two norm ∣∣τt∣∣22=4.0||\tau_t||^2_2 = 4.0.

    1. Calculate the distance: ∣∣pee−pobj∣∣2=0+0+(0.5−0.4)2=0.1|| p_{ee} - p_{obj} ||_2 = \sqrt{0 + 0 + (0.5-0.4)^2} = 0.1 meters.

    2. Calculate the formation reward: 5×exp⁡(−10×0.1)=5×exp⁡(−1)≈5×0.367=1.8355 \times \exp(-10 \times 0.1) = 5 \times \exp(-1) \approx 5 \times 0.367 = 1.835.

    3. Calculate the penalty: 0.1×4.0=0.40.1 \times 4.0 = 0.4.

  1. No target caught, I(success)=0\mathbb{I}(success) = 0.

Current step total reward: Rt=0+1.835−0.4=1.435R_t = 0 + 1.835 - 0.4 = 1.435.

Handle the Sim-to-Real Gap (Example of Domain Randomization Values)

In the simulation, we set the mass of the robotic arm links to a normal distribution. The real mass is 2.0 kg, and in the simulation, we define the sampling mass per round m∼N(2.0,0.22)m \sim \mathcal{N}(2.0, 0.2^2). This means that during training, the RL network must learn a control policy that works within the range of 1.6 kg to 2.4 kg, so that when deployed in the physical world, it can ignore the error in the motor friction model.


4. Familiarize yourself with the architecture and concepts of mainstream models such as Open-VLA and RT-2.

RT-2 (Robotic Transformer 2)

  • Core idea: Discretize the actions as text words (Tokenization) and feed them directly to the large model for prediction.

  • Numerical calculation example (action tokenization):

    Formula: atoken=⌊a−aminamax−amin×255⌋a_{token} = \lfloor \frac{a - a_{min}}{a_{max} - a_{min}} \times 255 \rfloor

    Assume that we need to predict the opening and closing degree of the gripper aa. The real physical value range is [−1.0,1.0][-1.0, 1.0] (-1 for fully closed, 1 for fully open).

In the current sample data, the gripper opening and closing value is a=0.12a = 0.12.

Substitute into the formula:

atoken=⌊0.12−(−1.0)1.0−(−1.0)×255⌋=⌊1.122.0×255⌋=⌊0.56×255⌋=⌊142.8⌋=142a_{token} = \lfloor \frac{0.12 - (-1.0)}{1.0 - (-1.0)} \times 255 \rfloor = \lfloor \frac{1.12}{2.0} \times 255 \rfloor = \lfloor 0.56 \times 255 \rfloor = \lfloor 142.8 \rfloor = 142。

At this point, the physical action is mapped to the 142nd special token in the large model dictionary (e.g., <action_142>).

Open-VLA

  • Based on 7B parameters. If using FP16 precision inference, the weights themselves require approximately 14GB of VRAM. Plus the KV Cache, a 24GB RTX 3090 or 4090 is usually needed for smooth single-step inference.

5. Understand the principles of fine-tuning methods such as LoRA.

LoRA (Low-Rank Adaptation)

  • Formula: h=W0x+BAxh = W_0 x + B A x

  • Numerical calculation example (simple manual calculation of matrix):

    Assume the weights of a linear layer in the pre-trained model W0∈R2×2W_0 \in \mathbb{R}^{2 \times 2}. It is frozen due to being too large. Input feature x=[1,2]Tx = [1, 2]^T.

We set the Rank r=1r = 1.

Initialize the low-rank matrix A∈R1×2A \in \mathbb{R}^{1 \times 2} to a random Gaussian distribution, assuming the current A=[1,1]A = [1, 1].

Initialize the low-rank matrix B∈R2×1B \in \mathbb{R}^{2 \times 1} to all zeros, but assume B=[1,−1]TB = [1, -1]^T after several steps of training.

Set the scaling factor to scaling=α/r=16/1=16\text{scaling} = \alpha / r = 16 / 1 = 16.

Bypass calculation process:

  1. Ax=[1,1]×[1,2]T=1×1+1×2=3A x = [1, 1] \times [1, 2]^T = 1 \times 1 + 1 \times 2 = 3 (dimensional reduction to r=1)

  2. B(Ax)=[1,−1]T×3=[3,−3]TB (Ax) = [1, -1]^T \times 3 = [3, -3]^T (return to level 2)

  3. Multiply by the scaling factor: 16×[3,−3]T=[48,−48]T16 \times [3, -3]^T = [48, -48]^T.

The final output is based on the output of the original pre-trained model, which contains W0xW_0 x, plus the Δ=[48,−48]T\Delta = [48, -48]^T introduced by the fine-tuning.

 **Parameter count comparison**: Originally, updating all parameters for fine-tuning would require modifying $2 \times 2 = 4$ parameters; using $r=1$ LoRA only requires updating $1 \times 2 + 2 \times 1 = 4$ parameters. However, in large models (such as $4096 \times 4096$), the parameter count of LoRA ($r=8$) is only $0.4\%$ of the total parameter count!

6. Ability to analyze the advantages and disadvantages of VLA compared to other methods (such as pure reinforcement learning), and consider its feasibility in industry applications.

  • Numerical Comparative Analysis:
    • Success Rate and Generalization: In a task of “grasping cups of any color at a table,” pure RL may see its success rate plummet from 95% to 5% when dealing with unseen red cups; whereas VLA, due to its semantic understanding similar to VLM, can still maintain a success rate of over 85%.
    • Control Frequency: Pure RL networks are very small (such as MLP), with inference latency within 1ms, enabling 500Hz underlying force control; while a 7B-parameter VLA (even when quantized to INT8) requires 80ms - 200ms for a single forward inference, and can only perform advanced action planning at 5Hz - 10Hz.
  • Industrial Implementation: Therefore, the industry adopts a two-layer architecture of upper-level VLA (2Hz) + lower-level MPC/RL (200Hz).

7. Understand basic concepts such as inverse kinematics (IK), Jacobian matrix, PID control, and MPC.

Forward and Reverse Kinematics (using a 2-degree-of-freedom robotic arm in a 2D plane)

  • Numerical examples:

    The lengths of the two connecting rods are L1=1.0L_1 = 1.0 meters and L2=1.0L_2 = 1.0 meters.

    Forward Kinematics (FK): Given joint angles θ1=90∘(π/2)\theta_1 = 90^\circ (\pi/2), θ2=0∘\theta_2 = 0^\circ.

    End point coordinate x=L1cos⁡(θ1)+L2cos⁡(θ1+θ2)=0+0=0x = L_1 \cos(\theta_1) + L_2 \cos(\theta_1+\theta_2) = 0 + 0 = 0.

    End point coordinate y=L1sin⁡(θ1)+L2sin⁡(θ1+θ2)=1+1=2y = L_1 \sin(\theta_1) + L_2 \sin(\theta_1+\theta_2) = 1 + 1 = 2.

    Conclusion: The end is at (0,2)(0, 2).

Inverse Kinematics (IK): Given the target point at (0,2)(0, 2), it can be deduced that θ1=90∘,θ2=0∘\theta_1 = 90^\circ, \theta_2 = 0^\circ (valid when no singular point exists).

Jacobi Matrix

  • Numerical example: X˙=J(θ)θ˙\dot{X} = J(\theta) \dot{\theta}

Assume the currently calculated J(θ)=[0−110]J(\theta) = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}. We want the end effector to translate in the positive x-direction at a linear velocity of X˙=[0.1,0]T\dot{X} = [0.1, 0]^T (m/s).

Solve the joint velocity θ˙=J−1X˙=[01−10][0.10]=[0−0.1]\dot{\theta} = J^{-1} \dot{X} = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} \begin{bmatrix} 0.1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ -0.1 \end{bmatrix} (rad/s).

That is, joint 1 remains stationary, while joint 2 reverses at a speed of 0.1 rad/s.

PID Control

  • Formula: u(t)=Kpe(t)+Ki∫e(τ)dτ+Kde˙(t)u(t) = K_p e(t) + K_i \int e(\tau)d\tau + K_d \dot{e}(t)

  • Numerical calculation example:

    Target position: 10.0, current real position: 8.0. Current error: e(t)=2.0e(t) = 2.0.

    Cumulative historical error integral ∫e=5.0\int e = 5.0.

    The error is decreasing, with a rate of change e˙(t)=−0.5\dot{e}(t) = -0.5.

    Set the parameter Kp=2.0,Ki=0.1,Kd=0.5K_p = 2.0, K_i = 0.1, K_d = 0.5.

    Motor output torque u(t)=(2.0×2.0)+(0.1×5.0)+(0.5×−0.5)=4.0+0.5−0.25=4.25u(t) = (2.0 \times 2.0) + (0.1 \times 5.0) + (0.5 \times -0.5) = 4.0 + 0.5 - 0.25 = 4.25 Nm.


8. Understand the principles and applications of common sensors (such as Realsense depth cameras).

Realsense Depth Camera (depth disparity calculation)

  • Formula: Z=f⋅BdZ = \frac{f \cdot B}{d}

  • Numerical calculation examples:

Assume the infrared lens focal length of the camera is f=600f = 600 pixels.

The physical baseline distance between the left and right cameras is B=0.05B = 0.05 meters (5 centimeters).

A point on the target object has a horizontal coordinate of 300 in the left eye image and 280 in the right eye image. The parallax is d=300−280=20d = 300 - 280 = 20 pixels.

Calculation depth distance: Z=600×0.0520=3020=1.5Z = \frac{600 \times 0.05}{20} = \frac{30}{20} = 1.5 meters.

The camera can output the depth of this pixel point as 1.5m.


9. “Why is the reward function set up this way in your project? What other approaches have you tried?”

(Numerical example integrating potential energy calculation)

"In addition to sparse rewards, I used Potential-based Reward Shaping:

F(s,a,s′)=γΦ(s′)−Φ(s)F(s, a, s') = \gamma \Phi(s') - \Phi(s)

Among them, Φ(s)\Phi(s) is a kind of scaling factor for the inverse of the distance between the end and the object.

Specific calculation: Assuming the distance from dd, we define the potential energy function Φ(s)=1d+0.1\Phi(s) = \frac{1}{d + 0.1}. γ=0.99\gamma = 0.99.

In status ss (previous step), 0 km from d=0.4d=0.4, potential energy Φ(s)=10.5=2.0\Phi(s) = \frac{1}{0.5} = 2.0.

In state s′s' (after the action is performed), the robotic arm approaches the object, reducing the distance to d=0.15d=0.15 meters, with potential energy Φ(s′)=10.25=4.0\Phi(s') = \frac{1}{0.25} = 4.0.

The guidance reward obtained from this step is: F=0.99×4.0−2.0=3.96−2.0=1.96F = 0.99 \times 4.0 - 2.0 = 3.96 - 2.0 = 1.96.

The positive reward of 1.96 effectively encourages the robotic arm to approach the object, and mathematically ensures that the ‘looping’ flaw (Reward Loop) that leads to local optimization is avoided.


10. “What information is included in your observation space? Why was it designed this way?”

(Example of values integrated into dimension calculation)

“My observation space strictly controls the dimension size to optimize sample efficiency. The specific concatenation is as follows:

  1. Body information: The joint angles (6 dimensions) and angular velocity (6 dimensions) of the 6-degree-of-freedom robotic arm = 12 dimensions.

  2. End pose: Position (x,y,z)(x,y,z), 3D position + quaternion pose 4D + gripper opening 1D = 8D.

  3. Visual features: Images from the hand-eye camera 84×84×384 \times 84 \times 3. If flattened directly without dimensionality reduction, it has a dimension of 21168, which is highly overfitting. I extract features using the frozen pre-trained ResNet-18, and output zimgz_{img} with a dimension of 512.

Total dimension: The observation vector OtO_t fed into the RL Actor network has a dimension of 12+8+512=53212 + 8 + 512 = 532, and is a 1D tensor. This design retains the Markov property of the environment while compressing the state space to a minimal level.”


11. “Please explain the multi-head attention mechanism of Transformer.”

Example of Numerical Calculation for Self-Attention Mechanism

  • Formula: Attention(Q,K,V)=softmax(QKTdk)V\text{Attention}(Q, K, V) = \text{softmax} \left( \frac{Q K^T}{\sqrt{d_k}} \right) V

  • Assume that there are only two tokens in the input (such as “red” and “cup”). The Q,K,VQ, K, V dimension after projection is set to a small positive value, such as dk=4d_k = 4.

    Let Q=[10100101]Q = \begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \end{bmatrix} (a Query with two lines representing two words).

    Let K=[10100101]K = \begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \end{bmatrix}.

    1. Calculate the inner product QKT=[10100101][10011001]=[2002]Q K^T = \begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ 1 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 0 \\ 0 & 2 \end{bmatrix}.

    2. Divide by dk=4=2\sqrt{d_k} = \sqrt{4} = 2, resulting in the attention score matrix: [1001]\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}.

    3. Softmax (simplified for demonstration since non-diagonal elements are 0), with the results heavily concentrated on itself. Finally, multiply by VV to extract the information.

The multi-head mechanism involves performing the above process hh times in several parallel spaces, and then concatenating them together. This ensures that the model can extract features from different sub-spaces such as “color” and “shape” when observing the same word.


12. “What is the difference between Diffusion Models (DM) and Autoregressive Models (AR) in VLA?”

  • Autoregressive (AR) numerical example:

    Predict a motion sequence [a1,a2][a_1, a_2].

    Step 1 prediction probability P(a1∣obs)=0.9P(a_1 | obs) = 0.9. Put a1a_1 back into the input, and for Step 2, predict P(a2∣obs,a1)=0.8P(a_2 | obs, a_1) = 0.8.

The overall trajectory joint probability is 0.9×0.8=0.720.9 \times 0.8 = 0.72. The issue is that once the prediction of a1a_1 has a slight error, the error will accumulate exponentially with the number of steps (Exposure Bias).

  • Diffusion Model (DM) numerical example:

    Predict the entire trajectory. The task of the network ϵθ\epsilon_\theta is to predict the current added noise.

Assume that the Ground Truth action is combined with the Gaussian noise from real sampling ϵ=[0.1,−0.2]T\epsilon = [0.1, -0.2]^T.

The network forward inference predicts noise ϵ^=[0.08,−0.22]T\hat{\epsilon} = [0.08, -0.22]^T.

Calculate the MSE Loss of DDPM: ∣∣ϵ−ϵ^∣∣22=(0.1−0.08)2+(−0.2−(−0.22))2=0.0004+0.0004=0.0008|| \epsilon - \hat{\epsilon} ||_2^2 = (0.1 - 0.08)^2 + (-0.2 - (-0.22))^2 = 0.0004 + 0.0004 = 0.0008.

Each DM directly denoises and outputs a Chunk containing multiple steps (with a length of 16 steps). The trajectory is naturally smooth and consistent, completely solving the cascading error problem in AR.


13. “Why did you choose our lab/this direction?”

"I chose the field of embodied AI because it enables closed loop intervention in the physical world.

As for choosing your lab:

  1. Technical Fit: I have read your team’s paper on diffusion models for manipulation of dexterous hand systems with long views. I noticed that you set the Chunk Size for action prediction at 32, which increased the grasping success rate by 15%. In my previous project, I also tried adjusting the window length of Action Chunking and found that 16 to 32 is a sweet spot—this really resonated with the engineering details you have implemented.
  2. Computational Power and Hardware Implementation: You have 4 real robot platforms equipped with multi-finger dexterous hands, along with an A100 cluster in a private cloud. Compared to my current setup, which can only run 500,000 steps of reinforcement learning simulation using a single RTX 3090 card, your platform allows me to perform 10 million steps within the same cycle, significantly accelerating the closed loop from simulation to reality.

1. What do DDPG/PPO/TD3/SAC do? What are the inputs and outputs?

They are a set of general “brain learning rules” (continuous control framework). You can use them to train the robotic arm to grasping, train robot dogs for parkour, and even train an autonomous car to steer.

The core structure of these four algorithms typically consists of two neural networks: Actor (responsible for outputting actions) and Critic (responsible for scoring).

1. Model input (Observation/State)

When performing tasks, what is input to the model (mainly the Actor network) is usually a one-dimensional vector, representing the state currently perceived by the robot sts_t. This vector can contain various types of information:

  • Physical state (most common): For example, the angles and angular velocity of the 6 joints of the robotic arm, and the (x,y,z)(x,y,z) coordinates of the gripper at the end. If it is a 12-dimensional array, the network input layer size is 12.
  • Image input (Visual RL): If you want the model to “see” images, you usually do not feed tens of thousands of pixels directly into these reinforcement learning algorithms. The standard approach is to first use a CNN (such as ResNet) to compress the RGB image into a fixed-length feature vector (e.g., 256 dimensions), and then combine it with the physical state above before feeding it into the algorithm.
  • Language commands: For popular language condition control, the method is similar. The phrase “pick up a red apple” is converted into a series of numerical vectors using a text encoder like CLIP, and this vector is also combined with the input state.

2. Model Output (Action)

The output of the Actor network ata_t is the continuous action command to be executed in the next step.

  • Specific form: For example, a 6-dimensional vector representing the target torque of the 6 robotic arms’ motors, or the desired joint angular velocity.
  • Output flow: This output is directly sent to the physics engine (such as the Isaac Gym simulator) or real hardware controllers for execution.

3. Intermediate Iteration Process (The RL Loop)

Taking the robotic arm grasping objects as an example, the entire closed loop iteration process is as follows:

  1. Observe the environment: The sensor obtains the current state sts_t (e.g., the robotic arm is at point A, and the target is at point B).
  2. Network decision: Feed sts_t into the Actor network, and after calculation, the Actor outputs an action ata_t (e.g., each motor rotates a certain angle).
  3. Environmental feedback: After the robot executes action ata_t, it moves to a new state st+1s_{t+1}. At this point, the environment (or your code) provides a reward rtr_t (e.g., +1 point for approaching the target; -10 points for hitting a wall).
  4. Collect data: Store the experience from this step (st,at,rt,st+1)(s_t, a_t, r_t, s_{t+1}) in an “experience replay pool” (a large data table).
  5. Update the network:
    • Critic update: The Critic retrieves data from the pool to learn how to more accurately predict “how many points can be earned by taking a certain action under a specific state in the future.” (TD target values will be discussed soon).
    • Actor update: The Actor adjusts its parameters based on the Critic’s scores, ensuring that when similar situations occur next time, it will likely output an action with higher scores.
  6. Loop: Return to step 1 and repeat this process tens of thousands to millions of times until the model learns the optimal policy.

II. What is “TD Target”?

TD (Temporal Difference) is one of the most sophisticated concepts in reinforcement learning. You can consider the TD target value as: a “most recent and accurate prediction” of the total future reward, combined with the “actual reward” that just occurred.

Let me give you an example from daily life so you can understand immediately:

Suppose you are driving from Beijing to Shanghai. Before leaving, your brain (Critic network) estimates that it will take 12 hours to get there.

When driving to Tianjin, you spent 2 hours (which is equivalent to the real reward for the current step rtr_t). At this point, you use navigation to check again: it takes 9 hours from Tianjin to Shanghai (which is the model’s estimate for the future state st+1s_{t+1}).

So, considering the already completed part of the journey, your latest total time estimate for the “Beijing to Shanghai” trip becomes:

2 hours (actual time spent) + 9 hours (latest forecast remaining time) = 11 hours.

This 11 hours is the TD target value!

Your brain will use these 11 hours to correct the 12 hours of estimates made before departure. This method of continuously refining old predictions with new information by “taking one step at a time” is the core of TD learning.

As it stands in the formula, it is like this:

yt=rt+γQ(st+1,at+1)y_t = r_t + \gamma Q(s_{t+1}, a_{t+1})
  • rtr_t: The actual reward obtained from the just executed action (the 2 hours spent).
  • Q(st+1,at+1)Q(s_{t+1}, a_{t+1}): The Critic network’s prediction of how many points can be earned in the future after reaching a new state (how long it will take to travel from Tianjin to Shanghai).
  • γ\gamma: Discount factor (usually 0.99, indicating that the future estimate is discounted, slightly reducing the weight).
  • yty_t: The calculated TD target value.

During training, the task of the Critic network is to strive to make its predicted values Q(st,at)Q(s_t, a_t) approach the TD target value yty_t, thereby becoming more accurate.

Macroscopically, DDPG/PPO/TD3/SAC all operate within the same “actuator-critic” framework of “observation-action-reward-update”. However, microscopically, in order to address various “failure” issues during training, scientists have made different modifications to the network output format, Q-value calculation method, and reward mechanism.

The core difference lies in these micro-level aspects. We can first take PPO, and then compare the three “related algorithms”—DDPG, TD3, and SAC—side by side.

1. The difference in fundamental camps: How are the data used?

  • PPO (Same policy, On-policy): It is a typical example of “learning by doing”. The Actor personally collects a batch of data in the environment, and after updating the network, this data is discarded. The next update requires using the latest Actor to collect new data.
  • DDPG / TD3 / SAC (Different policy, Off-policy): They have a large “Replay Buffer”. The data collected by the Actor is stored there, and the Critic can repeatedly retrieve old data from it for learning. This approach saves costs associated with interaction with the environment (high sample efficiency).

2. Micro-surgical scalpels: What exactly did they change in Q values and policies?

These three different policy algorithms (DDPG -> TD3 -> SAC) are actually a “tragic history of filling gaps”. Their subtle differences precisely answer your questions:

DDPG: The pioneer (but also full of flaws)

  • Action output: The Actor directly outputs a definite value (e.g., “motor output 2.5 Newtonm”). This is called a deterministic policy.
  • Q-value calculation: The Critic acts like a naive teacher, directly updating based on the standard TD target formula y=r+γQ(s′,a′)y = r + \gamma Q(s', a').
  • Fatal flaw: Since neural networks always have errors in prediction, the Critic in DDPG is extremely prone to blind optimism (over-estimating Q-values). It will assign very high scores to actions that are actually poor, causing the Actor to fail to learn properly.

TD3: The “Powerful Patch Version” of DDPG

To address the “blind optimism” of DDPG, TD3 makes extremely sophisticated modifications in the micro-level Q value calculation:

  • Minimize the dual Q network (key!): It directly uses two independent Critic networks. When calculating future Q value predictions, both networks score separately, and then the smaller of the two is forced to be selected.
    • Real-life example: You are evaluating the future value of a house and hire two appraisers. One says it is worth 5 million, and the other says it is worth 3 million. To be safe (to avoid being caught in an overvaluation), you make a decision based on 3 million.
  • Target policy smoothing: When calculating the TD target value, a little random noise is intentionally added to the next action a′a'. This forces the Critic to understand: “Don’t just give high scores to a single specific action; check if the entire surrounding area is good.”
  • Delayed update: The Critic updates two or three times before the Actor updates once. Once the Critic has calculated the scores accurately, it then guides the Actor.

SAC: The current king, directly changed the definition of “rewards”

SAC takes a different approach. The biggest change at the micro level is the modification of the objective of the reward function (maximum entropy framework):

  • Microscopic change in rewards: It inserts a “Entropy Bonus” directly after the traditional real reward rr.
    • The goal becomes: maximizing [任务奖励+α×策略的随机性][ 任务奖励 + \alpha \times 策略的随机性 ].
  • Action output: Unlike the action outputs of DDPG/TD3, which are deterministic, the Actor output of SAC is a Gaussian distribution (mean and variance).
  • Effect: This means that SAC not only requires the robot to complete the task, but also encourages the robot to complete the task in as many random postures as possible. This microscopic design enables SAC to exhibit strong robustness when facing sudden disruptions in the physical environment.

3. One picture beats a thousand words: Summary table of microscopic differences

Policy Actor Output Form Q-Value Prediction Manipulation (Critic) Reward/Update Special Mechanism Applicable Scenario Characteristics
PPO Probability distribution (Gaussian/discrete) Use advantage function (Advantage) Clipping, to prevent update steps from being too large Extremely stable, simplest parameter tuning, least hassle
DDPG Deterministic specific values Single Q network, direct prediction No special mechanism, directly compute TD error Prone to crashes, rarely used alone now
TD3 Deterministic specific values Minimum of two Q networks Noisy target action, delaying Actor update Fast training speed, relatively low computational cost
SAC Probability distribution (Gaussian mean/variance) Minimum of two Q networks Maximize policy entropy (exploration bonus added to reward) High sample utilization, strongest robustness for real robot

By removing the complex mathematical formulas, when implemented in code, they often only involve adding small manipulations such as torch.min(q1, q2) or + alpha * entropy to the few lines of code involving Critic.forward() or Loss, yet this results in a significant improvement in overall performance.