--- title: HiCoTraj emoji: πŸ—ΊοΈ colorFrom: red colorTo: indigo sdk: gradio app_file: app.py pinned: false --- # HiCoTraj Demo **Zero-Shot Demographic Reasoning via Hierarchical Chain-of-Thought Prompting from Trajectory** *ACM SIGSPATIAL GeoGenAgent Workshop 2025* --- ## Overview HiCoTraj is a demo that shows how a large language model can infer demographic attributes, specifically household income, from raw human mobility trajectories through a three-stage hierarchical chain-of-thought prompting strategy. It does not require training data or fine-tuning. --- ## Interface Layout | Component | Description | |-----------|-------------| | **Agent Cards** | Top panel β€” 6 showcase agents from the NUMOSIM dataset. Click any card to load that agent's data throughout the interface. | | **Trajectory Map** | Interactive map of stay points, ordered chronologically (yellow β†’ dark red). Click any dot for location, time, and activity details. | | **Summary Tab** | Rule-based processed data: top locations, temporal distribution, activity breakdown, and observation period. | | **Raw Data Tab** | Full daily activity log. Use **Show All Days** to expand beyond the preview. | | **CoT Panel** | Right column β€” step-by-step LLM reasoning. Advance with the β–Ά button; each click runs one stage. | --- ## How to Run the Demo 1. **Select an agent** by clicking one of the six cards at the top of the page. 2. **Explore the Trajectory Map** β€” hover and click stay-point markers to inspect visit details. 3. **Switch to the Raw Data tab** and click *Show All Days* to view the complete daily log. 4. Click **β–Ά Stage 1: Feature Extraction** to begin the reasoning chain. 5. Click **β–Ά Stage 2: Behavioral Analysis** β€” Stage 1 results are now visible. 6. Click **β–Ά Stage 3: Demographic Inference** β€” all three stages shown simultaneously. 7. Click **β†Ί Reset** to clear results and try a different agent. > πŸ’‘ **Tip:** Click **β–Ό prompt** under each stage header to expand the full prompt specification used for that step. --- ## Hierarchical Chain-of-Thought Stages ### πŸ”΅ Stage 01 β€” Feature Extraction The LLM receives raw trajectory data and extracts **objective features without interpretation**: location inventory (POI names, visit counts, price tier), temporal patterns (time-of-day and weekday/weekend split), spatial activity radius, and daily activity sequences. *Displayed as:* location table with visit bars Β· time-of-day color segment bar Β· weekday/weekend split ### 🟠 Stage 02 β€” Behavioral Analysis Using Stage 1 features, the model performs **behavioral abstraction** across four dimensions: Routine & Schedule (work pattern type), Economic Behavior (spending tier from venue choices), Social & Lifestyle (leisure and community engagement), and Routine Stability (consistency of movement patterns). *Displayed as:* 2Γ—2 card grid β€” one card per behavioral dimension ### πŸ”΄ Stage 03 β€” Demographic Inference The model synthesizes Stages 1 and 2 to **infer the agent's household income bracket**, citing specific mobility evidence. The structured output (`INCOME_PREDICTION` / `INCOME_REASONING`) enables reliable extraction and display. *Displayed as:* income prediction badge Β· evidence-grounded reasoning text --- ## Dataset **NUMOSIM** β€” *NUMoSim: A Synthetic Mobility Dataset with Anomaly Detection Benchmarks.* Stanford C., Adari S., Liao X., et al. ACM SIGSPATIAL Workshop on Geospatial Anomaly Detection, 2024. Synthetic trajectories preserving real population demographics and mobility patterns. - **Demo subset:** 6 agents - **Attribute inferred:** household income bracket - **Method:** zero-shot LLM, no fine-tuning