YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
- πͺ InnerMirror β Cognitive Twin System
- π§ System Architecture
- π¦ 8 Deliverables
- 1. Cognitive Fingerprint Extractor (
app/cognitive_fingerprint.py) - 2. Eight Archetype LoRAs (
app/archetype_adapter.py) - 3. Inner Voice Generator (
app/inner_voice.py) - 4. Growth Edge Detector (
app/growth_edge.py) - 5. Safety Layer (
app/safety.py) - 6. FastAPI Backend (
app/api.py) - 7. Evaluation Suite (
app/evaluate.py) - 8. Training Pipeline
- 1. Cognitive Fingerprint Extractor (
- π Datasets
- π Quick Start
- π Eval Results
- Tech Stack
- β οΈ Ethics
- License
- π§ System Architecture
πͺ 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=128train_archetype_loras.pyβ 8 Γ SFT LoRA r=64train_inner_voice.pyβ SFT LoRA r=256generate_*.pyβ Synthetic data generation
π Datasets
- InnerMirror-FingerPrint-Data β 108 examples
- InnerMirror-Archetype-Data β 1,200 examples
- InnerMirror-InnerVoice-Data β 1,000 examples
π 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