Papers
Topics
Authors
Recent
Search
2000 character limit reached

Codified Decision Trees for Agent Behavior

Updated 4 February 2026
  • CDT is a hierarchical, explicitly interpretable decision structure that models narrative agent behavior through scene-conditioned rules.
  • It is induced from scene-action pairs using clustering, LLM-driven hypothesis generation, and rigorous NLI-based validation.
  • Empirical results show CDT and CDT-Lite outperform traditional methods by ensuring deterministic, transparent, and robust agent behavior.

A Codified Decision Tree (CDT) is an explicitly interpretable, executable decision structure for encoding behavioral profiles of agents, particularly in narrative or role-playing (RP) environments. Unlike traditional, static hand-authored profiles, CDT is constructed via a data-driven induction process over (scene, action) pairs, yielding a hierarchical tree whose branches are labeled by validated scene-conditioned predicates and whose leaves comprise grounded behavioral statements. This framework supports deterministic inference, rigorous validation, and transparent inspection, resulting in robust agent consistency across diverse contexts (Peng et al., 15 Jan 2026).

1. Formal Definition and Structure

A CDT for a character xx is a rooted tree TT whose nodes vv hold two kinds of content:

  • A (possibly empty) set HvH_v of behavioral statements h∈Ah \in A, where AA is the set of grounded action statements.
  • A (possibly empty) set of outgoing edges (v→vi)(v \to v_i), each labeled by a predicate-question qiq_i on scene descriptions.

Given the space SS of all textual scenes and a binary discriminator function check(s,q)∈{True,False,Unknown}\mathrm{check}(s,q) \in \{ \mathrm{True}, \mathrm{False}, \mathrm{Unknown} \}, the execution (inference) semantics for a scene TT0 are:

  1. Initialize grounding set TT1.
  2. For each outgoing edge TT2 labeled by TT3, if TT4, update TT5 and recurse on TT6.
  3. The output TT7 is the union of all TT8 for those TT9 whose path from root satisfies every traversed vv0.

Each edge predicate vv1 formalizes a rule antecedent ("if vv2 then..."), and each vv3 is a rule consequent ("...then vv4"). A rule vv5 is the pair vv6, where vv7 and vv8 is drawn from vv9.

2. Learning Algorithm and Induction Process

CDT is induced from a dataset HvH_v0 of HvH_v1 pairs using the following recursive algorithm:

  • Clustering: Similar HvH_v2 pairs are grouped (e.g., via semantic embedding or clustering).
  • Hypothesis Generation: For each cluster, a LLM is prompted to propose candidate HvH_v3 pairs, where HvH_v4 is a predicate applicable to HvH_v5 and HvH_v6 a behavioral action.
  • Validation: Each hypothesis is evaluated on HvH_v7 using NLI-style statistics:
    • HvH_v8: number where NLIHvH_v9
    • h∈Ah \in A0: number where NLIh∈Ah \in A1
    • h∈Ah \in A2
    • h∈Ah \in A3 (entail-accuracy)
    • h∈Ah \in A4 (applicability)
  • Acceptance/Rejection/Refinement:
    • If h∈Ah \in A5, accept as rule;
    • If h∈Ah \in A6 or h∈Ah \in A7 small, reject;
    • If h∈Ah \in A8 and depth h∈Ah \in A9, recurse for further specialization.
  • Termination Criteria: The process stops when no further refinement is warranted.

Key hyperparameters include:

  • AA0 (acceptance, e.g., 0.75)
  • AA1 (rejection, e.g., 0.50)
  • AA2 (filter, e.g., 0.75)
  • AA3 (maximum depth)
  • AA4 for recursion (e.g., 16)

3. Executability and Interpretability

CDT nodes store explicit, human-readable behavioral statements, and all branch predicates are labeled linguistically interpretable questions. Deterministic retrieval is guaranteed, as AA5 is a deterministic Boolean test (with an UnknownAA6False policy). The result is that repeated queries on the same scene AA7 yield identical traversals and triggered behavioral actions.

Termination and decidability are ensured by constraints on both maximum tree depth and recursion dataset size. The construction guarantees that for any finite dataset, the induced CDT is finite and construction halts in AA8 steps (Peng et al., 15 Jan 2026).

4. Empirical Results and Benchmarks

CDT and its variant CDT-Lite were evaluated on several benchmarks:

  • Datasets:
    • Fine-grained Fandom: 8 artifacts, 45 characters, 20,778 AA9 pairs.
    • Bandori Conversational: 8 bands, 40 characters, 7,866 pairs.
    • Bandori Events: 77,182 pairs (scaling study).
  • Metric: Natural language inference (NLI) score. Given a predicted action (v→vi)(v \to v_i)0 and reference (v→vi)(v \to v_i)1, score(v→vi)(v \to v_i)2 if entail, (v→vi)(v \to v_i)3 if neutral, and (v→vi)(v \to v_i)4 if contradict; average is reported.
  • Key Results (NLI Score Average):
System Fandom Avg Bandori Avg
Vanilla 55.6 65.5
Fine-tune 45.7 62.9
RICL 56.0 68.9
ETA 56.9 72.3
Human 58.3 71.3
Codified-Human 59.3 71.9
CDT 60.8 77.7
CDT-Lite 61.0 79.0

Removal of clustering, instruction-following embeddings, or validation degrades performance by 1–2 points. Performance scales monotonically with dataset size (Peng et al., 15 Jan 2026).

5. Example Construction

Consider the following illustrative dataset (v→vi)(v \to v_i)5 for a "Hero":

  1. "Dark tunnel ahead..." (v→vi)(v \to v_i)6 "Hero lights torch."
  2. "Walls glint in darkness..." (v→vi)(v \to v_i)7 "Hero lights torch."
  3. "Monster roar nearby..." (v→vi)(v \to v_i)8 "Hero draws sword."
  • Cluster (v→vi)(v \to v_i)9; LLM hypothesizes qiq_i0"Does the scene mention darkness?", qiq_i1"Hero lights torch." Accepted as qiq_i2.
  • Cluster qiq_i3; LLM hypothesizes qiq_i4"Does the scene indicate presence of hostile creature?", qiq_i5"Hero draws sword." Accepted.

Final CDT in LaTeX: qiq_i6

CDT offers improvements over both hand-authored codified human profiles and other induction methods. For Fandom, CDT-Lite outperforms Codified Human by +1.7 points (61.0 vs 59.3 NLI avg); for Bandori, by +7.1 points (79.0 vs 71.9). Overall, CDTs show relative improvements of 3–10% over the strongest human and prior data-driven baselines (Peng et al., 15 Jan 2026).

While CDT leverages a tree structure reminiscent of classic decision trees, the construction and inference are semantically adapted to natural language scene affordances and behavioral logic, not feature-threshold predicates. By contrast, computational graph representations of traditional binary and oblique decision trees have been formalized via parallel predicate evaluation and bitvector arithmetic over structured inputs, supporting soft traversals and hybridization with differentiable models (Zhang, 2021). CDTs focus distinctly on context-conditional action logic derived from narrative data rather than numerical features.

7. Limitations and Future Developments

Current CDT methodology is restricted to offline (non-continual) construction and induction solely from narrative storyline data, without leveraging canonical trait priors or multimodal context (e.g., game state). Future directions include:

  • Joint CDT induction for multiple interacting characters.
  • Online refinement and continual learning from live agent interaction.
  • Multimodal CDT expansion incorporating event logs and real-time state signals.

These directions address domains where principled, interpretable, and efficiently updatable behavioral logic is required for robust agent grounding under complex, evolving contexts (Peng et al., 15 Jan 2026).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Codified Decision Tree (CDT).