feat: LLM-driven semantic_type and identity_dimensions#106
Merged
DeveshParagiri merged 3 commits intomainfrom Feb 17, 2026
Merged
feat: LLM-driven semantic_type and identity_dimensions#106DeveshParagiri merged 3 commits intomainfrom
DeveshParagiri merged 3 commits intomainfrom
Conversation
…cenarioSpec Replace hardcoded keyword matching with LLM-driven classification: 1. AttributeSpec.semantic_type (age, income, education, employment, occupation) - Set by LLM during spec creation in selector - Flows through DiscoveredAttribute → HydratedAttribute → AttributeSpec - Used by sampler to normalize minor attributes without keyword heuristics 2. ScenarioSpec.identity_dimensions - Set by LLM during scenario creation in compiler - Lists which identity dimensions are activated by the scenario - Used by engine to render identity-threat context in reasoning prompts This fixes: - #86: Dependent attributes now use semantic_type instead of keyword matching - #90: Identity framing now uses scenario-declared dimensions instead of hardcoded keywords Closes #86, closes #90
This was referenced Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #86 (dependent attributes for minors) and #90 (identity-threat framing) with a proper LLM-driven approach instead of hardcoded keywords.
Changes
semantic_typefor AttributeSpec (fixes #86):semantic_typefield toAttributeSpec,DiscoveredAttribute, andHydratedAttributeage,income,education,employment,occupation, orNoneidentity_dimensionsfor ScenarioSpec (fixes #90):IdentityDimensionmodel andidentity_dimensionsfield toScenarioSpecidentity_threat_summaryin reasoning context from scenario's pre-classified dimensionsFiles Changed
extropy/core/models/population.py- Addedsemantic_typefieldextropy/core/models/scenario.py- AddedIdentityDimensionmodelextropy/core/models/simulation.py- Addedidentity_threat_summaryto ReasoningContextextropy/population/spec_builder/selector.py- LLM schema includes semantic_typeextropy/population/spec_builder/hydrators/*.py- Carry semantic_type throughextropy/population/spec_builder/binder.py- Bind semantic_type to AttributeSpecextropy/population/sampler/core.py- Minor normalization functions using semantic_typeextropy/scenario/compiler.py- LLM-driven identity dimension detectionextropy/simulation/engine.py- Render identity threat summaryextropy/simulation/reasoning.py- Include identity relevance in promptsTest plan