Skip to content

feat(reasoning): optional System 2 causal head behind a typed SceneContext#81

Merged
m-zain-khawaja merged 5 commits into
autowarefoundation:mainfrom
gcordova10:feat/system2-causal-head
Jun 22, 2026
Merged

feat(reasoning): optional System 2 causal head behind a typed SceneContext#81
m-zain-khawaja merged 5 commits into
autowarefoundation:mainfrom
gcordova10:feat/system2-causal-head

Conversation

@gcordova10

Copy link
Copy Markdown
Contributor

Implements #17 / the typed-context reframing @ryotayamada asked for in #56: typed SceneContext (confidence+provenance), causal head as an OPTIONAL producer, passed to planners via **kwargs — BasePlanner interface untouched. Labels via KIT longtail (pending). Relates to #56.

Adds Model/model_components/causal_reasoning.py (CausalReasoningModule:
reasoning_latent [B,H] + decision_logits [B,5] over a closed set
intersection/pedestrian/traffic_light/obstacle/clear; reason() exposes the
latent to condition the planner in a perception->reasoning->trajectory
cascade with gradients flowing to the trunk, no torch.no_grad). Includes
causal_consistency_loss (cross-entropy on VLM/KITScenes pseudo-labels).
Optional and independent: AutoE2E's 3-tuple contract is untouched.

Relates to autowarefoundation#17.

Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
…s for noisy pseudo-labels

Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
…l producer

Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
…anner untouched

Per maintainer feedback (autowarefoundation#56): keep the causal head as an optional producer of a
typed SceneContext, but do NOT modify the shared BasePlanner interface. Revert
trajectory_planning/base.py to upstream (drop the scene_context parameter):
planners already accept **kwargs, so any planner that wants to consume the
context reads it from kwargs — no abstract-signature change, no forced update
on GRU/FlowMatching.

Fix an infer-mode assertion in the integration test (future is None in infer,
per the AutoE2E 3-tuple contract).

Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
mypy (no_implicit_optional=True) rejected implicit-Optional defaults:
- CausalReasoningModule.__init__: latent_dim: int = None -> int | None
- causal_consistency_loss: class_weights: torch.Tensor = None -> torch.Tensor | None

Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
@gcordova10 gcordova10 force-pushed the feat/system2-causal-head branch from 6282611 to fd1091a Compare June 22, 2026 15:22
@gcordova10 gcordova10 changed the title feat(reasoning): optional System 2 causal head behind a typed SceneContext" feat(reasoning): optional System 2 causal head behind a typed SceneContext Jun 22, 2026

@m-zain-khawaja m-zain-khawaja left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, thanks @gcordova10

@m-zain-khawaja m-zain-khawaja merged commit 377ff9b into autowarefoundation:main Jun 22, 2026
1 check passed
gcordova10 added a commit to gcordova10/auto_fsd that referenced this pull request Jun 24, 2026
… head (autowarefoundation#17/autowarefoundation#3)

The merged causal head (autowarefoundation#81) trains via causal_consistency_loss(decision_logits,
labels) but the labels — 'VLM pseudo-labels over KITScenes LongTail' per its
docstring — did not exist. This adds that supervision side, following NVIDIA's
Chain-of-Causation autolabeler (NVlabs/alpamayo-coc-autolabeler; Alpamayo-R1
arXiv:2511.00088):
- VLMTeacher interface (real Qwen3-VL/GPT backends plug in by subclassing) +
  a deterministic KeywordVLMTeacher for offline use & CI;
- text_to_class_index: maps free-form effect_on_ego_behavior / captions to the
  5 CAUSAL_CLASSES by priority (most safety-critical first);
- parse_coc_yaml: reads the autolabeler's cot_*.yaml schema into a class index;
- build_causal_labels: builds the [B] label tensor (with an abstain index).
Taxonomy imported from the head (single source of truth). Additive, new package
under data_parsing; 14 tests incl. end-to-end driving the merged
causal_consistency_loss; mypy/ruff clean.
Note: full-suite CI gated by autowarefoundation#88 (broken shared test infra), unrelated.

Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
@gcordova10 gcordova10 deleted the feat/system2-causal-head branch June 30, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants