Distill the Automaton, Not the Path: Privileged Logical Supervision for Layout-Robust Sparse-Reward Agents

Agents trained in simulation often have access to information they will not have when deployed: exact object identities, positions, and which doors have been opened. The standard way to use this information is to train a "teacher" policy that sees it and then train a "student" policy that only sees camera or sensor input to copy the teacher's actions. This works well for locomotion. It fails in a specific way on long, multi-stage tasks where reward comes only at the end. The teacher's actions encode one route through one layout, so the student learns to memorize routes. When the layout changes, for example when a corridor is blocked, the student fails. We propose to distill something different. Instead of copying the teacher's actions, the student learns the teacher's task bookkeeping: which stage of the task it is in, which causal preconditions it has satisfied, and whether its situation has become hopeless. That bookkeeping is computed exactly in simulation from a small automaton built from the task and from temporal causal rules. Because it does not depend on coordinates, it should transfer across layouts in a way that actions do not.

In two sentences: the privileged channel supervises the student's belief over a layout-independent logical state, plus a "you are doomed" signal, and never its actions. The student then learns its own behavior by reinforcement learning, using rewards shaped from that belief. We test whether this closes the generalization gap under controlled layout interventions, where action distillation and recurrent baselines are known or suspected to collapse.

Core Claim

Three lines of work each solve one piece of the problem. Reward machines are finite automata whose states track progress through a reward specification. They turn sparse non-Markovian rewards into dense learning signals through counterfactual experience and automaton-level potential shaping: Reward Machines reports 9 laps per episode on a HalfCheetah lap task where plain DDPG stayed at random after 30 million steps. Corazza et al. add environmental causal rules written in temporal logic, such as "the door cannot open unless the key was picked up earlier." They compile these rules into a causal automaton, take its product with the task automaton, and prune "rejecting sink" states from which reward is provably unreachable (NeurIPS 2023, CLeaR 2024). All of this assumes the agent observes the true symbolic events, and the experiments use fixed toy grids. Visual Reward Machines removes the oracle by learning a pixel-to-symbol grounder jointly with a differentiable automaton, but only from task reward and only on a single layout. These papers supply the method we reuse.

Two papers motivate the change of distillation target. Privileged, but Biased shows, for language-model self-distillation, that teachers conditioned on a reference solution favor that one solution: their bias score is 0.52 for the reference and at most 0.02 for alternative correct solutions, and validation accuracy degrades even as training loss falls. CompassNav shows that path imitation in navigation produces route memorization. Its fix is to score all feasible moves with geodesic distance, but that score cannot express ordering constraints. MapShift shows how much this matters: same-environment testing understates the advantage of belief-updating agents by 3x under topology shifts and 7x under semantic shifts.

Our claim is that the right privileged target for sparse, ordered, spatially variable tasks is a quantity defined on the product of the task automaton and the causal automaton. Such targets are invariant to geometry by construction, and supervising them does not penalize any valid route.

Research Program

What the simulator computes for free. In simulation, privileged state yields the true propositional events at each step, such as key_held, door_A_open, and in_hazard. Running the task automaton and the causal automaton on these events gives the exact product state $q_t$.

Value iteration on the product graph, as in Corazza et al., gives a potential $V^*(q)$ for each automaton state. This number reflects how close the agent is to reward in logical terms, regardless of where it stands in the map.

We add one ingredient that requires privileged geometry: a "doomed" label $d_t$. A privileged reachability check on the current layout computes it. It is true when no continuation from the current physical and automaton state can reach reward. Examples are an agent that crossed a one-way door without the key, or one whose only corridor to the goal was blocked by an intervention. Static rejecting sinks in a causal diagram are a special case of this label. The extension covers layout-specific dead ends that no hand-written rule anticipates.

The student. The student sees only egocentric observations: partial-view MiniGrid images or first-person RGB. It has a perception encoder, a small differentiable automaton head in the style of Visual Reward Machines that outputs a belief $b_t$ over product states, a doom predictor $\hat d_t$, and an actor-critic policy that takes $b_t$ and the current observation as input. The automaton's transition structure is given by the compiled product. Only the grounding from observations to events is learned, and it is learned with privileged labels rather than from reward alone.

The training objective is

$$ \mathcal{L} = \mathcal{L}_{\text{RL}}\big(r_t + \gamma\,\Phi(b_{t+1}) - \Phi(b_t)\big) + \lambda\,\mathrm{CE}(b_t, q_t) + \mu\,\mathrm{BCE}(\hat d_t, d_t), \qquad \Phi(b) = \sum_q b(q)\,V^*(q). $$

The symbols are as follows. $r_t$ is the sparse task reward. $\gamma$ is the discount factor. $\Phi$ is the student's expected automaton potential under its own belief. CE and BCE are cross-entropy and binary cross-entropy against the privileged labels. $\lambda$ and $\mu$ are loss weights.

The shaping term is potential-based, with a potential that depends only on the student's observation history. The intent is that it changes the speed of learning, not which behavior is optimal. Whether that guarantee survives belief error is something we check empirically rather than assume.

During training, episodes whose true doom label becomes 1 are cut off, as in pessimistic pruning. At test time, the student's own predicted doom $\hat d_t$ drives backtracking. This echoes the progress-stall rollback of The Regretful Agent, but it is triggered by a logical signal instead of a learned progress heuristic.

Crucially, there is no action-imitation term anywhere in the objective. The student is told what situation it is in, never what to do.

Analysis. For every condition we measure three things: belief accuracy, doom-prediction AUC, and success, each broken down by intervention type. This separates two failure modes. Perception can fail, meaning the student misreads what happened. Control can fail, meaning the student knows the state but has learned a layout-bound behavior.

Baselines

The naive reference is PPO with a recurrent policy on the sparse reward alone, trained over randomized layouts. Reward Translation via Reward Machine reports that standard PPO fails completely on sparse Ant navigation, so we expect near-zero success on multi-stage tasks. It anchors the scale.

The first strong competitor is action distillation from a privileged teacher. The teacher is an RL policy that sees full state plus the true automaton state, trained with Corazza-style product shaping and pruning. It is distilled into the sensor-only student with on-policy, DAgger-style KL on actions, as in RMA (RMA) and the policy mimicry of Sim-Real Joint Reinforcement Transfer. This is the dominant recipe in practice.

The second strong competitor is an asymmetric actor-critic. A privileged critic sees full state; the sensor-only actor is trained against it with the same CompassNav-style dense shaping, here geodesic distance to the next automaton subgoal computed from privileged geometry. This competitor uses privileged information only for training-time reward and value, so it does not anchor to a trajectory. It is the real threat, discussed below.

Two further references come from the reward-machine line. One is a Visual Reward Machine trained end-to-end from reward without privileged labels. The other is an oracle-symbol agent from Corazza et al., which uses true events at test time and gives an upper bound.

The key ablations are:

  • dropping the doom head,
  • replacing the product automaton with the task automaton alone, which removes the causal rules,
  • adding an action-distillation term back in, which tests whether action supervision actively hurts under shift.

Fairness. All methods share the same encoder architecture, environment-step budget, layout-randomization distribution, and a matched hyperparameter search of equal trial count. The teacher's training steps are counted against the distillation baselines' budget.

What counts as winning. We beat the field if we exceed the asymmetric shaped critic and the action-distilled student on post-intervention success under topology shifts by a margin outside seed-level confidence intervals, while matching them on unshifted layouts.

There is no reported result on Lacuna for any of these baselines on MapShift or on the Corazza gridworlds with layout shifts. The closest anchors are partial. MapShift reports a belief-updating versus stale-map gap of Δ = 0.724 under semantic shifts, against 0.102 under standard evaluation. Corazza et al. report near-optimal reward within about $10^4$ steps on Coffee vs. Soda with oracle symbols. Visual Reward Machines reports 40% sequence-classification accuracy for a CNN+LSTM, against near-perfect accuracy for the structured machine.

Why not just…?

Why not just distill the privileged teacher's actions with heavy layout randomization? If randomization covers the test layouts, this may well work, and that would mean our gain comes only from extrapolation. The concern is shift beyond the randomized family. Privileged, but Biased and CompassNav both show that single-path supervision penalizes valid alternatives, and a MapShift corridor blocker forces exactly such an alternative. We therefore hold out intervention types, not just layouts. The ablation that adds action distillation to our method shows directly whether action supervision helps or harms once the teacher's route no longer exists.

Why not just use a privileged critic with geodesic shaping to the next subgoal? This is the most serious alternative. It densifies reward without imitation, and given a recurrent actor it might learn the automaton state implicitly. Our bet is that implicit state tracking under sparse, temporally imbalanced events is unreliable. Visual Reward Machines' 40% CNN+LSTM result is the evidence, though in a different setting. A second weakness is that geodesic potentials go stale when topology changes. If this baseline matches us on held-out interventions, the honest conclusion is that explicit belief supervision is unnecessary. The comparison is designed so that this outcome is legible: we report its belief-probe accuracy alongside ours.

Why not just learn the reward machine grounding end-to-end, as Visual Reward Machines does? Doing so needs no privileged labels, which would be simpler. But grounding learned from reward alone is fit to one layout's visual statistics and receives very weak signal on rare events. The VRM-without-labels baseline measures exactly how much the privileged event labels add, separately from the automaton structure itself.

Proposed Experiments

We use three testbeds.

The first is MapShift's 24 layout motifs with its MiniGrid adapter. Its health gates guarantee that post-intervention tasks are solvable, with reference solvability of 1.000. We overlay ordered tasks with causal rules (key-before-door, one-way passages, avoid-hazard-until-tool) and train on base layouts. We evaluate after topology, metric, dynamics, and semantic interventions. Semantic interventions also test grounding: a remapped token color should break the event detector, and we measure whether belief accuracy predicts the success drop.

The second is the Two-Doors, Four-Doors, and Office tasks of Corazza et al. With procedural layout randomization and held-out geometries, they let us compare directly with the oracle-symbol causal agents.

The third is Visual Minecraft, which tests pixel grounding.

The metrics are:

  • success rate and steps to first success;
  • post-minus-pre intervention success, following MapShift's controlled post-intervention protocol;
  • belief accuracy and doom AUC;
  • shaping-induced suboptimality, measured as path length relative to the privileged planner on solved episodes.

Three checks decide the outcome. The first is whether our student's post-intervention success under topology shifts exceeds the asymmetric shaped-critic baseline with comparable pre-intervention success. If it does not, the core claim fails. The second is whether removing the doom head specifically erases the topology-shift gain while leaving unshifted performance intact. This would show that the causal "hopelessness" signal, not stage tracking alone, drives recovery. The third is whether adding action distillation lowers post-intervention success, which would be the embodied analogue of the bias trap. A null on the third check would still be informative, because it would mean the trap seen in language models does not carry over to navigation with automaton-structured supervision.