A Contact Grammar for Checking Learned Insertion Policies Before They Reach the Compliance Controller

Learned robot policies for contact-rich work, such as plugging in a USB stick, seating a gear, or pushing a peg into a hole, now reach useful success rates. They still fail in a characteristic way: the network claims a task is done when it is not. The FAVLA authors report that their policy "occasionally misinterprets high misalignment forces as successful insertion cues," which leads to false completions or jamming (FAVLA). Natural language processing has dealt with the same kind of failure for years. Sequence taggers produce label sequences that break the annotation grammar, for example an "inside an entity" tag with no "begin" tag before it. A small deterministic pass that enforces the grammar after the model runs fixes these errors cheaply and reliably (Named Entity Recognition for Chinese biomedical patents). We propose to bring that same move to manipulation. We would place a short, physically grounded rule layer between a learned policy and an admittance controller, which is a low-level loop that makes a stiff robot behave like a virtual mass, spring and damper by converting measured contact forces into small position offsets.

The rule layer reads force, torque and insertion depth, and labels the current contact phase: free motion, impact, search, sliding, seated, or jammed. It checks every policy output against a grammar of legal phase transitions. Two examples: "release and retract" is legal only from "seated," and "seated" cannot directly follow "jammed." When a check fails, the layer does more than stop the robot. It responds inside the compliance controller, changing the virtual stiffness and damping and reshaping the commanded trajectory. Put in two sentences, the network proposes what to do, and a small, readable grammar of contact physics decides whether the claim is physically plausible. Recovery then happens through the compliance controller rather than through the network.

Core Claim

We claim that a task-family-level rule layer, with roughly a dozen rules whose thresholds are expressed in geometric quantities such as hole clearance and seating depth, can remove most false-completion and jamming failures of a learned force-aware policy. We also claim it can do so without per-task tuning and with a low rate of unnecessary interventions. The new element is not that rules exist above a controller. It is that the rules act as a validator of the learned policy's outputs, and that each violation triggers a joint correction of both the commanded trajectory and the admittance parameters $M$, $D$, $K$ (virtual mass, damping and stiffness matrices). The design borrows the transition-grammar logic of sequence-labeling post-processing. Prior work in the file corrects either trajectories or parameters, never both (Active Admittance Control with Iterative Learning versus Admittance Visuomotor Policy Learning), and no prior work verifies a learned policy's implicit completion claims.

Where This Sits

Three bodies of prior work motivate the gap. AdmitDiff feeds a diffusion policy's planned poses and forces straight into an admittance controller with fixed, hand-set parameters and no check between the two (Admittance Visuomotor Policy Learning). ForceVLA (ForceVLA) and FAVLA (FAVLA) drop the admittance loop altogether and ask the network to output compliant poses itself. FAVLA documents the false-completion failure that our grammar targets. PolyFit shows that learned pose estimates of 0.48 to 3.91 mm often exceed sub-millimetre clearances, and that insertion then runs without a supervised compliant phase (PolyFit). In all three, a learned output reaches the hardware unchecked.

Two works come closest, and both constrain the design. Gao et al. detect force anomalies during periodic wiping using a learned force-distribution model, then apply one fixed rule: drop stiffness to 2% within 300 ms and recover at a fixed rate (Learning Compliance Adaptation in Contact-Rich Manipulation). They state that the method does not extend to non-periodic multi-step tasks. Our layer differs in three ways: it reasons over a multi-phase grammar, it targets non-periodic insertion, and its response depends on the phase. Sun et al. filter admittance motion through control barrier functions solved as a quadratic program, which are smooth inequality constraints on position (Adaptive Admittance Control for Safety-Critical Physical Human Robot Collaboration). That approach cannot express conditional, non-smooth statements such as "if lateral force is high and depth has stalled, the part is jammed." Our layer could sit next to such a filter rather than replace it. The iterative-learning approach of Active Admittance Control with Iterative Learning tunes $m, b, k$ across 750 repeated identical trials. Ours acts within a single execution and needs no repetition.

The NLP side supplies the method and also a warning. Grammar repair of tag sequences (Named Entity Recognition for Chinese biomedical patents), hierarchical constraints where coarse labels restrict fine ones (AMS_ADRN at SemEval-2022 Task 5), and targeted recovery of missed items that raised F1 by 13 to 14 points (Key Information Extraction in Purchase Documents) map onto, respectively, our phase grammar, phase-conditioned compliance, and jam recovery. That literature also records the known failure modes of such layers: brittleness across domains and over-correction of valid outputs. We therefore treat transfer and unnecessary interventions as primary measured quantities, not afterthoughts.

Research Program

We would build the system in three parts.

The first part is a deterministic phase labeler. It runs at the force-sensor rate and uses the measured wrench (force and torque), axial depth relative to the target frame, and axial velocity. The phase rules use thresholds scaled by the task's clearance $c$ and seating depth $d_s$. For example, "seated" requires depth at least $0.9\,d_s$ together with rising axial force and low lateral force. "Jammed" requires high axial force, no depth progress over a short window, and lateral force or torque above a clearance-scaled bound.

The second part is the transition grammar plus output checks. Each policy action is mapped to the phase it implies: releasing the gripper or retracting implies "seated," and pushing downward implies "sliding" is legal. Actions whose implied phase is not reachable from the current labeled phase are rejected. A second check limits the per-step change in the nominal setpoint, which mirrors span-boundary trimming in NLP.

The third part is a correction table indexed by phase. Each phase carries its own $(M_i, D_i, K_i)$, so search uses low lateral stiffness and sliding uses high axial damping. Each violation type carries a corrective trajectory primitive: jam leads to an axial back-off and a small lateral dither, and a false completion leads to holding position and continuing the axial push under admittance.

Switching parameters can inject energy and destabilize contact, which is a known risk for admittance control on stiff surfaces. We therefore gate every switch on the stored virtual energy

$$E = \tfrac{1}{2}\Delta\dot{x}^\top M \Delta\dot{x} + \tfrac{1}{2}\Delta x^\top K \Delta x,$$

where $\Delta x$ is the offset from the nominal trajectory. A switch that increases stiffness is applied only if it does not raise $E$, or it is ramped until the condition holds. Switches that decrease stiffness are always allowed. This gate is a conservative engineering choice, not a full passivity proof.

The learned policy underneath is an AdmitDiff-style diffusion policy that outputs poses and forces for the admittance loop. We reimplement it ourselves because the file gives no released code. The rule layer itself is about the size of a short configuration file, and the same rule file is used across all tasks within the insertion family.

Baselines

The naive reference is the learned policy driving fixed-parameter admittance control with no rule layer. This is AdmitDiff's architecture (Admittance Visuomotor Policy Learning), which reports a 15.3% average success gain and a 48.8% contact-force reduction over its baselines. We train it once and reuse the identical checkpoint for every rule-layer variant, so any difference comes only from the layer.

The strongest existing system on these tasks is FAVLA. It reports 80.8% average success on USB insertion, gear assembly, box flipping and board wiping. In the same study ForceVLA reaches 67.0% and vision-only $\pi_0$ reaches 42.8%, and peak gear-assembly force drops from 12.0 N to 7.7 N (FAVLA). We cannot run FAVLA on its original Monte robot, so we treat 80.8% as an external reference only. On our own hardware we fine-tune a ForceVLA-style force-aware policy (ForceVLA, 60.5% average and 80% on plug insertion in its own paper) using the same demonstrations and the same GPU-hour budget as our policy. Beating it means higher success on the insertion tasks with a false-completion rate at least halved and peak force no higher.

The most dangerous baseline is classical. It is a hand-written insertion state machine with phase-switched admittance and no learned policy at all, which is common industrial practice. It receives the same rule file plus a scripted approach. If it matches the hybrid, the learned policy adds nothing and we will report that result.

A second comparison isolates the cost of rules against data. We fine-tune the learned policy on additional demonstrations containing jams and false completions, with collection effort matched to the time spent writing the rules.

We also run four ablations. A trajectory-only variant corrects setpoints but keeps admittance parameters fixed, and a parameter-only variant switches parameters but leaves trajectories untouched; together they test the claim that both are needed. A veto-only variant stops on violation without correcting. A random-intervention variant intervenes at the matched rate but at random times; it checks that gains do not come merely from slowing the robot down.

For each variant, "beats" means a statistically separated success rate over at least 50 trials per task, together with an intervention precision above 0.8 in simulation.

Why not just…?

Why not just fine-tune the policy on failure data? This is a real competitor, and the NLP evidence alone does not settle it for robots. Rule post-processing beat expensive fine-tuning in Ukrainian NER, where fine-tuned Gemma-3-27B reached 0.888 F1 against 0.890 for a smaller encoder and rules gave further gains (Improving NER for Low-Resource Languages), but that is not robot evidence. The matched-effort fine-tuning baseline above settles it directly. One structural argument favors rules: a false completion depends on a few force signals that the network learned to read ambiguously, while a rule on depth plus force signature is not ambiguous. If fine-tuning closes the gap, the honest conclusion is that rules are only a faster way to obtain the same fix.

Why not just write a classical state machine and skip the learned policy? For a single known peg geometry this may work as well, and we expect it to be competitive on simple round-peg insertion. It weakens where alignment needs perception. PolyFit shows that blind spiral search reaches only 18.3% and 17.5% on polygonal pegs, against 85 to 87% with learned pose estimation (PolyFit). Our claim is narrower: learning handles alignment, and rules handle verification. The state-machine baseline across varied geometries tests exactly that division of labor.

Why not just use a barrier-function safety filter or a force threshold that aborts? Smooth barriers bound positions and forces well, as Sun et al. show in a planar simulation. They do not detect a false completion, because a falsely "completed" state can sit comfortably inside every force bound. A plain abort threshold reduces peak force but turns jams into failures rather than recoveries. The veto-only ablation measures exactly this difference, and we include a force-clipping filter alongside it.

Why not learn the phase labeler instead of writing rules? A learned classifier might label phases more accurately on familiar data, but it brings back the very ambiguity we are trying to remove. We swap in a classifier trained on the same labeled phases and compare transfer to held-out geometries. The prediction is that rules transfer better because their thresholds scale with clearance. If they do not, the learned labeler should be adopted.

Proposed Experiments and Decisive Checks

Simulation comes first, because only there can we replay an episode from an identical state with and without intervention. We use polygonal peg-in-hole shapes with 4 to 10 vertices in Isaac Gym, following the PolyFit setup (PolyFit), and Nut Assembly in robosuite (robosuite). Robosuite ships impedance and operational-space controllers rather than force-driven admittance, so we add an admittance controller ourselves. We found no reported result on Lacuna for robosuite Nut Assembly under admittance control, so we establish our own naive baseline there.

Counterfactual replay lets us measure intervention precision and recall: the fraction of interventions on episodes that would otherwise have failed, and the fraction of would-be failures caught. This quantifies over-correction directly, borrowing the evaluation stance of the NLP post-processing literature.

On hardware, a 7-DoF arm with a wrist force sensor runs USB insertion, plug insertion and gear assembly, which mirror the task sets of ForceVLA-Data and the FAVLA dataset. We use those datasets for pretraining if they are available and otherwise collect about 50 demonstrations per task in the AdmitDiff style. We also run real polygonal pegs at clearances below 1 mm.

Metrics are success rate, false-completion rate, jam rate, peak and mean contact force, time to completion, and intervention rate.

Three outcomes would decide the claim. The first is whether most of the success gain over the naive reference comes from fewer false completions and jams, rather than from uniform slowing; the random-intervention ablation tests this. The second is whether a single rule file, tuned only on USB insertion, transfers to plug insertion, gear assembly and unseen polygon pegs while keeping intervention precision above 0.8, which addresses the brittleness charge against rule systems. The third is whether the joint trajectory-plus-parameter correction beats both single-channel ablations, which would show that the trajectory-versus-parameters debate between Active Admittance Control with Iterative Learning and AdmitDiff is a false choice. We also log contact oscillation before and after every gated parameter switch to confirm that the energy gate does not introduce instability.