Manuscript Offprint

arXiv:2610.25455

Self-Crystallizing Behavior Trees: Amortizing Foundation-Model Reasoning into Deterministic Control for Autonomous Drones

Behnam Moradi

Behnam Moradi

Software Department, KavAI.

California, USA

behnam.moradi@kavai.com

Abstract—Classical robot control architectures, Finite State Machines (FSMs) and Behavior Trees (BTs), are deterministic, inspectable, and fast, but fixed at design time: they fail on the long tail of situations their designers did not anticipate. Foundation models can synthesize new control logic at runtime, at the price of latency, cost, and non-determinism that are hard to accept in safety-critical aerial systems. Existing LLM-driven approaches keep the model permanently in the loop and discard what it produces after each use. We propose Self-Crystallizing Behavior Trees (SCBT), in which the foundation model is a compiler rather than a runtime. When a node of a vehicle's BT fails, an LLM proposes a minimal subtree patch in a constrained, mission-agnostic grammar; CMA-ES tunes the patch's continuous parameters in simulation; a contextual bandit decides whether a stored patch or a new LLM call is worth paying for; and a three-stage admission pipeline (static check, invariant monitors over randomized replays, and an empirical margin over the unpatched tree) admits only patches that demonstrably recover. Admitted patches are stored in a fleet library indexed by failure context and, once the LLM call rate has decayed, crystallized into a conventional deterministic BT that no human wrote. We implement SCBT on Microsoft Project AirSim with a schema-constrained LLM pipeline (Google ADK, Gemini 3.1 Pro) and a lockstep simulator. Over three seeds of a 20-episode learning phase with injected wind-gust and battery failures, SCBT used 11±1.411 \pm 1.4 LLM calls against 26 for whole-tree regeneration and 22 for patching without a library, with 0.33 calls per episode in the second half. The crystallized trees, with 28 and 33 nodes and two patches each, reached 97±2%97 \pm 2\% mission success on the curriculum with no learning component running, against 12% for the unpatched base tree and 98% for a hand-coded expert tree; re-ticked offline against recorded observations they reproduce their online decision traces exactly. Two negative results are reported: replay admission as parameterized rejected useful wind recoveries because it attributed wind-induced geofence excursions to the patch, and the static-only ablation generalized better to held-out failures as a consequence.

Index Terms—behavior trees, large language models, contextual bandits, CMA-ES, UAV, neuro-symbolic AI, lifelong learning, simulation-based verification

I. INTRODUCTION

For half a century robot behavior has been specified explicitly, first as FSMs and, over the last decade, as BTs [1], [2]. These architectures are attractive precisely because they are closed: every branch can be inspected, every transition is deterministic, and the controller runs at a fixed rate on embedded hardware. The same closedness is their limitation. A BT cannot execute a branch that was never written, and in open environments the set of situations that require a branch is effectively unbounded. We call this design-time rigidity.

Foundation models offer an apparent escape: LLMs write robot programs from natural-language goals [9], generate BT XML on demand [15], [16], ground plans in perceptual affordances [10], [12], and coordinate heterogeneous teams [26], [27]. But these systems share a structural assumption: the model stays in the control loop for the lifetime of the system, and what it produces is discarded after use. For aerial robots this has three consequences. Latency: in our implementation a single structured proposal from a frontier model takes 31–105 s (two schema-constrained calls); a vehicle in a wind gust cannot wait for it. Cost: operating cost grows with activity. Non-determinism: two flights under identical conditions may execute different logic, which defeats the certification argument that makes BTs acceptable in the first place.

The two camps are usually framed as a trade-off between adaptability and determinism. We argue the trade-off is an artifact of when the foundation model is invoked. If the model is called only when the existing control structure fails, if what it produces is verified and retained, and if a learned policy stops calling it once stored structure suffices, then adaptability is paid for once, during a learning phase, and the deployed system is an ordinary deterministic BT.

References (32)