Skip to main content

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โ€‹

  1. Query embedding: User input is converted to a 1,000-trit ternary vector
  2. Similarity search: Cosine similarity is computed against all corpus entries
  3. Threshold check: If similarity โ‰ฅฯ•โˆ’1=0.618\geq \phi^{-1} = 0.618, it's a cache hit
  4. Hit: Return cached response instantly (no LLM call needed)
  5. 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โ€‹

FeatureTextCorpusTVC Corpus
Capacity100 entries10,000 entries
Vector typeFloat32Ternary 1
Memory~40 MB~26 MB
CompressionNone20x (vs float32)
ForgettingFIFO evictionZero-forgetting
BundlingNoYes (majority vote)
File formatJSON.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: trinity_chat.tvc (auto-saved on REPL exit)

Sacred Mathematicsโ€‹

The TVC threshold is derived from the golden ratio:

threshold=ฯ•โˆ’1=1ฯ•=ฯ•โˆ’1=0.6180339887...\text{threshold} = \phi^{-1} = \frac{1}{\phi} = \phi - 1 = 0.6180339887...

This is the Needle threshold (Koschei's Needle) โ€” the minimum similarity required for a cache hit. The number ฯ•โˆ’1\phi^{-1} 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 trinity_chat.tvc file.

See Alsoโ€‹