Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,475 +1,110 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
##
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
**Solution Deployed**:
|
| 112 |
-
1. ✅ **Query Complexity Classifier** (`reasoning_forge/query_classifier.py`)
|
| 113 |
-
- SIMPLE queries (factual) → 1 primary agent, no debate
|
| 114 |
-
- MEDIUM queries → 3 weighted agents
|
| 115 |
-
- COMPLEX queries → full 6-agent debate
|
| 116 |
-
- Prevents unnecessary system activation on straightforward questions
|
| 117 |
-
|
| 118 |
-
2. ✅ **Conflict Capping at Source** (`reasoning_forge/conflict_engine.py`)
|
| 119 |
-
- max_conflicts_per_pair = 2 (instead of generating 71)
|
| 120 |
-
- max_total_conflicts = 12 (instead of 10-100)
|
| 121 |
-
- Prevents wasteful conflict accumulation
|
| 122 |
-
|
| 123 |
-
3. ✅ **Confidence Override Logic** (`reasoning_forge/forge_engine.py`)
|
| 124 |
-
- After Round 0 analysis: if SIMPLE + few conflicts + low disagreement → **skip entire debate**
|
| 125 |
-
- Saves computation cycles on high-confidence answers
|
| 126 |
-
- Expected impact: correctness 0.20 → 0.70+ on simple queries
|
| 127 |
-
|
| 128 |
-
4. ✅ **Semantic Tension Engine** (`reasoning_forge/semantic_tension.py`)
|
| 129 |
-
- Embedding-based conflict strength (continuous 0-1, not discrete)
|
| 130 |
-
- Llama embeddings replace heuristic opposition scores
|
| 131 |
-
- 0.6*semantic + 0.4*heuristic hybrid blending
|
| 132 |
-
|
| 133 |
-
5. ✅ **Specialization Tracking & Pre-Flight Prediction** (`reasoning_forge/specialization_tracker.py`, `reasoning_forge/preflight_predictor.py`)
|
| 134 |
-
- Per-adapter domain accuracy tracking
|
| 135 |
-
- Pre-flight Spiderweb injection predicts conflicts before debate
|
| 136 |
-
- Recommends optimal adapter selection upfront
|
| 137 |
-
|
| 138 |
-
### ✅ Agent LLM Integration Complete
|
| 139 |
-
All 6 reasoning agents use **real LLM inference** via trained LoRA adapters:
|
| 140 |
-
- **Newton** (physics reasoning) → newton adapter
|
| 141 |
-
- **Quantum** (probabilistic thinking) → quantum adapter
|
| 142 |
-
- **DaVinci** (creative invention) → davinci adapter
|
| 143 |
-
- **Philosophy** (conceptual reasoning) → philosophy adapter
|
| 144 |
-
- **Empathy** (emotional intelligence) → empathy adapter
|
| 145 |
-
- **Ethics** (moral reasoning) → philosophy adapter
|
| 146 |
-
|
| 147 |
-
**Result**: Agents generate domain-specific, LLM-backed reasoning instead of templates.
|
| 148 |
-
|
| 149 |
-
### ✅ GPU Acceleration Active
|
| 150 |
-
- Model load: ~8-10 seconds (GPU vs 40s CPU)
|
| 151 |
-
- Inference: 2-4 sec/query (GPU vs 15-20s CPU)
|
| 152 |
-
- Full eval: ~2-3 minutes (GPU vs 7-10 minutes CPU)
|
| 153 |
-
- **35/35 layers offloaded** to GPU via llama.cpp
|
| 154 |
-
|
| 155 |
-
### ✅ Phase 6 Framework Formalized
|
| 156 |
-
- **ψ (Psi)**: State vector encoding query domain and complexity (5D)
|
| 157 |
-
- **ξ (Xi)**: Semantic tension measurement (continuous, embedding-based)
|
| 158 |
-
- **Γ (Gamma)**: Coherence metrics with health monitoring
|
| 159 |
-
- **Evaluation**: `run_phase6_evaluation.py` — Compare baseline vs Phase 1-5 vs Phase 6 Full vs Phase 6 -PreFlight
|
| 160 |
-
|
| 161 |
-
## Model Weights
|
| 162 |
-
|
| 163 |
-
All 8 adapters are included in two formats:
|
| 164 |
-
|
| 165 |
-
| Format | Directory | Size | Use Case |
|
| 166 |
-
|--------|-----------|------|----------|
|
| 167 |
-
| **GGUF (f16)** | `adapters/*.gguf` | ~924 MB | llama.cpp inference with hot-swap |
|
| 168 |
-
| **PEFT SafeTensors** | `adapters_peft/*/` | ~79 MB | HuggingFace / transformers fine-tuning |
|
| 169 |
-
|
| 170 |
-
**Base model required**: `meta-llama/Llama-3.1-8B-Instruct` (or any Llama-3.1-8B variant with hidden_size=4096)
|
| 171 |
-
|
| 172 |
-
## Key Metrics
|
| 173 |
-
|
| 174 |
-
| Metric | Value | Context |
|
| 175 |
-
|--------|-------|---------|
|
| 176 |
-
| Phase Coherence (Gamma) | 0.9835 | 11-agent convergence |
|
| 177 |
-
| AEGIS Ethical Alignment (Eta) | 0.961 | 6-framework ethical governance |
|
| 178 |
-
| Cocoon Coherence | 0.994 | Memory state stability |
|
| 179 |
-
| Memory Phase Stability | 0.969 | Cross-session persistence |
|
| 180 |
-
| Tension Decay | 91.2% | 200-agent embodied simulation |
|
| 181 |
-
|
| 182 |
-
## Cognitive Subsystems (14 active)
|
| 183 |
-
|
| 184 |
-
| Subsystem | Module | Purpose |
|
| 185 |
-
|-----------|--------|---------|
|
| 186 |
-
| Reasoning Forge | `reasoning_forge/forge_engine.py` | 6-agent multi-perspective debate + synthesis |
|
| 187 |
-
| Query Classifier | `reasoning_forge/query_classifier.py` | Complexity-based agent selection (SIMPLE/MEDIUM/COMPLEX) |
|
| 188 |
-
| Semantic Tension | `reasoning_forge/semantic_tension.py` | Embedding-based conflict strength (Phase 6) |
|
| 189 |
-
| Specialization Tracker | `reasoning_forge/specialization_tracker.py` | Per-adapter domain expertise tracking (Phase 6) |
|
| 190 |
-
| Pre-Flight Predictor | `reasoning_forge/preflight_predictor.py` | Conflict prediction before debate (Phase 6) |
|
| 191 |
-
| Framework Definitions | `reasoning_forge/framework_definitions.py` | ψ, ξ, Γ formal definitions (Phase 6) |
|
| 192 |
-
| Epistemic Metrics | `reasoning_forge/epistemic_metrics.py` | RC+xi tension/coherence tracking |
|
| 193 |
-
| Quantum Spiderweb | `reasoning_forge/quantum_spiderweb.py` | 5D belief propagation + attractor detection |
|
| 194 |
-
| Cocoon Sync | `reasoning_forge/cocoon_sync.py` | Fernet-encrypted federated state sync |
|
| 195 |
-
| AEGIS | `reasoning_forge/aegis.py` | 6-framework ethical governance (utilitarian, deontological, virtue, care, ubuntu, indigenous) |
|
| 196 |
-
| Nexus Signal Engine | `reasoning_forge/nexus.py` | Pre-corruption detection via entropy + FFT + intent vectors |
|
| 197 |
-
| Living Memory | `reasoning_forge/living_memory.py` | Emotionally-tagged memory cocoons with SHA-256 anchors |
|
| 198 |
-
| Guardian | `reasoning_forge/guardian.py` | 3-layer protection (sanitizer + ethical anchor + trust calibrator) |
|
| 199 |
-
| Perspective Registry | `reasoning_forge/perspective_registry.py` | 12 perspectives (8 LoRA-backed + 4 prompt-only with fallback) |
|
| 200 |
-
|
| 201 |
-
## Architecture
|
| 202 |
-
|
| 203 |
-
```
|
| 204 |
-
codette-training-lab/
|
| 205 |
-
├── dataset_engine/ # Dataset generation pipeline
|
| 206 |
-
│ ├── template_registry.py # Rich template pools per adapter
|
| 207 |
-
│ ├── answer_generator.py # Structured educational answer generation
|
| 208 |
-
│ ├── dataset_generator.py # Main generator with dedup + validation
|
| 209 |
-
│ └── templates/ # JSON template definitions
|
| 210 |
-
│
|
| 211 |
-
├── reasoning_forge/ # Multi-agent reasoning dataset refinement
|
| 212 |
-
│ ├── agents/ # Newton, Quantum, Ethics, Philosophy, DaVinci, Empathy
|
| 213 |
-
│ ├── critic_agent.py # Quality evaluation agent
|
| 214 |
-
│ ├── synthesis_engine.py # Multi-perspective synthesis
|
| 215 |
-
│ ├── problem_generator.py # Reasoning problem generation
|
| 216 |
-
│ └── forge_engine.py # Orchestrator
|
| 217 |
-
│
|
| 218 |
-
├── training/ # LoRA training scripts
|
| 219 |
-
│ ├── train_adapter.py # Single adapter training (4-bit LoRA)
|
| 220 |
-
│ ├── train_all_adapters.py# Sequential multi-adapter training
|
| 221 |
-
│ ├── merge_adapters.py # Merge LoRA into base model
|
| 222 |
-
│ └── configs/ # Training hyperparameters
|
| 223 |
-
│
|
| 224 |
-
├── evaluation/ # Benchmarks and quality assurance
|
| 225 |
-
│ ├── reasoning_metrics.py # Multi-dimensional scoring
|
| 226 |
-
│ ├── benchmark_runner.py # Automated evaluation
|
| 227 |
-
│ ├── dataset_validator.py # Dataset quality checks
|
| 228 |
-
│ ├── failure_analyzer.py # Weakness detection
|
| 229 |
-
│ └── prompts/ # Benchmark test sets
|
| 230 |
-
│
|
| 231 |
-
├── observatory/ # Experiment tracking and monitoring
|
| 232 |
-
│ ├── metrics_logger.py # Training run logging
|
| 233 |
-
│ ├── performance_tracker.py # Improvement trends
|
| 234 |
-
│ ├── dataset_quality_monitor.py
|
| 235 |
-
│ └── dashboard.py # ASCII status dashboard
|
| 236 |
-
│
|
| 237 |
-
├── research/ # Source research documents
|
| 238 |
-
│ ├── papers/ # Published manuscripts
|
| 239 |
-
│ ├── frameworks/ # RC+xi, quantum equations, perspectives
|
| 240 |
-
│ └── experiments/ # Cocoon simulations, logs
|
| 241 |
-
│
|
| 242 |
-
├── datasets/ # Generated training datasets (JSONL)
|
| 243 |
-
├── adapters/ # Trained LoRA adapters
|
| 244 |
-
├── scripts/ # Pipeline orchestration
|
| 245 |
-
│ ├── run_full_pipeline.py # End-to-end pipeline
|
| 246 |
-
│ └── hf_job.yaml # HuggingFace job config
|
| 247 |
-
└── configs/ # System configuration
|
| 248 |
-
├── adapter_registry.yaml
|
| 249 |
-
└── pipeline_config.yaml
|
| 250 |
-
```
|
| 251 |
-
|
| 252 |
-
## Adapters
|
| 253 |
-
|
| 254 |
-
| Adapter | Domain | Target Examples | System Prompt |
|
| 255 |
-
|---------|--------|----------------|---------------|
|
| 256 |
-
| Newton | Analytical physics reasoning | 3000 | Newtonian analytical precision |
|
| 257 |
-
| DaVinci | Creative invention thinking | 2500 | Creative inventiveness |
|
| 258 |
-
| Empathy | Emotional understanding | 2500 | Deep empathy and EQ |
|
| 259 |
-
| Philosophy | Conceptual reasoning | 2000 | Philosophical depth |
|
| 260 |
-
| Quantum | Probabilistic thinking | 2000 | Quantum probabilistic thinking |
|
| 261 |
-
| RC+xi | Recursive cognition | 3000 | RC+xi framework reasoning |
|
| 262 |
-
| Multi-Perspective | Synthesis across lenses | 2500 | Multi-perspective synthesis |
|
| 263 |
-
| Systems | AI architecture | 2000 | System architecture design |
|
| 264 |
-
|
| 265 |
-
## Training Pipeline
|
| 266 |
-
|
| 267 |
-
```
|
| 268 |
-
research documents
|
| 269 |
-
↓
|
| 270 |
-
dataset extraction (template-based generation)
|
| 271 |
-
↓
|
| 272 |
-
synthetic reasoning expansion (counterexamples, variations)
|
| 273 |
-
↓
|
| 274 |
-
dataset validation (dedup, quality filter)
|
| 275 |
-
↓
|
| 276 |
-
reasoning forge (multi-agent critique + refinement)
|
| 277 |
-
↓
|
| 278 |
-
adapter training (4-bit LoRA on Llama 3.1 8B)
|
| 279 |
-
↓
|
| 280 |
-
benchmark evaluation (multi-dimensional reasoning metrics)
|
| 281 |
-
↓
|
| 282 |
-
observatory logging (track improvement over time)
|
| 283 |
-
```
|
| 284 |
-
|
| 285 |
-
## Quick Start
|
| 286 |
-
|
| 287 |
-
### Install dependencies
|
| 288 |
-
|
| 289 |
-
```bash
|
| 290 |
-
pip install -r requirements.txt
|
| 291 |
-
```
|
| 292 |
-
|
| 293 |
-
### Generate all datasets
|
| 294 |
-
|
| 295 |
-
```bash
|
| 296 |
-
python -m dataset_engine.generate_all
|
| 297 |
-
```
|
| 298 |
-
|
| 299 |
-
### Run full pipeline
|
| 300 |
-
|
| 301 |
-
```bash
|
| 302 |
-
python scripts/run_full_pipeline.py --all
|
| 303 |
-
```
|
| 304 |
-
|
| 305 |
-
### Generate + validate only
|
| 306 |
-
|
| 307 |
-
```bash
|
| 308 |
-
python scripts/run_full_pipeline.py --generate --validate
|
| 309 |
-
```
|
| 310 |
-
|
| 311 |
-
### Train a single adapter
|
| 312 |
-
|
| 313 |
-
```bash
|
| 314 |
-
python -m training.train_adapter \
|
| 315 |
-
--dataset datasets/newton_reasoning.jsonl \
|
| 316 |
-
--adapter-name newton \
|
| 317 |
-
--output-dir adapters/newton
|
| 318 |
-
```
|
| 319 |
-
|
| 320 |
-
### Evaluate Phase 6 Component Impact
|
| 321 |
-
|
| 322 |
-
Compare 4 conditions to isolate Phase 6 value:
|
| 323 |
-
- **Baseline**: Llama only (no routing)
|
| 324 |
-
- **Phase 1-5**: Debate system without semantic tension or specialization
|
| 325 |
-
- **Phase 6 Full**: All components (semantic tension, specialization, pre-flight)
|
| 326 |
-
- **Phase 6 -PreFlight**: Phase 6 without pre-flight prediction
|
| 327 |
-
|
| 328 |
-
```bash
|
| 329 |
-
python run_phase6_evaluation.py
|
| 330 |
-
```
|
| 331 |
-
|
| 332 |
-
Generates statistical analysis and emergent behavior alerts:
|
| 333 |
-
- Correctness improvement (expected 0.20 → 0.70+ on simple queries)
|
| 334 |
-
- Reasoning depth per domain
|
| 335 |
-
- Adapter convergence detection
|
| 336 |
-
- Miscalibration warnings
|
| 337 |
-
|
| 338 |
-
Results exported to `evaluation_results_YYYYMMDD_HHMMSS.json`
|
| 339 |
-
|
| 340 |
-
## Dataset Format
|
| 341 |
-
|
| 342 |
-
All datasets use chat-format JSONL:
|
| 343 |
-
|
| 344 |
-
```json
|
| 345 |
-
{
|
| 346 |
-
"messages": [
|
| 347 |
-
{"role": "system", "content": "You are Codette, a recursive multi-perspective reasoning AI."},
|
| 348 |
-
{"role": "user", "content": "Explain the conservation of momentum using a real-world example."},
|
| 349 |
-
{"role": "assistant", "content": "Conservation of momentum states that in a closed system..."}
|
| 350 |
-
]
|
| 351 |
-
}
|
| 352 |
-
```
|
| 353 |
-
|
| 354 |
-
## Reasoning Forge
|
| 355 |
-
|
| 356 |
-
The Reasoning Forge refines training data through multi-agent debate:
|
| 357 |
-
|
| 358 |
-
```
|
| 359 |
-
concept → problem generator → agent analysis → critic evaluation → synthesis → training example
|
| 360 |
-
```
|
| 361 |
-
|
| 362 |
-
Agents: Newton (physics), Quantum (probability), Ethics (alignment), Philosophy (meaning), DaVinci (creativity), Empathy (emotion)
|
| 363 |
-
|
| 364 |
-
Each agent analyzes from its perspective, the critic scores quality, and the synthesis engine produces a unified multi-perspective response.
|
| 365 |
-
|
| 366 |
-
## Base Model
|
| 367 |
-
|
| 368 |
-
- **Model**: meta-llama/Llama-3.1-8B-Instruct
|
| 369 |
-
- **Method**: QLoRA (4-bit quantization)
|
| 370 |
-
- **LoRA config**: rank=16, alpha=32, target=q/k/v/o projections
|
| 371 |
-
|
| 372 |
-
## Research Background
|
| 373 |
-
|
| 374 |
-
Codette implements the RC+xi (Recursive Convergence + Epistemic Tension) framework for structured multi-perspective reasoning. The system coordinates 11 reasoning perspectives in parallel before synthesizing a final response.
|
| 375 |
-
|
| 376 |
-
Key research documents in `research/`:
|
| 377 |
-
- RC+xi Framework specification
|
| 378 |
-
- Quantum Cosmic Multicore experiment
|
| 379 |
-
- Codette Research Equations (8 core quantum mathematics)
|
| 380 |
-
- Multi-perspective reasoning architecture
|
| 381 |
-
|
| 382 |
-
## Inference & Evaluation
|
| 383 |
-
|
| 384 |
-
### Interactive Web UI
|
| 385 |
-
|
| 386 |
-
Launch the real-time multi-perspective reasoning UI:
|
| 387 |
-
|
| 388 |
-
```bash
|
| 389 |
-
# Launch web interface (default port 5000)
|
| 390 |
-
python inference/codette_server.py
|
| 391 |
-
|
| 392 |
-
# Or use the batch file (Windows)
|
| 393 |
-
codette_web.bat
|
| 394 |
-
```
|
| 395 |
-
|
| 396 |
-
Features:
|
| 397 |
-
- Real-time adapter hot-swap (0ms switching via llama.cpp LoRA)
|
| 398 |
-
- **Real LLM-backed agents** (not templates) generating domain-specific reasoning
|
| 399 |
-
- GPU acceleration (35 layers offloaded)
|
| 400 |
-
- Quantum spiderweb visualization
|
| 401 |
-
- Live AEGIS ethical alignment tracking
|
| 402 |
-
- Memory cocoon emotional profiling
|
| 403 |
-
|
| 404 |
-
### Evaluation & Testing
|
| 405 |
-
|
| 406 |
-
**Standard Evaluation** (4 conditions × 25 questions):
|
| 407 |
-
```bash
|
| 408 |
-
python evaluation/run_evaluation_sprint.py --questions 5
|
| 409 |
-
```
|
| 410 |
-
|
| 411 |
-
**Real-Time Agent Thinking** (see agents reasoning in real-time):
|
| 412 |
-
```bash
|
| 413 |
-
python evaluation/run_evaluation_verbose.py --questions 1
|
| 414 |
-
```
|
| 415 |
-
|
| 416 |
-
Shows:
|
| 417 |
-
- Agent mode: ✓ LLM (real inference) or ✗ TEMPLATE (fallback)
|
| 418 |
-
- System prompts used
|
| 419 |
-
- Token generation
|
| 420 |
-
- Domain detection and agent gating
|
| 421 |
-
- Conflict detection and capping
|
| 422 |
-
- Gamma coherence monitoring
|
| 423 |
-
- Final synthesis
|
| 424 |
-
|
| 425 |
-
**Verbose Logs** with `CODETTE_VERBOSE=1`:
|
| 426 |
-
```bash
|
| 427 |
-
CODETTE_VERBOSE=1 python evaluation/run_evaluation_verbose.py
|
| 428 |
-
```
|
| 429 |
-
|
| 430 |
-
Shows each agent's thinking step-by-step.
|
| 431 |
-
|
| 432 |
-
## LoRA Configuration
|
| 433 |
-
|
| 434 |
-
```yaml
|
| 435 |
-
method: QLoRA (4-bit NF4 quantization)
|
| 436 |
-
rank: 16
|
| 437 |
-
alpha: 32
|
| 438 |
-
dropout: 0.05
|
| 439 |
-
target_modules: [q_proj, k_proj, v_proj, o_proj]
|
| 440 |
-
total_training_examples: 20,500
|
| 441 |
-
```
|
| 442 |
-
|
| 443 |
-
## RC+xi Framework
|
| 444 |
-
|
| 445 |
-
The core theoretical framework — **Recursive Convergence + Epistemic Tension** — coordinates 11 reasoning perspectives:
|
| 446 |
-
|
| 447 |
-
1. Newton (analytical physics) → `newton` adapter
|
| 448 |
-
2. DaVinci (creative invention) → `davinci` adapter
|
| 449 |
-
3. Empathy (emotional intelligence) → `empathy` adapter
|
| 450 |
-
4. Philosophy (conceptual reasoning) → `philosophy` adapter
|
| 451 |
-
5. Quantum (probabilistic thinking) → `quantum` adapter
|
| 452 |
-
6. RC+xi Consciousness → `consciousness` adapter
|
| 453 |
-
7. Multi-Perspective Synthesis → `multi_perspective` adapter
|
| 454 |
-
8. Systems Architecture → `systems_architecture` adapter
|
| 455 |
-
9. Human Intuition → prompt-only (fallback: `empathy`)
|
| 456 |
-
10. Resilient Kindness → prompt-only (fallback: `empathy`)
|
| 457 |
-
11. AEGIS Ethics → prompt-only (fallback: `consciousness`)
|
| 458 |
-
|
| 459 |
-
## Requirements
|
| 460 |
-
|
| 461 |
-
- Python 3.10+
|
| 462 |
-
- PyTorch 2.1+ (CUDA, ROCm, or XPU backend)
|
| 463 |
-
- 16GB+ RAM (CPU training) or GPU with 8GB+ VRAM
|
| 464 |
-
- llama.cpp with GGUF support (for inference server)
|
| 465 |
-
- ~1-3 hours per adapter (CPU) or 20-40 min (A10/A100 GPU)
|
| 466 |
-
|
| 467 |
-
## Hardware Tested
|
| 468 |
-
|
| 469 |
-
- Intel Arc 140V (8GB) — PyTorch 2.10.0+xpu, native XPU backend
|
| 470 |
-
- NVIDIA GPUs via CUDA (A10, A100, RTX series)
|
| 471 |
-
- CPU-only mode supported
|
| 472 |
-
|
| 473 |
-
## License
|
| 474 |
-
|
| 475 |
-
MIT — Research project by Jonathan Harrison. Experimental AI development.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3.1
|
| 3 |
+
tags:
|
| 4 |
+
- codette
|
| 5 |
+
- reasoning
|
| 6 |
+
- multi-perspective
|
| 7 |
+
- training-data
|
| 8 |
+
- synthetic
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Codette Reasoning - Training Datasets
|
| 15 |
+
|
| 16 |
+
Synthetic training datasets for the **Codette Multi-Perspective Reasoning System**.
|
| 17 |
+
|
| 18 |
+
Each dataset contains instruction-tuning examples designed to teach a specific cognitive reasoning perspective to Llama 3.1 8B Instruct via LoRA fine-tuning.
|
| 19 |
+
|
| 20 |
+
## Datasets
|
| 21 |
+
|
| 22 |
+
| Dataset | Adapter | Examples | Description |
|
| 23 |
+
|---|---|---|---|
|
| 24 |
+
| newton_reasoning.jsonl | Newton | 3000 | Analytical physics, systematic reasoning, empirical evidence |
|
| 25 |
+
| davinci_reasoning.jsonl | DaVinci | 2500 | Creative invention, cross-domain connections, visual thinking |
|
| 26 |
+
| empathy_reasoning.jsonl | Empathy | 2500 | Emotional intelligence, human experience, compassion |
|
| 27 |
+
| philosophy_reasoning.jsonl | Philosophy | 2000 | Conceptual analysis, ethical reasoning, fundamental questions |
|
| 28 |
+
| quantum_reasoning.jsonl | Quantum | 2000 | Probabilistic thinking, superposition, complementarity |
|
| 29 |
+
| consciousness_reasoning.jsonl | Consciousness | 3000 | Recursive cognition (RC+xi), meta-cognition, epistemic tension |
|
| 30 |
+
| multi_perspective_reasoning.jsonl | Multi-Perspective | 2500 | Cross-lens synthesis, integrative reasoning |
|
| 31 |
+
| systems_architecture_reasoning.jsonl | Systems Architecture | 2000 | Modularity, scalability, engineering principles |
|
| 32 |
+
| orchestrator_reasoning.jsonl | Orchestrator | 4000 | Query routing, debate coordination, coherence monitoring |
|
| 33 |
+
|
| 34 |
+
**Total: ~24,500 training examples**
|
| 35 |
+
|
| 36 |
+
## Format
|
| 37 |
+
|
| 38 |
+
Each JSONL file contains records in chat-completion format:
|
| 39 |
+
|
| 40 |
+
```json
|
| 41 |
+
{
|
| 42 |
+
"messages": [
|
| 43 |
+
{"role": "system", "content": "You are Codette, reasoning with Newtonian analytical precision."},
|
| 44 |
+
{"role": "user", "content": "Explain the relationship between force and acceleration."},
|
| 45 |
+
{"role": "assistant", "content": "From an analytical physics perspective..."}
|
| 46 |
+
]
|
| 47 |
+
}
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Generation Method
|
| 51 |
+
|
| 52 |
+
Datasets are generated using a pure-Python template engine (no model inference required):
|
| 53 |
+
|
| 54 |
+
1. **Template Registry**: 30-60 question templates per adapter with variable slots
|
| 55 |
+
2. **Topic Engine**: 40-80 topics with subtopics for domain-specific coverage
|
| 56 |
+
3. **Answer Generator**: Structured educational answers (80-200 words) with perspective-specific framing
|
| 57 |
+
4. **Counterexamples**: 12% of examples include counterexample reasoning for robustness
|
| 58 |
+
5. **Phase 6+ Awareness**: All templates incorporate semantic tension, coherence field, and AEGIS concepts
|
| 59 |
+
|
| 60 |
+
## Phase 6+ Framework Coverage
|
| 61 |
+
|
| 62 |
+
The datasets teach these framework concepts across all perspectives:
|
| 63 |
+
|
| 64 |
+
- **Semantic Tension (xi)**: Measuring and working with epistemic disagreement
|
| 65 |
+
- **Coherence Field (Gamma)**: Monitoring reasoning health and detecting collapse
|
| 66 |
+
- **Quantum Spiderweb**: Belief propagation and perspective interconnection
|
| 67 |
+
- **AEGIS Governance**: Ethical validation across 6 frameworks (utilitarian, deontological, virtue, care, justice, rights)
|
| 68 |
+
- **Specialization Tracking**: Domain expertise development and confidence calibration
|
| 69 |
+
- **Pre-flight Prediction**: Anticipating conflicts before multi-agent debate
|
| 70 |
+
|
| 71 |
+
## Usage
|
| 72 |
+
|
| 73 |
+
### Load with HuggingFace Datasets
|
| 74 |
+
```python
|
| 75 |
+
from datasets import load_dataset
|
| 76 |
+
|
| 77 |
+
ds = load_dataset("Raiff1982/Codette-Reasoning", data_files="newton_reasoning.jsonl")
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
### Train a LoRA Adapter
|
| 81 |
+
```python
|
| 82 |
+
from trl import SFTTrainer
|
| 83 |
+
from peft import LoraConfig
|
| 84 |
+
|
| 85 |
+
lora_config = LoraConfig(
|
| 86 |
+
r=16, lora_alpha=32, lora_dropout=0.05,
|
| 87 |
+
target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
|
| 88 |
+
task_type="CAUSAL_LM",
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
trainer = SFTTrainer(
|
| 92 |
+
model=base_model,
|
| 93 |
+
train_dataset=ds["train"],
|
| 94 |
+
peft_config=lora_config,
|
| 95 |
+
max_seq_length=2048,
|
| 96 |
+
num_train_epochs=3,
|
| 97 |
+
)
|
| 98 |
+
trainer.train()
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Related Repos
|
| 102 |
+
|
| 103 |
+
- [Raiff1982/codette-llama-3.1-8b-gguf](https://huggingface.co/Raiff1982/codette-llama-3.1-8b-gguf) - Quantized GGUF model
|
| 104 |
+
- [Raiff1982/codette-lora-adapters](https://huggingface.co/Raiff1982/codette-lora-adapters) - Trained LoRA adapters
|
| 105 |
+
- [Raiff1982/codette-llama-3.1-8b-merged](https://huggingface.co/Raiff1982/codette-llama-3.1-8b-merged) - Merged orchestrator model
|
| 106 |
+
|
| 107 |
+
## License
|
| 108 |
+
|
| 109 |
+
Datasets are released under the same terms as the Llama 3.1 model they are designed to fine-tune.
|
| 110 |
+
Subject to the [Llama 3.1 Community License](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/LICENSE).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|