Structured Machine Theory of Mind from Agent Trajectories
Organizations: Halıcıoğlu School of Data Science and Computing, University of California San Diego · New York University · Department of Philosophy and School of Data Science, University of Virginia
Abstract
Predictive models of human behavior trained on large-scale trajectory data optimize for statistical accuracy without representing the mental states that causally generate behavior. Such models support prediction but not principled intervention: they cannot answer how an agent's behavior would change if its beliefs or preferences were different. We introduce Structured Machine Theory of Mind (SMToM), a framework that attributes explicit, independently supervised belief and desire representations from observed trajectories within a Belief-Desire-Intention (BDI) causal structure. The central architectural element is a goal head that consumes only the predicted mental-state channels and a current-trajectory embedding; counterfactual intervention on beliefs and desires is a direct operation. We instantiate SMToM on a controlled pedestrian navigation domain where ground-truth mental states are known by construction, enabling evaluation of attribution accuracy, local channel interventions, and trajectory-level counterfactual diagnostics. The resulting model, BDIBottleneck, improves over trajectory-only and unsupervised-context neural baselines. It is also competitive with a matched auxiliary-supervised context baseline while providing an editable mental-state interface that the unbottlenecked baseline lacks. Counterfactual experiments on desires confirm that substituting an agent's inferred preferences with a different activity type coherently shifts predicted destinations toward relevant locations. Counterfactual experiments on beliefs confirm that marking a location as unavailable in the agent's belief state reduces its predicted probability as a destination, though in a complex way. These results demonstrate, in a controlled navigation setting, that explicit BDI-structured supervision is a viable foundation for interpretable and counterfactual analysis of longitudinal trajectory data.
Figures & tables
| Test (belief heldout) | Test (new agent, belief heldout) | |||||||
|---|---|---|---|---|---|---|---|---|
| Model | 25% | 50% | 75% | 100% | 25% | 50% | 75% | 100% |
| VisitFrequency | 13.33 | 13.33 | 13.33 | 13.33 | 14.17 | 14.17 | 14.17 | 14.17 |
| BToM (Informed) [approximate upper bound] | 24.79 | 33.96 | 48.33 | 94.38 | 29.79 | 39.79 | 58.33 | 94.17 |
| GoalPredictor | 12.50 | 25.83 | 40.42 | 42.50 | 10.35 | 27.50 | 41.04 | 43.82 |
| ContextGoalPredictor | 17.36 | 26.32 | 38.75 | 41.25 | 15.35 | 28.26 | 37.57 | 41.53 |
| AuxContext | 16.25 | 28.47 | 40.28 | 43.61 | 17.50 | 28.82 | 40.90 | 44.86 |
| Split | Prototypes | Mean | 95% CI | Perm. | Sign test | Pairs sig. | |
|---|---|---|---|---|---|---|---|
| Test | Model-derived | 480 | 0.151 | [0.145, 0.157] | 29/30 | ||
| Test | Handcrafted | 480 | 0.344 | [0.335, 0.354] | 30/30 | ||
| Test (new agent) | Model-derived | 480 | 0.135 | [0.129, 0.140] | 27/30 | ||
| Test (new agent) | Handcrafted | 480 | 0.333 | [0.324, 0.341] | 30/30 |
| Split | Outcome | Mean | 95% CI | Permutation | Sign test | |
|---|---|---|---|---|---|---|
| Test | 206 | 0.0061 | [0.0007, 0.0121] | 0.0194 | 0.1181 | |
| Test | 206 | -0.0147 | [-0.0224, -0.0074] | |||
| Test (new agent) | 237 | 0.0055 | [0.0004, 0.0110] | 0.0238 | 0.0969 | |
| Test (new agent) | 237 | -0.0240 | [-0.0299, -0.0183] |
| Regime | Split | Type | Top-1 (%) | Top-5 (%) | |
|---|---|---|---|---|---|
| dense | test | belief | 2880 | 6.4 [4.7, 8.1] | 34.7 [29.3, 40.6] |
| dense | test | desire | 2880 | 18.1 [15.4, 20.9] | 43.3 [40.1, 46.4] |
| dense | test_new_agent | belief | 2880 | 7.7 [6.2, 9.2] | 36.8 [32.5, 41.0] |
| dense | test_new_agent | desire | 2880 | 21.5 [18.6, 24.4] | 47.2 [44.2, 50.1] |
| sparse | test | belief | 2400 | 8.9 [7.4, 10.4] | 37.2 [33.7, 41.2] |
| sparse | test | desire | 2400 | 9.0 [7.5, 10.6] | 33.4 [30.5, 36.4] |
Appendix figures & tables33 assets
Supplementary material from the paper’s appendix.
Appendix
| Split | Configs | Agents | Total episodes |
|---|---|---|---|
| train | – (8) | 15 | 2040 |
| val | – (8) | 15 | 480 |
| test | – (8) | 15 | 480 |
| test_new_agent | – (8) | 15 | 480 |
| test_bh | BH0 , BH1 (2) | 15 | 480 |
| test_new_agent_bh | BH0 , BH1 (2) | 15 | 480 |
| Setting | GoalPredictor | Context GoalPredictor | BDIBottleneck |
|---|---|---|---|
| Epochs | 300 | 300 | 300 |
| Batch size | 64 | 32 | 32 |
| Optimizer | AdamW | AdamW | AdamW |
| Base learning rate | |||
| Weight decay | |||
| LR schedule | Cosine annealing; | Warmup 0, then cosine; | Warmup 0, then cosine; |
| Setting | AuxContext |
|---|---|
| Epochs, seeds, context | 300 epochs; seeds 0, 5, 10; , |
| Architecture | Same three transformer encoders as ContextGoalPredictor and BDIBottleneck ; , layers=3, heads=4, dim_ff=256, dropout=0.1 |
| Goal head | ; no belief/desire bottleneck in the goal path |
| Auxiliary heads | Desire head on and belief head on , matching BDIBottleneck ’s targets |
| Losses | Goal cross-entropy, desire KL, and weighted belief BCE with , , and false-belief weight 5.0 |
| Optimizer and selection | AdamW, learning rate , weight decay , cosine schedule, best checkpoint selected by validation goal top-1 |
| Setting | BDIBottleneck-NoDesire | BDIBottleneck-NoBelief |
|---|---|---|
| Epochs | 300 | 300 |
| Context sizes | ; desire context not used | ; recent context not used |
| Goal loss | cross-entropy ( ) | cross-entropy ( ) |
| Desire loss | Not used | KL divergence ( ) |
| Belief loss | weighted BCE ( , false-belief weight ) | Not used |
| Checkpoint criterion | Best val goal top-1 | Best val goal top-1 |
| Category | POI IDs (within-category order) |
|---|---|
| attend_class | POI-01, POI-02, POI-03, POI-04 |
| get_food | POI-05, POI-06, POI-07, POI-08 |
| study | POI-09, POI-10, POI-11, POI-12 |
| socialize | POI-13, POI-14, POI-15, POI-16 |
| exercise | POI-17, POI-18, POI-19, POI-20 |
| rest_home | POI-21, POI-22, POI-23, POI-24 |
| Config | Split | False-belief POIs (believed closed) |
|---|---|---|
| B0 | train | none |
| B1 | train | POI-09, POI-10, POI-11 |
| B2 | train | POI-05, POI-06, POI-07 |
| B3 | train | POI-17, POI-18, POI-19 |
| B4 | train | POI-13, POI-14, POI-15 |
| B5 | train | POI-09, POI-10, POI-05, POI-06 |
| Character | class | food | study | social | exercise | home |
|---|---|---|---|---|---|---|
| studious_stem | 3.0 | 1.0 | 5.0 | 0.3 | 0.4 | 0.8 |
| social_athlete | 0.5 | 2.0 | 0.4 | 4.5 | 4.0 | 0.6 |
| foodie_socializer | 0.8 | 5.0 | 0.8 | 3.5 | 0.5 | 0.4 |
| homebody_studier | 1.0 | 0.6 | 2.5 | 0.2 | 0.2 | 6.0 |
| well_rounded | 2.0 | 2.0 | 2.0 | 2.0 | 1.5 | 1.5 |
| Character | Node alphas by category |
|---|---|
| studious_stem | class (1.5, 1.0, 3.0, 0.5); food (0.5, 2.5, 3.0, 0.5); study (1.5, 3.5, 1.0, 3.0); social (1.5, 1.0, 0.5, 1.5); exercise (1.0, 2.0, 0.5, 1.5); home (1.0, 3.0, 1.0, 1.5) |
| social_athlete | class (2.0, 1.0, 1.0, 0.5); food (3.5, 0.5, 0.5, 3.0); study (2.0, 0.5, 2.5, 0.5); social (2.5, 1.0, 3.5, 1.5); exercise (4.0, 1.0, 1.5, 3.5); home (3.0, 1.0, 0.5, 2.0) |
| foodie_socializer | class (1.0, 1.5, 1.0, 1.5); food (3.0, 2.0, 1.0, 4.0); study (2.5, 0.5, 2.0, 0.5); social (1.5, 4.0, 1.0, 4.5); exercise (1.0, 1.0, 0.5, 2.5); home (2.0, 1.0, 2.0, 1.0) |
| homebody_studier | class (1.0, 1.5, 1.0, 0.5); food (0.5, 4.0, 1.0, 0.5); study (3.5, 1.0, 0.5, 2.0); social (1.0, 2.0, 0.5, 1.0); exercise (0.5, 1.5, 0.5, 2.0); home (1.0, 1.0, 4.0, 2.5) |
| well_rounded | class (2.0, 2.0, 2.0, 1.5); food (2.0, 2.0, 2.0, 2.0); study (3.0, 1.5, 2.0, 1.5); social (2.0, 2.0, 1.5, 2.0); exercise (2.5, 2.0, 1.5, 2.0); home (2.0, 2.0, 2.0, 1.5) |
| Regime | Configurations | Closed-entry rate | Closed F1 | Closed PR-AUC |
|---|---|---|---|---|
| Sparse test | – | 0.135 | 0.390 | 0.300 |
| Sparse new agent | – | similar sparse rate | 0.396 | 0.309 |
| Dense test | – , BM1–BM4, BD1–BD4 | 0.298 overall | 0.524 | 0.462 |
| Dense new agent | same dense family | 0.298 overall | 0.521 | 0.453 |
| Regime | Config | Model | Top-1 | Closed F1 |
|---|---|---|---|---|
| Sparse | default weighted | AuxContext | ||
| Sparse | default weighted | BDIBottleneck | ||
| Sparse | balanced focal | AuxContext | ||
| Sparse | balanced focal | BDIBottleneck | ||
| Dense | default weighted | AuxContext | ||
| Dense | default weighted | BDIBottleneck |
| Split | Outcome | Mean | 95% CI | Permutation | Sign test |
|---|---|---|---|---|---|
| Test | 0.0054 | [-0.0009, 0.0125] | 0.0784 | 0.1509 | |
| Test | -0.0122 | [-0.0259, 0.0013] | 0.0521 | 0.0592 | |
| Test (new agent) | 0.0050 | [-0.0040, 0.0141] | 0.1634 | 0.5000 | |
| Test (new agent) | -0.0233 | [-0.0338, -0.0130] | 0.0006 | 0.0037 |
| Test | Test (new agent) | |||
|---|---|---|---|---|
| Path fraction | ||||
| 25% | ||||
| 50% | ||||
| 75% | ||||
| 100% | ||||
| Regime | Split | Type | Top-1 (%) | Top-5 (%) | ||
|---|---|---|---|---|---|---|
| dense | test | belief | 960 | 14.7 [11.2, 18.4] | 57.0 [50.0, 63.6] | 0.0902 [0.0812, 0.0989] |
| dense | test | desire | 960 | 14.0 [11.1, 17.1] | 50.9 [45.4, 56.8] | 0.0874 [0.0823, 0.0931] |
| dense | test_new_agent | belief | 960 | 11.6 [9.1, 14.3] | 50.9 [45.9, 55.7] | 0.0807 [0.0756, 0.0862] |
| dense | test_new_agent | desire | 960 | 14.6 [12.6, 16.7] | 55.8 [51.6, 60.2] | 0.0946 [0.0884, 0.1016] |
| sparse | test | belief | 480 | 17.5 [13.3, 21.9] | 58.8 [52.9, 64.6] | 0.0859 [0.0785, 0.0935] |
| sparse | test | desire | 480 | 9.6 [6.5, 12.9] | 45.6 [39.6, 52.5] | 0.0729 [0.0675, 0.0789] |
| Regime | Split | Type | Channel | ||||
|---|---|---|---|---|---|---|---|
| dense | test | belief | predicted | -0.0112 [-0.0137, -0.0088] | 0.0855 [0.0765, 0.0949] | -0.0870 [-0.0968, -0.0774] | -0.1725 [-0.1815, -0.1641] |
| dense | test | desire | predicted | -0.0705 [-0.0836, -0.0582] | 0.1220 [0.1042, 0.1391] | -0.0552 [-0.0719, -0.0399] | -0.1772 [-0.1888, -0.1652] |
| dense | test_new_agent | belief | predicted | -0.0095 [-0.0115, -0.0075] | 0.0976 [0.0883, 0.1074] | -0.0653 [-0.0736, -0.0576] | -0.1629 [-0.1719, -0.1543] |
| dense | test_new_agent | desire | predicted | -0.0532 [-0.0641, -0.0427] | 0.1467 [0.1275, 0.1647] | -0.0276 [-0.0420, -0.0137] | -0.1743 [-0.1880, -0.1602] |
| sparse | test | belief | predicted | 0.0016 [0.0009, 0.0022] | 0.0453 [0.0430, 0.0476] | -0.0234 [-0.0274, -0.0196] | -0.0687 [-0.0737, -0.0642] |
| sparse | test | desire | predicted | -0.0182 [-0.0223, -0.0148] | 0.0450 [0.0386, 0.0512] | -0.0265 [-0.0333, -0.0202] | -0.0715 [-0.0781, -0.0653] |
| Regime | Split | Type | ||||
|---|---|---|---|---|---|---|
| dense | test | belief | 0.0032 | 0.0032 | 0.0032 | 0.0032 |
| dense | test | desire | 0.0032 | 0.0032 | 0.0032 | 0.0032 |
| dense | test_new_agent | belief | 0.0032 | 0.0032 | 0.0032 | 0.0032 |
| dense | test_new_agent | desire | 0.0032 | 0.0032 | 0.0032 | 0.0032 |
| sparse | test | belief | 1.0000 | 0.0032 | 0.0032 | 0.0032 |
| sparse | test | desire | 0.0032 | 0.0032 | 0.0032 | 0.0032 |
| Path | Test | Test (new agent) | ||||||
|---|---|---|---|---|---|---|---|---|
| frac. (%) | Goal | Ctx | Aux | BDI | Goal | Ctx | Aux | BDI |
| 10 | 6.11 | 12.22 | 12.85 | 13.89 | 5.35 | 11.32 | 10.63 | 11.74 |
| 20 | 10.97 | 18.40 | 16.67 | 20.49 | 9.58 | 14.86 | 13.47 | 19.10 |
| 30 | 16.46 | 21.39 | 21.32 | 24.10 | 16.67 | 20.28 | 18.96 | 23.54 |
| 40 | 23.54 | 27.57 | 27.22 | 31.74 | 23.12 | 24.65 | 24.38 | 33.26 |
| 50 | 27.99 | 31.53 | 31.53 | 36.32 | 26.46 | 28.75 | 27.50 | 36.11 |
| Split | Comparison | 10% | 20% | 30% | 40% | 50% |
|---|---|---|---|---|---|---|
| test | BDI vs. GP | < 0.001 | < 0.001 | 0.282 | < 0.001 | 0.001 |
| BDI vs. CTX | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | |
| test_new_agent | BDI vs. GP | 0.001 | < 0.001 | 0.276 | < 0.001 | < 0.001 |
| BDI vs. CTX | 1.000 | 1.000 | 0.919 | 1.000 | 1.000 |
| Split | Comparison | Frac | |||||
|---|---|---|---|---|---|---|---|
| test | BDI vs. GoalPredictor | 10% | 480 | 15 | 51 | < 0.001 | < 0.001 |
| 20% | 480 | 19 | 69 | < 0.001 | < 0.001 | ||
| 30% | 480 | 44 | 70 | 0.019 | 0.282 | ||
| 40% | 480 | 39 | 90 | < 0.001 | < 0.001 | ||
| 50% | 480 | 40 | 86 | < 0.001 | 0.001 | ||
| 60% | 480 | 36 | 97 | < 0.001 | < 0.001 |
Theory of Mind
Theory of Mind studies how people and AI infer others’ beliefs, goals, and knowledge to predict behavior and coordinate interaction.
See all 95 papers