---
title: Variable Horizon Diffuser (VHD)
url: https://www.emergentmind.com/topics/variable-horizon-diffuser-vhd
type: topic
---

# Variable Horizon Diffuser (VHD)

Variable Horizon Diffuser (VHD), introduced as **VH-Diffuser**, is a diffusion-based framework for **time-aware goal-conditioned trajectory planning** that replaces the fixed planning horizon used by most prior diffusion planners with an **instance-specific learned horizon**. The framework addresses the observation that the optimal trajectory length between a start state and a goal state varies substantially with geometric and dynamical difficulty, so a single pre-specified horizon can induce **length mismatch**, producing trajectories that are too short or too long. VHD therefore combines a **Trajectory Length Predictor** with a **Variable-Horizon Diffusion Planner**: given a start-goal pair, it first estimates a shortest-step length and then generates a trajectory of the desired length by controlling the shape of the initial diffusion noise, while keeping the planner backbone unchanged and training entirely from offline data [2509.11930].

## 1. Problem formulation and conceptual basis

VHD is motivated by a structural limitation of diffusion-based planners for long-horizon control: although such planners have shown robustness and strong performance, they are commonly trained and evaluated with a **fixed, pre-specified horizon**. In settings where trajectory length varies widely across instances, this rigidity can degrade planning quality through **under-shooting** or **over-shooting** the goal, and can also make performance brittle when the task difficulty changes from one start-goal pair to another [2509.11930].

The framework’s central idea is to treat the **trajectory horizon as a learned variable rather than a fixed hyperparameter**. In the VHD formulation, the target quantity is the **shortest-step distance** between start and goal, denoted $D^\star(s,g)$, defined as
$$
D^{\star}(s,g) = \inf\big\{k \in \mathbb{N}_{\geq 0} \mid \exists \tau \text{ of length } k+1: s_0=s, s_k \in \mathcal{G}_\epsilon(g)\big\},
$$
where $\mathcal{G}_\epsilon(g)$ is a goal region. This quantity serves as the semantic notion of horizon: it is not merely a rollout length selected for computational convenience, but an estimate of the minimal number of steps needed to reach the goal under the task geometry.

A useful way to situate VHD is to regard it as a **goal-conditioned horizon adaptation mechanism** for diffusion planning. The planner does not alter the denoising backbone, inject explicit length tokens, or add special embeddings for horizon control. Instead, it converts a start-goal pair into a predicted horizon and uses that prediction to determine the length of the trajectory to be denoised.

## 2. Trajectory Length Predictor

The **Trajectory Length Predictor** estimates the minimal number of steps between a start state $s$ and a goal state $g$ using **only observations**, not actions or rewards [2509.11930]. Its architecture begins by encoding both $s$ and $g$ with **randomized Fourier features (RFF)**:
$$
\Phi(x) = \bigl[ \sin(2\pi xB),\, \cos(2\pi xB),\, x \bigr],
$$
where $B$ is a fixed random Gaussian matrix. The joint feature is then
$$
z(s,g) = [\Phi(s),\,\Phi(g),\,\Phi(s)-\Phi(g)].
$$

This feature vector is processed by a multilayer perceptron with normalization and ReLU layers, and the scalar output is passed through a softplus:
$$
f_\theta(s, g) = \text{softplus}(\text{MLP}(z(s, g))).
$$
The model predicts a **normalized step distance**
$$
\tilde{D}(s,g) = D^{\star}(s, g)/T_{\max},
$$
placing the target in $[0,1]$.

A central technical difficulty is that offline datasets rarely cover all possible $(s,g)$ pairs, particularly **cross-trajectory pairs**. VHD addresses this with a **hybrid supervision** scheme comprising three components. First, it uses **exact intra-trajectory anchors**, where two states appearing in the same trajectory provide an observed step distance. Second, it imposes **dynamic programming upper bounds** through
$$
D^{\star}(s,g) \leq k + D^{\star}(s_k, g),
$$
which yields a normalized target of $\min\big(k/T_{\max} + \tilde D(s_k, g), 1\big)$. Third, it enforces **relay-based triangle inequalities** across trajectories:
$$
D^{\star}(s,g) \leq D^{\star}(s, h) + D^{\star}(h, g),
$$
where the relay state $h$ may be sampled from on-trajectory successors such as $s_k$ or from off-trajectory states in a minibatch or global pool.

The full training objective is a weighted sum of a pointwise Huber regression term, one-sided hinge penalties for dynamic-programming and triangle-inequality consistency, and boundary and clipping regularizers:
$$
\mathcal{L} = \mathcal{L}_{TD} + \lambda_{cons}\mathcal{L}_{cons} + \lambda_{\triangle}\mathcal{L}_{\triangle} + \lambda_{bdry}\mathcal{L}_{bdry} + \lambda_{clip}\mathcal{L}_{clip}.
$$
The paper also specifies that an **EMA (Exponential Moving Average)** of the predictor parameters is used to stabilize targets, and that training follows a **curriculum**: it begins with anchor-only supervision and gradually increases the dynamic-programming and triangle terms for harder, longer-range pairs [2509.11930].

## 3. Variable-horizon control within diffusion planning

The planner side of VHD implements variable horizon control **without architectural changes** to the diffusion backbone. The key mechanism is that the predicted length $\hat{L}$ determines the shape of the initial Gaussian noise tensor, $\mathcal{N}(0, I)^{\hat{L}\times d}$, and therefore the length of the denoised trajectory [2509.11930].

At inference time, the horizon is obtained from the predictor as
$$
\hat{L} = \text{clip}(\gamma \cdot (f_\theta(s,g) \cdot T_{max} + 1), L_{min}, T_{max}),
$$
where $\gamma$ is a scaling factor providing a safety margin and clipping ensures a valid length range. The diffusion planner then denoises a trajectory of that length while **clamping the first and last state** to the start and goal at each denoising step.

This design has several important properties that distinguish VHD from approaches that encode horizon through explicit architectural conditioning. The planner backbone—examples given include **Diffuser** and **Decision Diffuser**—is unchanged. There are **no extra input channels, conditioning tokens, or special embeddings for length**. Horizon control is delegated entirely to two procedural choices: training on variable-length crops and choosing the initial noise shape at test time.

A recurrent misconception in diffusion planning is that variable-length generation necessarily requires a new decoder, a hierarchical controller, or bespoke conditioning machinery. VHD provides a counterexample: the model retains the standard planner structure and instead makes the **trajectory tensor itself** the locus of horizon control. This suggests that, in diffusion-based planning, output-length adaptation can be handled at the level of training data exposure and sampling geometry rather than network architecture.

## 4. Training and inference procedures

VHD is trained by **sampling random-length sub-trajectories** from offline demonstrations. For each training trajectory, a random starting index is selected, together with a random length
$$
L \sim \mathcal{U}(L_{min}, T_{max}),
$$
and the corresponding crop is used as the training target [2509.11930]. The diffusion objective remains the standard **$\epsilon$-prediction loss**, namely mean squared error between predicted and injected noise.

This cropping procedure serves three functions stated in the paper. It exposes the planner to a **range of horizon lengths** during training, prevents overfitting to a single fixed horizon, and supports generalization to **unseen trajectory lengths** at test time. During inference, the process is correspondingly simple: predict $\hat{L}$ from the start-goal pair, sample noise of shape $\hat{L}\times d$, run the standard denoising process with boundary conditioning, and return a trajectory of length $\hat{L}$.

The training and sampling workflow is therefore modular. The predictor learns an approximate geodesic or shortest-step length from offline state observations; the diffusion planner learns to denoise sub-trajectories of varying length; and the two components are composed at test time through the initial noise tensor. The paper characterizes this as keeping training **simple and offline-only** [2509.11930].

An important empirical and methodological point is that **variable-length inference alone is not sufficient**. The reported ablation “FH+LP,” described as a fixed-horizon-trained model given variable lengths at test time, could not match VHD’s performance. This establishes that the random-crop training distribution is not an implementation detail but a core ingredient of the method.

## 5. Empirical evaluation

VHD is evaluated on **five goal-conditioned benchmarks**: **D4RL Maze2d-{umaze, medium, large}**, **AntMaze (OGBench variant; 8-DoF ant robot)**, and **Cube robot arm control (6-DoF UR5e end-effector positioning)** [2509.11930]. Two evaluation protocols are used: **Single-Shot (SS)**, where the plan is generated once and executed directly, and **Replan-on-Deviation (RP)**, where replanning is triggered when tracking error exceeds a threshold. The reported metrics are **Success Rate (SR)** and **Average Executed Steps (AES)**.

Across these benchmarks, the main comparison is against the best fixed-horizon baseline, denoted **FH-H_best**. In **Single-Shot**, VHD obtains **97.1%** success with **112.7** AES on Maze2d-umaze, **93.1%** with **230.0** AES on Maze2d-medium, **91.0%** with **245.8** AES on Maze2d-large, **82.2%** with **152.8** AES on AntMaze, and **86.9%** with **50.9** AES on Cube. The corresponding FH-H_best figures are **96.0% (140.6)**, **94.5% (243.8)**, **93.8% (319.3)**, **79.9% (307.3)**, and **87.0% (111.1)** [2509.11930].

In **Replan-on-Deviation**, VHD reports **100% (140.0)** on Maze2d-umaze, **98.7% (320.0)** on Maze2d-medium, **99.6% (285.7)** on Maze2d-large, **95.7% (518.3)** on AntMaze, and **98.2% (77.5)** on Cube. FH-H_best reports **99.4% (163.2)**, **97.2% (372.1)**, **99.6% (427.0)**, **91.6% (994.6)**, and **97.9% (87.5)**, respectively [2509.11930].

The paper’s own summary is that VHD **consistently achieves either the best or second-best success rates and executed steps**, and that its gains are particularly clear in **Replan-on-Deviation**, where horizon mismatch is likely to recur as the residual distance changes over time. The AntMaze RP result is especially illustrative: **95.7%** versus **91.6%** for the best fixed-horizon model, with nearly half the executed steps. The qualitative interpretation offered in the paper is that VHD adapts its planned segment length to the residual distance, whereas fixed-horizon planners can **detour, dither, or fail** when the horizon is ill-suited to the current phase of the task.

These results support a specific conclusion: VHD’s benefit is not only higher terminal success, but also improved **path efficiency**, as reflected by lower AES in many settings. This suggests that adaptive horizon selection changes not just whether the goal is reached, but how directly the agent reaches it.

## 6. Relation to other horizon-flexible diffusion planners

Within diffusion planning, VHD occupies a distinct position relative to other methods that address long-horizon or variable-resolution planning. **HM-Diffuser** addresses **extendable long-horizon planning** by combining **Progressive Trajectory Extension (PTE)**, hierarchical planning across multiple temporal scales, **Adaptive Plan Pondering (APP)**, and a **Recursive HM-Diffuser** that collapses hierarchical levels into a single level-conditioned model [2503.20102]. By contrast, VHD does not introduce a hierarchical temporal abstraction or synthetic long-trajectory stitching pipeline; its intervention is narrower and more local, namely **instance-specific horizon selection** for a standard diffusion backbone.

A second nearby line is **Mixed Density Diffuser (MDD)**, which introduces **non-uniform temporal resolution** through a tunable vector of per-step jumps $\{K_i\}$ and is implemented as a **single, non-hierarchical (flat)** diffusion policy [2510.23026]. The MDD summary explicitly notes that it can be viewed as a *special case of a Variable Horizon Diffuser* in the sense that it provides per-step user control over which parts of a trajectory are modeled densely or sparsely. VHD, however, is formulated around a different control variable: it predicts the **overall trajectory length** $\hat{L}$ from the start-goal pair rather than fixing a mixed-density schedule as a hyperparameter.

These distinctions matter because “variable horizon” can refer to at least three different ideas in the diffusion-planning literature. One is **extendability beyond training lengths**, emphasized by HM-Diffuser. Another is **non-uniform temporal density within a trajectory**, emphasized by MDD. VHD is centered on **predicting an appropriate total horizon for each planning instance**. A plausible implication is that these mechanisms are complementary rather than mutually exclusive: a planner could, in principle, combine instance-specific total length selection with hierarchical decomposition or mixed-density allocation. The provided materials, however, do not report such a hybrid system.

## 7. Significance, limitations, and interpretation

VHD’s main significance lies in showing that **horizon adaptivity** can be introduced into diffusion planning with **minimal code modifications** and without altering the planner architecture [2509.11930]. The framework reduces the dependence on a fixed horizon hyperparameter, improves robustness to **horizon mismatch** and **unseen lengths**, and preserves compatibility with existing diffusion planners through boundary conditioning and initial noise shaping.

Its design also sharpens the separation between two learning problems that are often conflated: estimating **how long** a plan should be, and generating **what sequence** should realize that plan. VHD assigns the first problem to the Length Predictor and the second to the diffusion model. This decomposition is technically consequential because it allows the diffusion model to remain standard while still producing variable-length outputs.

At the same time, the paper does not claim that the predictor computes an exact geodesic; it describes the target as a **per-instance shortest-step distance** or an **approximate geodesic length** learned from offline data. The use of dynamic-programming and triangle-inequality upper bounds, together with EMA-stabilized targets and a curriculum, indicates that horizon estimation is itself a nontrivial approximation problem under limited coverage. This suggests that VHD’s performance depends not only on the diffusion planner but also on the quality of this learned distance surrogate.

More broadly, VHD contributes to a reorientation of diffusion-based planning away from treating horizon as a static experimental setting and toward treating it as a **state- and goal-dependent planning variable**. In that sense, it reframes horizon selection from a hyperparameter-tuning issue into part of the learned planning problem itself.

Source: https://www.emergentmind.com/topics/variable-horizon-diffuser-vhd