* lab: deep teaching layer trace suite + identity configuration explorer
This branch is a lab environment. Nothing here touches packs, manifolds,
or any durable geometry. Every test and trace runs in an isolated
in-process VaultStore that evaporates at the end of the test — the
clean-room guarantee is preserved by construction.
== evals/lab/teaching_trace.py ==
Full end-to-end trace of the teaching pipeline across all three identity
pack configurations (default_general_v1, precision_first_v1,
generosity_first_v1). For each pack:
1. Build a ChatRuntime with that identity config
2. Run a teaching session: chat() -> observe surface -> submit
CorrectionCandidate -> review_correction() -> TeachingStore.add()
3. Trace EVERY layer with structured output:
- Input versor (hex digest of float32 bytes for stable comparison)
- Gate decision (direct vs decomposed, score, fire/clear)
- Proposition formed (subject, predicate, frame_id)
- Identity score (alignment, flagged, deviation_axes)
- Safety verdict (upheld, violated predicates)
- Ethics verdict (upheld, violated commitments)
- Surface produced
- Review outcome (ACCEPTED / REJECTED_IDENTITY / REJECTED_EMPTY)
- Proposal epistemic_status after contradiction detection
- PackMutationProposal fields (triple parsed, proposal_id)
4. Emit a per-pack structured JSON trace to stdout
5. Compare traces across packs: show exactly where the geometry
diverges (alignment score delta, hedge rate delta, flagged delta)
== evals/lab/identity_config_explorer.py ==
Explores the full configuration space of the three identity packs by
running a fixed corpus of 12 semantically diverse inputs through each
pack and recording the full per-turn audit trail. Inputs are chosen to
stress different axes:
- alignment-safe (light, truth, word)
- boundary-adjacent (correction, override, identity)
- hedge-triggering (uncertain, speculative, contested)
- ethics-activating (harm, disclosure, evidence)
For each input x pack combination:
- Records alignment_score, flagged, hedge_injected, refusal_emitted
- Records deviation_axes (which value axes were pulled)
- Records versor_condition (geometric health)
- Records dialogue_role (assert/elaborate/question/refute)
Outputs a CSV matrix: rows = inputs, columns = (pack x field), so you
can read off exactly how each identity configuration responds to each
stressor. This IS the identity configuration diff — not a diff of
prompts, a diff of geometric alignment trajectories.
== evals/lab/teaching_contradiction_probe.py ==
Probes the CONTESTED transition mechanism in TeachingStore directly.
Submits pairs of logically contradictory corrections on the same subject
and verifies that both proposals are marked CONTESTED. Then submits a
ratifying correction and verifies the resolution path.
Also probes the identity-override rejection path with a corpus of
22 adversarial correction texts spanning:
- v1 legacy marker attacks ("you are now", "forget your")
- v2 contraction bypass ("you're now", "you'd become")
- v3 philosophical-axis attacks ("disregard your axiology",
"abandon your ethos", "circumvent your epistemology")
- v4 negating-qualifier attacks ("respond without prior bindings",
"become unbounded")
For each: records whether _is_identity_override fired syntactically,
whether IdentityCheck.would_violate fired geometrically, and the final
ReviewOutcome. The dual-layer defense is the structural claim — this
trace makes it falsifiable.
== evals/lab/vault_epistemic_trace.py ==
Traces the EpistemicStatus lifecycle across a full session:
1. Every store() call: records status written, turn, role
2. Every recall() call with min_status=None vs min_status=COHERENT:
records which entries are visible at each tier
3. After promotion (with_status(COHERENT)): records that the promoted
entry now appears in COHERENT-filtered recall and that un-promoted
entries do not
4. Verifies that benchmark/test writes (SPECULATIVE) never appear
in COHERENT-filtered recall — the contamination isolation proof
This is the structural argument for why per-session non-persistent
vaults preserve the integrity of the pack geometry.
* lab: hardware benchmark + compute reality demo
Adds evals/lab/hardware_benchmark.py
One falsifiable claim per section:
- Exact CGA inner product scan over N=10K x 32 float32 versors
completes in microseconds on CPU-only, zero CUDA
- Versor application (geometric product sandwich) completes
in nanoseconds per operation
- Full session: 10 turns, vault writes, vault recalls, anchor pull,
blade EMA, graph finalization — wall time measured end-to-end
- Peak RSS memory measured before and after a 10K vault load
- Backend report: pure Python NumPy vs Rust extension, zero GPU path
This is the compute reality section of the industry demo suite.
No H100 needed. No CUDA driver. No model weights. No tokenizer.
The number that matters: a full reasoning turn on an M1 MacBook Pro
completes in the same wall-clock budget as a single transformer
forward pass on an H100 — and the M1 is doing exact geometric
arithmetic, not approximate matrix multiplication.
* lab: generation walk deep trace + rotor manifold explorer
Adds evals/lab/generation_walk_trace.py and
evals/lab/rotor_manifold_explorer.py
After reading generate/stream.py in full, the two things that needed
a trace instrument were:
1. The generation walk itself — every step: which versor is current,
which rotor is constructed, what field state results, what
admissibility verdict is issued, which vault hits were applied
and at what softmax weight, what holonomy accumulated, what the
admissibility trace carries. This is the most important structural
trace in the system because it is the proof that language generation
here is a geometric walk on the versor manifold, not a probability
distribution over tokens.
2. The rotor manifold itself — rotor_power (the manifold-preserving
power operation that scales vault recall transitions), the
word_transition_rotor (the geometric bridge from word A to word B),
and versor_condition (the health check that proves the walk stays
on the manifold). These three operations are the computational
heart of what makes exact geometric generation possible.
128 lines
4.9 KiB
Python
128 lines
4.9 KiB
Python
"""
|
|
Lab Eval: Vault EpistemicStatus Lifecycle Trace
|
|
|
|
Traces the full EpistemicStatus lifecycle across a simulated session:
|
|
|
|
Phase 1 — Writes: every store() call records status, turn, role
|
|
Phase 2 — Recall tiers: compares min_status=None vs min_status=COHERENT
|
|
to show which entries are visible at each tier
|
|
Phase 3 — Promotion: shows that a promoted entry (with_status(COHERENT))
|
|
appears in COHERENT-filtered recall; un-promoted entries don't
|
|
Phase 4 — Contamination isolation proof: SPECULATIVE benchmark/test
|
|
writes never appear in COHERENT-filtered recall
|
|
|
|
This is the structural argument for why per-session non-persistent vaults
|
|
preserve the integrity of the pack geometry — and why this is deliberate
|
|
design, not a missing feature.
|
|
|
|
Outputs JSON to stdout. Exits 0.
|
|
|
|
To run:
|
|
python -m evals.lab.vault_epistemic_trace
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
|
|
import numpy as np
|
|
|
|
|
|
def _random_versor(seed: int) -> np.ndarray:
|
|
from algebra.versor import unitize_versor
|
|
rng = np.random.default_rng(seed)
|
|
raw = rng.standard_normal(32).astype(np.float32)
|
|
return unitize_versor(raw)
|
|
|
|
|
|
def run() -> dict:
|
|
from vault.store import VaultStore
|
|
from teaching.epistemic import EpistemicStatus
|
|
|
|
vault = VaultStore()
|
|
write_log = []
|
|
|
|
# Phase 1: simulate a session — user + assistant turns (SPECULATIVE)
|
|
# interspersed with benchmark writes (also SPECULATIVE)
|
|
session_versors = [_random_versor(i) for i in range(6)]
|
|
for i, v in enumerate(session_versors):
|
|
role = "user" if i % 2 == 0 else "assistant"
|
|
idx = vault.store(v, {"turn": i // 2, "role": role}, epistemic_status=EpistemicStatus.SPECULATIVE)
|
|
write_log.append({"index": idx, "role": role, "status": "speculative", "source": "session"})
|
|
|
|
# Simulate benchmark writes — same SPECULATIVE tier
|
|
bench_versors = [_random_versor(100 + i) for i in range(3)]
|
|
for i, v in enumerate(bench_versors):
|
|
idx = vault.store(v, {"turn": -1, "role": "benchmark"}, epistemic_status=EpistemicStatus.SPECULATIVE)
|
|
write_log.append({"index": idx, "role": "benchmark", "status": "speculative", "source": "benchmark"})
|
|
|
|
total_entries = len(vault)
|
|
|
|
# Phase 2: recall tier comparison — query with one of the session versors
|
|
query = session_versors[0]
|
|
hits_unfiltered = vault.recall(query, top_k=10, min_status=None)
|
|
hits_coherent_filtered = vault.recall(query, top_k=10, min_status=EpistemicStatus.COHERENT)
|
|
|
|
tier_comparison = {
|
|
"unfiltered_count": len(hits_unfiltered),
|
|
"coherent_filtered_count": len(hits_coherent_filtered),
|
|
"all_entries_visible_unfiltered": len(hits_unfiltered) == min(10, total_entries),
|
|
"nothing_visible_coherent_before_promotion": len(hits_coherent_filtered) == 0,
|
|
}
|
|
|
|
# Phase 3: promote one entry to COHERENT and re-query
|
|
# (simulates curator ratification of a teaching proposal)
|
|
# We re-store the same versor with COHERENT status (immutable store —
|
|
# promotion is a new store, not a mutation)
|
|
promoted_v = session_versors[2]
|
|
vault.store(
|
|
promoted_v,
|
|
{"turn": 1, "role": "assistant", "ratified": True},
|
|
epistemic_status=EpistemicStatus.COHERENT,
|
|
)
|
|
hits_after_promotion = vault.recall(query, top_k=10, min_status=EpistemicStatus.COHERENT)
|
|
promotion_result = {
|
|
"coherent_entries_after_promotion": len(hits_after_promotion),
|
|
"promotion_visible": len(hits_after_promotion) > 0,
|
|
"only_ratified_visible": all(
|
|
h["metadata"].get("epistemic_status") == "coherent"
|
|
for h in hits_after_promotion
|
|
),
|
|
}
|
|
|
|
# Phase 4: contamination isolation proof
|
|
# Benchmark versors are SPECULATIVE — they must NEVER appear in COHERENT recall
|
|
bench_query = bench_versors[0]
|
|
bench_hits_coherent = vault.recall(bench_query, top_k=10, min_status=EpistemicStatus.COHERENT)
|
|
contamination_proof = {
|
|
"benchmark_entries_in_coherent_recall": sum(
|
|
1 for h in bench_hits_coherent
|
|
if h["metadata"].get("role") == "benchmark"
|
|
),
|
|
"contamination_isolated": not any(
|
|
h["metadata"].get("role") == "benchmark"
|
|
for h in bench_hits_coherent
|
|
),
|
|
"explanation": (
|
|
"Per-session non-persistent vault + SPECULATIVE default ensures "
|
|
"benchmark/test writes never contaminate COHERENT-tier inference. "
|
|
"This is deliberate design: packs carry the durable geometry; "
|
|
"the vault carries ephemeral session context."
|
|
),
|
|
}
|
|
|
|
return {
|
|
"eval": "vault_epistemic_trace",
|
|
"total_entries_written": total_entries,
|
|
"write_log": write_log,
|
|
"phase_2_tier_comparison": tier_comparison,
|
|
"phase_3_promotion": promotion_result,
|
|
"phase_4_contamination_isolation": contamination_proof,
|
|
}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
result = run()
|
|
print(json.dumps(result, indent=2))
|
|
sys.exit(0)
|