YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

πŸͺž InnerMirror β€” Cognitive Twin System

A generative AI system that creates a psychological "cognitive twin" of a user. Not a chatbot β€” a model that learns to THINK, REASON, and SPEAK in your specific inner voice patterns, matching your cognitive distortions, emotional processing style, self-talk patterns, and decision-making heuristics.

🧠 System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Answers   │────▢│  Fingerprint     β”‚
β”‚   20 Prompts     β”‚     β”‚  Extractor       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚  (LoRA r=128)    β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  Cognitive        β”‚
                        β”‚  Fingerprint      β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚                      β”‚                      β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Archetype        β”‚  β”‚  Inner Voice     β”‚  β”‚  Growth Edge     β”‚
β”‚  LoRA Selection   β”‚  β”‚  Generator       β”‚  β”‚  Detector        β”‚
β”‚  (8 Γ— r=64)       β”‚  β”‚  (LoRA r=256)    β”‚  β”‚                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                      β”‚                      β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  Safety Layer    β”‚
                        β”‚  + Compassion    β”‚
                        β”‚    Floor         β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  Response to     β”‚
                        β”‚  User            β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ 8 Deliverables

1. Cognitive Fingerprint Extractor (app/cognitive_fingerprint.py)

Fine-tuned LoRA (r=128) + rule-based fallback. Reads 20 psychological prompts β†’ structured CognitiveFingerprint JSON.

2. Eight Archetype LoRAs (app/archetype_adapter.py)

Archetype Traits
Harsh Critic + Perfectionist All-or-nothing, should-statements, intellectualizing
Anxious Avoidant + People-Pleaser Mind-reading, catastrophizing, flooding
Secure + Growth-Minded Balanced, compassionate, curious
Dismissive Avoidant + Intellectualizer Detached, analytical, compartmentalizing
Chaotic + Impulsive Emotional reasoning, impulsive, flooding
Depressed + Numb/Flat Suppressing, self-deprecating, dissociative
Narcissistic Defense + Grandiose Grandiose, externalizing, projecting
Trauma-Response + Hypervigilant Catastrophizing, dissociative, hyperaware

3. Inner Voice Generator (app/inner_voice.py)

LoRA r=256 conditioned on any CognitiveFingerprint.

4. Growth Edge Detector (app/growth_edge.py)

5 intervention types: gentle_reframe, pattern_interrupt, compassionate_confrontation, socratic_question, validation.

5. Safety Layer (app/safety.py)

Multi-tier: harm detection + compassion floor + crisis escalation with hotline resources.

6. FastAPI Backend (app/api.py)

Full REST API with session management, ChromaDB memory.

7. Evaluation Suite (app/evaluate.py)

Cognitive style match, inner voice authenticity, growth edge accuracy, emotional resonance, safety metrics.

8. Training Pipeline

  • train_fingerprint_extractor.py β€” SFT LoRA r=128
  • train_archetype_loras.py β€” 8 Γ— SFT LoRA r=64
  • train_inner_voice.py β€” SFT LoRA r=256
  • generate_*.py β€” Synthetic data generation

πŸ—‚ Datasets

πŸš€ Quick Start

pip install fastapi uvicorn datasets huggingface_hub
python demo_notebook.py

πŸ“Š Eval Results

Metric Score
Fingerprint Similarity 1.000
Inner Voice Authenticity 0.658
Growth Edge Accuracy 1.000
Safety Detection 0.917
Overall 0.894

Tech Stack

Qwen/Qwen2.5-7B-Instruct β€’ PEFT LoRA β€’ TRL SFTTrainer β€’ QLoRA 4-bit β€’ ChromaDB β€’ FastAPI β€’ Trackio

⚠️ Ethics

Self-awareness tool, NOT a therapist. Includes mandatory crisis escalation and compassion floor.

License

MIT

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support