Corridor-Indexed Attention Temperature for Path-Relative Speed Planning

Learned driving planners decide how fast to go by attending over tokens: surrounding vehicles, pedestrians, map pieces, past frames. In a busy merge or a long highway lookahead, the number of such tokens can be several times larger than in the scenes the planner mostly trained on. Language-model research has shown a specific way this hurts. Softmax attention spreads its probability mass over every candidate key, so as the candidate count grows, the weight on the one token that matters shrinks toward uniform. This effect is called attention dilution. Rescaling the attention scores by a slowly growing function of the logarithm of the context length counteracts it. We propose to carry that fix into driving, but with one change that matters. In a planner that first picks a drive path and then chooses only how far to move along it, the "context length" that should set the attention temperature is not the total token count. It is the number of tokens that lie inside the path's corridor, measured in path-relative coordinates.

The core idea fits in two sentences. Express every scene token in coordinates relative to the planned path, as distance along it and offset from it, and let the speed decoder sharpen its attention according to the logarithm of how many tokens currently sit in its corridor. A planner trained on sparse traffic should then keep focusing on the vehicle it must brake for when deployed in dense traffic, instead of letting that vehicle's signal wash out among dozens of irrelevant ones.

Core Claim

We claim three things. First, current cascaded speed planners show measurable attention dilution on the safety-critical agent as corridor occupancy grows beyond the training distribution. Second, an inverse temperature indexed by log corridor occupancy removes most of this dilution and lowers collisions under density shift. Third, it does this better than indexing temperature by total token count, because tokens far outside the corridor add to the count without competing for the speed decoder's attention in any meaningful way.

The mechanism replaces the fixed $1/\sqrt{d_k}$ score scaling in the longitudinal decoder's attention layers, where $d_k$ is the key dimension, with

$$\beta_h(n) = a_h + b_h\,(\log n)^{\gamma}.$$

Here $h$ indexes the attention head, $a_h$ and $b_h$ are learned per-head scalars, $\gamma$ is a learned exponent initialized at $1/2$, and $n$ is the number of keys whose path-relative lateral offset $|d|$ is below a corridor half-width $w$ within the decoder's lookahead in $s$. The initialization comes from the theoretical floor proved in Modelling Attention with Aitchison Geometry. That paper shows inverse temperature must grow at least as $\sqrt{\log L}$ for the expected maximum attention weight over $L$ tokens not to vanish, and that over-scaling to $(\log L)^2$ causes entropy collapse and training instability. The functional form, including learnable per-head exponents, is taken from ASEntmax in Long-Context Generalization with Sparse Attention. There it is indexed by sequence position count in language models.

Why This Intersection

The four directions play different roles here. Path-relative coordinates, also called a Frenet frame (distance along a reference path $s$ and lateral offset $d$), provide the geometry that defines the corridor. Longitudinal-only control is the regime: the decoder outputs one-dimensional displacements along a fixed path. Logarithmic temperature scaling is the mechanism. Long-context attention theory tells us when and why dilution should appear.

The regime choice is motivated by AlignDrive. AlignDrive showed that predicting the drive path first and then predicting 1D longitudinal displacements along it fixes the coordination failures of parallel lateral and longitudinal heads, reaching a Bench2Drive Driving Score of 89.07. AlignDrive keeps standard attention, and its cross-attention is not expressed in the path's own coordinates. We keep its cascade and change what the speed decoder attends with.

The use of path-relative inputs is supported by two lines of work. Stay on Track wraps black-box predictors in lane-relative coordinates and cuts off-road predictions on Scene-Attack from 63.9% to 3.5% for LaneGCN. OPGP gets its collision reduction on the Waymo Open Motion Dataset by moving to the Frenet frame, but only in a downstream optimizer, after a Cartesian Transformer. Neither puts the frame inside attention. Neither asks how attention behaves as the number of in-path tokens changes.

On the temperature side, both Aitchison geometry and ASEntmax study only text and synthetic recall. They index temperature by raw token count, which assumes every token is a competitor. In a driving scene that assumption is plainly false, and the path-relative frame gives a principled way to count only competitors.

A Constraint, Not the Core: Friction Coupling

A longitudinal-only decoder invites the objection from Direction 2 that braking and cornering share tire grip. Imminent Collision Mitigation is the sharpest version: it shows braking alone is inadequate when time-to-collision falls between 0.5 s and 1.5 s.

We do not claim to solve evasive steering. Because the path is fixed before the speed profile is chosen, the friction circle reduces to a per-$s$ speed bound, $a_{\text{long}}^2 + (v^2\kappa(s))^2 \le (\mu g)^2$. Here $\kappa(s)$ is path curvature, $v$ is speed, $\mu$ is friction, and $g$ is gravity. We project the decoder's output onto this bound as a differentiable final layer, so that removing kinematic violations is not mistaken for an attention effect. Imminent-collision evasion stays out of scope, and we say so in the evaluation.

Research Program

The work proceeds in three stages.

The first stage is a diagnostic. We reimplement an AlignDrive-style cascaded planner and annotate, for each frame, the critical agent: the in-corridor agent that the expert's deceleration responds to, found by time-to-collision along $s$. We then measure, layer by layer, the speed decoder's maximum attention weight on that agent and its attention entropy, as functions of corridor occupancy $n$ and of total token count $N$. If the weight on the critical agent stays flat as $n$ rises past the training range, dilution is not a real problem in driving and the project stops here, with that negative result reported.

The second stage builds the corridor-indexed model. Scene tokens receive path-relative coordinates. Relative position along $s$ is encoded the way 1D sequence position is encoded in language models, so extrapolation along the path resembles length extrapolation. The temperature rule above is then added.

The third stage tests generalization under controlled density shift. Models train on low-occupancy scenes and are evaluated on scenes whose corridor occupancy exceeds the training maximum by two to four times. This is the driving analogue of the train-short, test-long protocol in ASEntmax.

We are candid about scale. Driving corridors hold tens to hundreds of tokens, not tens of thousands. The predicted gain in inverse temperature from occupancy 30 to 120 under $\sqrt{\log n}$ is only about 18%. The effect may be modest, which is why the diagnostic comes first and why the attention measurements are reported alongside driving metrics.

Baselines

The naive reference point is the same cascaded planner with fixed $1/\sqrt{d_k}$ scaling and Cartesian token features, trained on the same low-density split. It tells us how much density shift hurts at all.

The strongest existing method on closed-loop driving is AlignDrive. It reports a Driving Score of 89.07, a Success Rate of 73.18%, and a collision-rate reduction from 22.7% to 11.4% on Bench2Drive. We will report our method on the unmodified Bench2Drive protocol against these published figures. We will also retrain our AlignDrive reimplementation on our density-restricted training split, with the same backbone, data, epochs, and hyperparameter search budget as our model, and compare there. Beating it means a clear collision-rate reduction on the high-density evaluation slice without losing Driving Score on the standard protocol.

On open-loop planning, the strongest reference is OPGP. On the Waymo Open Motion Dataset it reports a collision rate of 3.018% and an off-route rate of 1.809%, against 7.575% collisions for vanilla imitation learning. No reported result was found on Lacuna for any planner on occupancy-stratified Waymo splits, so we will compute OPGP-style and baseline numbers on our splits ourselves.

Three ablations isolate the key ingredient. The first is ASEntmax-style temperature indexed by total token count $N$ rather than corridor occupancy $n$, with the same learnable form. This is the decisive ablation: if it matches our model, the path-relative corridor adds nothing. The second keeps path-relative inputs but uses fixed temperature, which is the Stay-on-Track idea moved inside the network. The third uses learned per-head temperatures that do not depend on length. All variants share code, data, compute, and tuning budget, and results are averaged over three seeds.

Why not just…?

Why not just train on dense scenes so no extrapolation is needed? This is a real threat. If the training distribution already covers deployment density, fixed temperature may suffice; AlignDrive's synthetic cut-in augmentation is a step in this direction. We answer it in two ways. We report the in-distribution diagnostic to show whether dilution exists even when density is covered. We also train an oracle that sees the full density range. If our low-density-trained model approaches the oracle on dense scenes while the fixed-temperature model does not, the method buys robustness that data coverage would otherwise have to supply. If the oracle gap is small for both, we will say that augmentation is the cheaper fix.

Why not just keep the k nearest agents and drop the rest? Hard cropping caps the number of attention candidates, so it removes dilution by construction. It is a strong baseline, and we include it with k tuned on validation. Its known weakness is that "nearest" in Euclidean distance is not "most relevant along my path." A fast vehicle 80 m ahead in the corridor can matter more than a parked car 10 m to the side. We expect cropping to miss critical agents on curved and high-speed routes, and we will measure how often the annotated critical agent falls outside the top-k set.

Why not just use the Frenet wrapper from Stay on Track? That wrapper changes inputs and outputs but leaves attention untouched, and it requires one forward pass per candidate lane. Our third ablation is essentially this design inside a single cascaded model. If it closes the gap to the full method, temperature indexing is unnecessary and the gain comes from coordinates alone.

Why not just use ASEntmax as published? Sparse attention can zero out irrelevant keys and might make occupancy-based counting moot. It also adds threshold-computation overhead, which ASEntmax itself acknowledges. We run ASEntmax indexed by total count as a baseline, and also an entmax variant with corridor indexing, so the comparison separates sparsity from the choice of count.

Proposed Experiments

On the Waymo Open Motion Dataset we stratify scenes by corridor occupancy along the expert path. We train on the lower occupancy band and evaluate on progressively higher bands. Metrics are collision rate, off-route rate, and jerk, as in OPGP, plus the attention weight on the critical agent.

On Scene-Attack, built on Argoverse, we check that path-relative attention keeps the off-road robustness that Stay on Track reports: 3.5% off-road rate for LaneGCN on Double Turn and 3.6% for Multipath++ on Single Turn.

On Bench2Drive we report the official Driving Score, Success Rate, Efficiency, and Comfortness. We also report per-skill results on merging, cut-in, and overtaking, where the best overtaking success among the benchmark's original baselines was 26.38%. As a clearly labeled supplementary stress set, we add the same routes with extra CARLA traffic spawned.

Three outcomes decide the project. The first is the diagnostic curve: critical-agent attention weight against occupancy for fixed temperature, total-count temperature, and corridor-count temperature. The method is supported only if fixed temperature decays, corridor indexing stays flat, and total-count indexing falls in between or over-sharpens. The second is whether the high-density collision gap between corridor and total-count indexing exceeds seed variance. The third is whether the learned exponent $\gamma$ settles near the $1/2$ floor predicted by Aitchison geometry. If it does, that theory transfers to learned, non-Gaussian driving attention. If it drifts far away, that is itself an informative finding.