TVC Distributed Learning
TVC (Ternary Vector Corpus) is Trinity's distributed continual learning system. It provides zero-forgetting knowledge storage using ternary vector embeddings, bundled into a persistent corpus for instant retrieval.
Commands
tvc-demo
Interactive demonstration of the TVC distributed learning system.
Aliases: tvc
tri tvc-demo
Shows:
- Corpus architecture and configuration
- Hit/miss semantics with cosine similarity
- Bundling and retrieval demo
- Distributed learning flow
Example output:
TVC DISTRIBUTED LEARNING — DEMO
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Architecture:
┌──────────────┐ ┌──────────────┐
│ Query │───→│ TVC Corpus │
│ (embed) │ │ 10K entries │
└──────────────┘ └──────┬───────┘
│
┌────────┴────────┐
│ Similarity ≥ φ⁻¹│
│ (0.618)? │
└────────┬────────┘
YES │ NO
┌───────┐ │ ┌───────┐
│ CACHE │ │ LLM │
│ HIT │ │ CALL │
└────────┘ └───────┘
Configuration:
Capacity: 10,000 entries (100x TextCorpus)
Dimensions: 1,000 trits per vector
Threshold: phi^-1 = 0.618
Encoding: Ternary {-1, 0, +1}
File format: .tvc (TVC1 magic header)
Memory: ~26 MB heap-allocated
tvc-stats
Display TVC corpus configuration and statistics.
tri tvc-stats
Example output:
TVC STATISTICS
═══════════════════════════════════════════════════════════════════
TVC Enabled: Ready
Max Entries: 10,000
Vector Dimension: 1,000 trits
Threshold: 0.618 (phi^-1)
File Format: .tvc (TVC1 magic)
═══════════════════════════════════════════════════════════════════
Architecture
How TVC Works
- Query embedding: User input is converted to a 1,000-trit ternary vector
- Similarity search: Cosine similarity is computed against all corpus entries
- Threshold check: If similarity , it's a cache hit
- Hit: Return cached response instantly (no LLM call needed)
- Miss: Call LLM, then store the query-response pair in the corpus
Zero-Forgetting Bundling
TVC uses the VSA bundle operation (majority vote) to accumulate all learned patterns into a single memory_vector. This means:
- No patterns are ever discarded
- New knowledge is bundled with existing knowledge
- Retrieval uses cosine similarity against the bundled vector
- Capacity: 10,000 discrete entries + 1 bundled memory vector
Comparison with TextCorpus
| Feature | TextCorpus | TVC Corpus |
|---|---|---|
| Capacity | 100 entries | 10,000 entries |
| Vector type | Float32 | Ternary 1 |
| Memory | ~40 MB | ~26 MB |
| Compression | None | 20x (vs float32) |
| Forgetting | FIFO eviction | Zero-forgetting |
| Bundling | No | Yes (majority vote) |
| File format | JSON | .tvc binary |
File Format
TVC files use a binary format with a TVC1 magic header:
Offset Size Field
0x00 4 Magic: "TVC1"
0x04 4 Version
0x08 4 Entry count
0x0C 4 Vector dimension
0x10 48 Reserved
0x40 ... Entries (vector + metadata)
Save path: data/trinity_chat.tvc (auto-saved on REPL exit)
Sacred Mathematics
The TVC threshold is derived from the golden ratio:
This is the Needle threshold (Koschei's Needle) — the minimum similarity required for a cache hit. The number is the reciprocal of the golden ratio and appears throughout Trinity's architecture as the quality gate.
Integration with Chat
TVC is automatically loaded when starting the REPL or using tri chat:
# TVC is loaded automatically
tri chat "What is VSA?"
# First time: LLM call + stored in TVC
# Second time: instant cache hit
tri chat "What is VSA?"
The TVC corpus persists across sessions via the data/trinity_chat.tvc file.
See Also
- Interactive REPL — REPL mode with TVC integration
- Core Commands — Chat command details
- Demos & Benchmarks — Needle Check benchmarks
- Sacred Math — Golden ratio constants