KDPKeyed Drifting Policies Illinois Block I logoUniversity of Illinois
Urbana-Champaign

Amortizing Trajectory Diffusion
with Keyed Drift Fields

KDP: retrieve condition-matched dataset windows, train a generator using attraction and repulsion, then generate and execute trajectories in one step
Keyed Drifting Policies. Condition-matched retrieval and drift-based refinement during training; a full trajectory window in one forward pass at inference.
01

Abstract

Diffusion-based trajectory planners can synthesize rich, multimodal action sequences for offline reinforcement learning, but their iterative denoising incurs substantial inference-time cost, making closed-loop planning slow under tight compute budgets. We study the problem of achieving diffusion-like trajectory planning behavior with one-step inference, while retaining the ability to sample diverse candidate plans and condition on the current state in a receding-horizon control loop. Our key observation is that conditional trajectory generation fails under naïve distribution-matching objectives when the similarity measure used to align generated trajectories with the dataset is dominated by unconstrained future dimensions. In practice, this causes attraction toward average trajectories, collapses action diversity, and yields near-static behavior. Our key insight is that conditional generative planning requires a conditioning-aware notion of neighborhood: trajectory updates should be computed using distances in a compact key space that reflects the condition, while still applying updates in the full trajectory space. Building on this, we introduce Keyed Drifting Policies (KDP), a one-step trajectory generator trained with a drift-field objective that attracts generated trajectories toward condition-matched dataset windows and repels them from nearby generated samples, using a stop-gradient drifted target to amortize iterative refinement into training. At inference, the resulting policy produces a full trajectory window in a single forward pass. Across standard RL benchmarks and real-time hardware deployments, KDP achieves strong performance with one-step inference and substantially lower planning latency than diffusion sampling.

02

Conditioning-aware drift fields

Comparison of full-window neighborhoods, which average trajectories, and key-space neighborhoods, which preserve conditional diversity
Full-window distances obscure the current condition. Key-space distances recover condition-matched neighborhoods.

Conditional generation needs a conditioning-aware neighborhood.

Diffusion planners produce expressive, multimodal trajectories, but each control step requires sequential denoising. Naïve one-step distribution matching can instead pull samples toward average, near-static trajectories.

KDP compares samples in a compact key space aligned with the condition, while applying updates in the full trajectory space. Attraction toward matched dataset windows and repulsion from generated neighbors define the drift field.

A stop-gradient drifted target amortizes this refinement into training. At inference, the generator samples a trajectory window in one forward pass, executes the first action, and replans.

Algorithm 1: Keyed drifting policy training (one SGD step)

Input: Dataset minibatch {y+i}i=1B\{\ypos_i\}_{i=1}^B; key map κ\kkey; generator gψg_\psi; temperatures {τm}m=1M\{\tau_m\}_{m=1}^M; clamp operator C\mathcal{C}; clamp mask MM; weights λa,λs\lambda_a,\lambda_s.

  1. ci←κ(y+i)c_i \gets \kkey(\ypos_i), sample zi∼N(0,I)z_i \sim \mathcal{N}(0,I).
  2. xi←Cci ⁣(gψ(zi,ci))\xgen_i \gets \mathcal{C}_{c_i}\!\big(g_\psi(z_i,c_i)\big).
  3. y−j←xj\yneg_j \gets \xgen_j and mask self-negatives (j=ij=i) in repulsion weights.
  4. Vi←0V_i \gets 0 for all ii.
  5. for m=1m=1 to MM do
  6. W+ij←softmax ⁣(−dκ(xi,y+j)/τm)\Wpos_{ij} \gets \mathrm{softmax}\!\big(-\dkey(\xgen_i,\ypos_j)/\tau_m\big).
  7. W−ij←softmax ⁣(−dκ(xi,y−j)/τm)\Wneg_{ij} \gets \mathrm{softmax}\!\big(-\dkey(\xgen_i,\yneg_j)/\tau_m\big).
  8. μ+i←∑jW+ijy+j,μ−i←∑jW−ijy−j\mupos_i \gets \sum_j \Wpos_{ij}\ypos_j,\quad \muneg_i \gets \sum_j \Wneg_{ij}\yneg_j.
  9. Vi←Vi+1M(μ+i−μ−i)V_i \gets V_i + \frac{1}{M}\big(\mupos_i - \muneg_i\big).
  10. end for
  11. Vi←M⊙ViV_i \gets M \odot V_i. // constraint-aware drift
  12. x~i←Cci ⁣(sg(xi+Vi))\widetilde{x}_i \gets \mathcal{C}_{c_i}\!\big(\mathrm{sg}(\xgen_i + V_i)\big).
  13. Δi,ts←xi[t,0:ds]−x~i[t,0:ds]\Delta^s_{i,t} \gets \xgen_i[t,0{:}d_s]-\widetilde{x}_i[t,0{:}d_s]
  14. Δi,ta←xi[t,ds:D]−x~i[t,ds:D]\Delta^a_{i,t} \gets \xgen_i[t,d_s{:}D]-\widetilde{x}_i[t,d_s{:}D]
  15. L←∑i,t(λs∥Δi,ts∥22+λa∥Δi,ta∥22)\mathcal{L} \gets \sum_{i,t}\Big(\lambda_s\lVert \Delta^s_{i,t}\rVert_2^2 + \lambda_a\lVert \Delta^a_{i,t}\rVert_2^2\Big)
  16. Update ψ\psi by SGD on L\mathcal{L}.
Algorithm 2: Receding-horizon planning with KDP

Input: Current context cc; generator gψg_\psi; number of candidates KK; optional scorer JϕJ_\phi.

  1. Sample z1,…,zK∼N(0,I)z_1,\dots,z_K \sim \mathcal{N}(0,I).
  2. Generate candidates: x^(k)←Cc(gψ(zk,c))\hat{x}^{(k)} \gets \mathcal{C}_c(g_\psi(z_k,c)) for k=1,…,Kk=1,\dots,K.
  3. if JϕJ_\phi is available then
  4. Select x^∗←arg⁡max⁡kJϕ(x^(k),c)\hat{x}^{*} \gets \arg\max_k J_\phi(\hat{x}^{(k)},c).
  5. else
  6. Select x^∗←x^(1)\hat{x}^{*} \gets \hat{x}^{(1)}.
  7. end if
  8. Execute a←x^∗[0,ds:D]a \gets \hat{x}^{*}[0,d_s{:}D] and repeat at the next control cycle.
03

Quantitative results

KDP highlighted in pink

Scroll within a table to see all columns.

Short-horizon continuous control

Table 1. Short-horizon control on D4RL locomotion. ME: medium-expert; M: medium. Higher scores are better; fewer sequential network evaluations (NFE) are better.
Method HalfCheetah Hopper Walker2D Avg↑ NFE↓
MEM MEM MEM
Offline selection
BC55.242.652.552.9107.575.364.3–
CQL91.644.0105.458.5108.872.580.1–
IQL86.747.491.566.3109.678.380.0–
DT86.842.6107.667.6108.174.081.1–
TT95.046.9110.061.1101.979.082.3–
MOPO63.342.323.728.044.617.836.6–
MOReL53.342.1108.795.495.677.878.8–
MBOP105.944.655.148.870.241.060.9–
Generative trajectory planners
DQL96.869.1111.190.5110.187.091.15
CAC84.369.1100.480.7110.483.188.02
CBC32.731.090.671.7110.483.169.92
Diffuser88.942.8103.374.3106.979.682.620
KDP92.562.1103.690.3108.587.290.71
Table 2. Planning cost on one NVIDIA A100. D: Diffuser; UR: unranked; R: ranked. PL and E2E latency are in milliseconds per step.
Method NFE↓ BEF↓ PL E2E
BC111.011.22
D-UR(K=1, T=20)2020149.32149.51
D-R(K=16, T=20)20320172.16172.34
D-R(K=64, T=20)201280279.98280.03
KDP-UR(K=1)111.982.11
KDP-R(K=16)1323.974.10
KDP-R(K=64)11284.764.96

NFE Sequential network evaluations
BEF Batch-equivalent forwards
PL / E2E Planning / end-to-end latency
K / T Candidate trajectories / denoising steps

Long-horizon planning & objective ablations

Table 3. Long-horizon, goal-conditioned planning. UM: U-Maze; Med.: medium; Lar.: large. Planning latency (PL) is in seconds per step.
Method Maze2D AntMaze
UMMed.Lar.PL UMMed.PL
CQL5.75.012.5–84.053.7–
IQL47.434.958.6–62.270.0–
Diffuser113.9121.5123.03.84876.031.96.153
KDP122.3130.4133.00.03181.367.60.052
Table 4. Training objective ablations. Locom.: locomotion; Act. div.: action diversity.
Ablation Locom.↑ Maze2D↑ Act. div.↑
Full method (KDP)90.7128.20.93
No keying2.919.60.14
Include self-negatives78.0891.30.93
Attraction-only (no repulsion)1.053.72.2e6
No drift normalization86.93131.50.93
Single τ92.37102.10.93

Dexterous manipulation & action chunking

Table 5. Dexterous manipulation on Adroit. T is planning time in seconds.
Task Diffuser KDP
ScoreT(s) ScoreT(s)
pen-clone10.71.63453.40.020
door-clone56.71.59861.80.024
hammer-clone53.11.53279.60.034
relocate-clone56.21.68562.80.036
Table 6. Action chunking. L is the number of actions executed before replanning.
Task L Diff. KDP
adroit-pen138%57%
adroit-pen841%73%
adroit-hammer147%62%
adroit-hammer841%63%
adroit-relocate135%65%
adroit-relocate864%71%

Real-world closed-loop control

Table 7. Real-world closed-loop results on a Crazyflie and an SO-100 arm. Diffuser: K = 64, T = 20; KDP: K = 64. Planner and E2E p50 latency are in milliseconds.
Domain Method Succ. (%) TTS (s) Replan (Hz) Planner p50 E2E p50
NavigationDiffuser9212.54.1242312
Navigation KDP9412.038826
ManipulationDiffuser88353311410
Manipulation KDP903217947

Succ. Success rate
TTS Median time-to-success over successful trials
Replan Achieved replanning frequency
p50 Median latency

04

Experiments

Select a video to play

Locomotion

Navigation & dexterous manipulation

Real-world hardware

Navigation · 01Crazyflie
Navigation · 02Crazyflie
ManipulationSO-100 arm
05

Citation

@misc{puthumanaillam_keyed_drift_fields,
  title = {Amortizing Trajectory Diffusion with Keyed Drift Fields},
  author = {Puthumanaillam, Gokul and Ornik, Melkior},
  howpublished = {\url{https://keyed-drifting.github.io/}}
}