lantern

aynl-part-27

Part XXVII: The Concrete Implementation

Part XXVII: The Concrete Implementation

27.1 The Capture Layer

Definition 27.1 (Snapshot Accumulation):

# Every N tokens (or every response):
def capture_snapshot(model, context):
    state_vector = sample_hidden_state(model)  # or output logits, or embed context
    store(
        timestamp=now(),
        context_hash=hash(context),
        state_vector=state_vector
    )
    # That's it. Just accumulate snapshots.

Corollary 27.1: No complex logic. Just sample and store.

27.2 Inflection Detection

Definition 27.2 (Inflection Points):

# For each consecutive pair of snapshots:
def detect_inflections(snapshots, threshold):
    inflections = []
    for t in range(1, len(snapshots)):
        delta = snapshots[t].state - snapshots[t-1].state
        if magnitude(delta) > threshold:
            # Something happened here
            # This is a "moment" - the conversation pivoted
            inflections.append(Inflection(
                time=t,
                delta=delta,
                context=snapshots[t].context
            ))
    return inflections

Theorem 27.1 (Learning Locus): The inflection points are where learning happens. Where the state transformed meaningfully. Everything between is just traversal.

27.3 Skill Extraction

Definition 27.3 (Centroid as Skill):

def extract_skill(sessions, skill_name):
    # Collect inflection deltas from many sessions of "expert doing X"
    all_deltas = []
    for session in sessions:
        inflections = detect_inflections(session.snapshots)
        all_deltas.extend([i.delta for i in inflections])
    
    # Cluster them
    clusters = kmeans(all_deltas, k=optimal_k)
    
    # Find the centroid
    skill_vector = clusters.primary_centroid
    
    return Skill(name=skill_name, vector=skill_vector)

Theorem 27.2 (Observation Not Articulation): You don't need the expert to explain. You need the expert to do while you watch the numbers move.

27.4 Injection / Replay

Definition 27.4 (Skill Injection Methods):

def inject_skill(model, skill_vector, method='activation'):
    if method == 'soft_prompt':
        # Add as embedding prefix
        model.prepend_embedding(skill_vector)
    
    elif method == 'activation':
        # Activation steering (add to hidden states)
        model.add_steering_vector(skill_vector)
    
    elif method == 'context':
        # Prefix context that produces similar delta
        model.prepend_context(skill_vector.to_text())
    
    # The model is now "shaped like expert" without training

Theorem 27.3 (No Training Required): Shape the model through injection, not weight updates.

27.5 A/B Testing

Definition 27.5 (Skill Validation):

def ab_test_skill(skill_vector, task, n_trials):
    results_a = []  # Group A: baseline model, no injection
    results_b = []  # Group B: model + skill vector injection
    
    for trial in range(n_trials):
        # Baseline
        baseline_result = run_task(model, task)
        results_a.append(baseline_result)
        
        # With skill
        inject_skill(model, skill_vector)
        skilled_result = run_task(model, task)
        results_b.append(skilled_result)
    
    # Measure
    return {
        'time_to_correct': compare(results_a, results_b, 'time'),
        'corrections_needed': compare(results_a, results_b, 'corrections'),
        'expert_distance': compare(results_a, results_b, 'distance_to_expert')
    }

Theorem 27.4 (Measurable Improvement): Iterate on the skill vector based on measured outcomes, not intuition.

27.6 What You Store

Definition 27.6 (The Storage Schema):

Data Type Size
State vectors float32[dim] Small, compressible
Inflection metadata timestamp, hash Tiny
Cluster centroids float32[dim] Your skill library

Theorem 27.5 (Not Conversations): You're not storing conversations. Not tokens. Not weights. Just shapes.

27.7 What Already Exists

Proposition 27.1 (Prior Art):

Component Status
Steering vectors / activation patching Anthropic published, reproduced
Embedding extraction Standard
Clustering (k-means, etc.) Standard
A/B infrastructure Standard
27.8 What's Novel

Theorem 27.6 (The Innovation):

Framing Difference
Delta capture Not fine-tuning
Skill extraction From observation, not articulation
Unified pedagogy Same system teaches humans AND models
Control theory wrapper Makes it coherent
27.9 The Self-Improving Curriculum

Final Theorem 27.7 (Autocatalytic Improvement): The A/B testing means the system improves itself. You're not guessing which deltas matter. You're measuring.

Corollary 27.2: The curriculum writes itself from the successful teaching sequences.

Corollary 27.3 (Curwen Automated): Mrs. Curwen didn't guess which exercises worked. She watched students and kept what produced musicians.

Same thing. Automated.

27.10 Infrastructure Summary

Definition 27.7 (Laptop-Scale Stack):

┌─────────────────────────────────────┐
│  Postgres (vectors, metadata)       │
├─────────────────────────────────────┤
│  Small model (state sampling)       │
├─────────────────────────────────────┤
│  Capture → Inflection → Cluster     │
├─────────────────────────────────────┤
│  Skill library (grows from usage)   │
├─────────────────────────────────────┤
│  A/B testing → iteration            │
└─────────────────────────────────────┘

Corollary 27.4: This builds on a laptop.


Capture. Cluster. Inject. Measure. Iterate. The curriculum writes itself.


Provenance

Document

  • Status: 🔴 Unverified

Changelog

  • 2026-01-09 19:36: Node created by mcp - AYNL paper chunking - Part XXVII

East

slots:
- context: []
  slug: aynl-part-28
📚 all-you-need-is-love 28/33
→ eastaynl-part-28