feat: complete Phase 1 - vocabulary expansion & DriftProbe infrastructure
- CLI: nyx-probe scan with --summary/--delta/--full flags - DriftProbe: training safety with Gini coefficient + Angular Drift - Vocabulary: 54 terms (30 nimmerverse + 24 German philosophical) - Sentinels: ANCHOR/BRIDGE/CANARY/TARGET monitoring system Key findings: - German philosophical terms: 37.5% depth≥2 hit rate (vs 3.3% nimmerverse) - Super Cluster validated: heart cross-lang sim = 1.000 - Isolated Zone confirmed: being EN↔DE sim = 0.195 - Gini signature: Philosophy ~0.5 (diffuse), Technical ~0.8 (sparse) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
58
nyx_probing/probes/base.py
Normal file
58
nyx_probing/probes/base.py
Normal file
@@ -0,0 +1,58 @@
|
||||
"""
|
||||
Base class for all probes.
|
||||
|
||||
Probes are measurement instruments - they reveal what's already there,
|
||||
they don't add or change anything.
|
||||
"""
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
from ..core.model import NyxModel
|
||||
|
||||
|
||||
class BaseProbe(ABC):
|
||||
"""Abstract base class for probing operations."""
|
||||
|
||||
def __init__(self, model: NyxModel):
|
||||
"""
|
||||
Initialize probe with a loaded model.
|
||||
|
||||
Args:
|
||||
model: A NyxModel instance (must be loaded)
|
||||
"""
|
||||
self.model = model
|
||||
if not model._loaded:
|
||||
raise ValueError("Model must be loaded before creating probe")
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Name of this probe type."""
|
||||
return self.__class__.__name__
|
||||
|
||||
@abstractmethod
|
||||
def probe(self, term: str, **kwargs) -> Any:
|
||||
"""
|
||||
Probe a single term.
|
||||
|
||||
Args:
|
||||
term: The word/phrase to probe
|
||||
**kwargs: Probe-specific parameters
|
||||
|
||||
Returns:
|
||||
Probe-specific result object
|
||||
"""
|
||||
pass
|
||||
|
||||
def probe_batch(self, terms: list[str], **kwargs) -> list[Any]:
|
||||
"""
|
||||
Probe multiple terms.
|
||||
|
||||
Default implementation just loops; subclasses can optimize.
|
||||
|
||||
Args:
|
||||
terms: List of words/phrases to probe
|
||||
**kwargs: Probe-specific parameters
|
||||
|
||||
Returns:
|
||||
List of probe results
|
||||
"""
|
||||
return [self.probe(term, **kwargs) for term in terms]
|
||||
Reference in New Issue
Block a user