SYMBOL INDEX (723 symbols across 124 files) FILE: scripts/checkpoint/verify.py function main (line 15) | def main( FILE: scripts/checks/compliance_report.py function _load_resolved_config (line 22) | def _load_resolved_config(config_path: Path): class CheckResult (line 42) | class CheckResult: function _append (line 48) | def _append(results: list[CheckResult], name: str, ok: bool, detail: str... function main (line 53) | def main( FILE: scripts/checks/tokenizer_coverage_guard.py function main (line 19) | def main( FILE: scripts/checks/verify_docs_refs.py function _iter_code_spans (line 31) | def _iter_code_spans(text: str) -> Iterable[str]: function _iter_link_targets (line 36) | def _iter_link_targets(text: str) -> Iterable[str]: function _normalize_path_candidate (line 41) | def _normalize_path_candidate(token: str) -> str | None: function parse_referenced_paths (line 68) | def parse_referenced_paths(doc_text: str) -> set[str]: function _slugify_heading (line 82) | def _slugify_heading(heading: str) -> str: function _extract_markdown_anchors (line 91) | def _extract_markdown_anchors(path: Path) -> set[str]: function parse_anchor_references (line 108) | def parse_anchor_references(doc_text: str) -> list[tuple[str, str]]: function verify_docs_refs (line 126) | def verify_docs_refs( function main (line 156) | def main() -> int: FILE: scripts/checks/verify_update_cadence.py function _expected_counts (line 10) | def _expected_counts( function _load_records (line 33) | def _load_records(path: Path) -> list[dict[str, Any]]: function _find_last_with_prefix (line 40) | def _find_last_with_prefix(records: list[dict[str, Any]], prefix: str) -... function verify_cadence (line 49) | def verify_cadence( function _build_parser (line 89) | def _build_parser() -> argparse.ArgumentParser: function main (line 119) | def main() -> int: FILE: scripts/data/check_tokenizer.py function compute_sha256 (line 11) | def compute_sha256(path: Path) -> str: function dump_metadata (line 19) | def dump_metadata(path: Path, sha256: str, output: Optional[Path]) -> None: function parse_args (line 29) | def parse_args() -> argparse.Namespace: function main (line 60) | def main() -> None: FILE: scripts/data/check_tokenizer_coverage.py function main (line 16) | def main( FILE: scripts/data/filter_corpus.py function _select_fallback_split (line 21) | def _select_fallback_split(available: list[str]) -> str: function normalize_text (line 28) | def normalize_text(text: str) -> str: function is_target_language (line 32) | def is_target_language(text: str, target_lang: str, threshold: float) ->... function main (line 41) | def main( FILE: scripts/data/process_mixture.py function main (line 18) | def main( FILE: scripts/data/shard_corpus.py class ShardConfig (line 19) | class ShardConfig: function _select_fallback_split (line 34) | def _select_fallback_split(available: list[str]) -> str: function shard_dataset (line 41) | def shard_dataset(config: ShardConfig) -> dict: function main (line 116) | def main( function _write_shard (line 154) | def _write_shard(sequences: List[List[int]], output_dir: Path, shard_idx... FILE: scripts/data/train_tokenizer.py class DatasetSpec (line 19) | class DatasetSpec: function _select_fallback_split (line 29) | def _select_fallback_split(available: list[str]) -> str: function _load_specs_from_manifest (line 36) | def _load_specs_from_manifest(manifest: Path) -> List[DatasetSpec]: function _write_samples (line 55) | def _write_samples(spec: DatasetSpec, handle) -> int: function main (line 90) | def main( FILE: scripts/data/validate_mixture.py function _dir_stats (line 14) | def _dir_stats(path: Path, sample_limit: int = 2000) -> tuple[dict[str, ... function main (line 27) | def main( FILE: scripts/eval/compare_variants.py class ModelSpec (line 32) | class ModelSpec: function _load_model (line 38) | def _load_model(spec: ModelSpec, device: torch.device) -> torch.nn.Module: function _logprob_answer (line 53) | def _logprob_answer( function _memorize_prompt_answer_only (line 79) | def _memorize_prompt_answer_only( function _make_passkey_prompt (line 112) | def _make_passkey_prompt(*, filler_sentences: int, key: str) -> str: function _run_passkey (line 122) | def _run_passkey( function _make_niah_prompt (line 246) | def _make_niah_prompt(*, needle: str, filler_tokens: int) -> str: function _run_niah (line 257) | def _run_niah( function main (line 384) | def main( FILE: scripts/eval/continual.py function load_segments (line 34) | def load_segments(yaml_path: Path) -> List[Dict[str, str]]: function evaluate_segment (line 39) | def evaluate_segment( function main (line 143) | def main( FILE: scripts/eval/continual_classification.py function _load_local_jsonl (line 34) | def _load_local_jsonl(path: Path) -> List[ClassificationExample]: function _load_examples (line 44) | def _load_examples( function main (line 58) | def main( FILE: scripts/eval/niah.py function load_model (line 29) | def load_model(config_path: Path, checkpoint: Path, device: torch.device... function make_prompt (line 44) | def make_prompt(needle: str, filler_tokens: int) -> str: function logprob_answer (line 55) | def logprob_answer( function main (line 82) | def main( FILE: scripts/eval/niah_suite.py function load_model (line 28) | def load_model(config_path: Path, checkpoint: Path, device: torch.device): function _logprob_answer (line 43) | def _logprob_answer( function _filler_sentences (line 68) | def _filler_sentences(count: int) -> List[str]: function _ensure_prompt_length (line 72) | def _ensure_prompt_length( class VariantCase (line 96) | class VariantCase: function _case_single_needle (line 102) | def _case_single_needle(rng: random.Random) -> VariantCase: function _case_multi_needle (line 114) | def _case_multi_needle(rng: random.Random, *, needles: int) -> VariantCase: function _case_kv_single (line 132) | def _case_kv_single(rng: random.Random) -> VariantCase: function _case_kv_multi (line 145) | def _case_kv_multi(rng: random.Random, *, pairs: int) -> VariantCase: function _case_positioned_needle (line 165) | def _case_positioned_needle(rng: random.Random, *, position: str) -> Var... function _variant_cases (line 176) | def _variant_cases(rng: random.Random, *, variant: str) -> VariantCase: function _evaluate_variant (line 191) | def _evaluate_variant( function main (line 302) | def main( FILE: scripts/eval/passkey.py function load_model (line 30) | def load_model(config: Path, checkpoint: Path, device: torch.device): function make_prompt (line 42) | def make_prompt(context_tokens: int, key: str) -> str: function logprob (line 49) | def logprob( function main (line 65) | def main( FILE: scripts/eval/pg19_perplexity.py function load_model (line 26) | def load_model(config: Path, checkpoint: Path, device: torch.device): function _nll_for_text (line 38) | def _nll_for_text( function main (line 62) | def main( FILE: scripts/eval/phase2_memorization_delta_smoke.py function _build_model (line 23) | def _build_model(*, variant: str, vocab_size: int, dim: int, layers: int... function _run_once (line 40) | def _run_once( function main (line 71) | def main( FILE: scripts/eval/plot_continual_classification.py function main (line 18) | def main( FILE: scripts/eval/plot_forgetting.py function main (line 14) | def main( FILE: scripts/eval/plot_niah_suite.py function main (line 16) | def main( FILE: scripts/eval/summarize_eval.py function _flatten_numeric (line 13) | def _flatten_numeric(obj: Any, *, prefix: str = "") -> Dict[str, float]: function _expand_keys (line 30) | def _expand_keys(flat: Dict[str, float], keys: Iterable[str]) -> List[str]: function _render_table (line 53) | def _render_table(rows: List[Tuple[str, Dict[str, float]]], keys: List[s... function main (line 69) | def main( FILE: scripts/eval/zeroshot.py function load_model (line 29) | def load_model(config_path: Path, checkpoint: Path, device: torch.device): function score_text (line 44) | def score_text( function evaluate_multiple_choice (line 61) | def evaluate_multiple_choice( function build_piqa_texts (line 140) | def build_piqa_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_piqa (line 148) | def eval_piqa(model, tokenizer, device, max_samples, memorize_cfg): function build_hellaswag_texts (line 155) | def build_hellaswag_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_hellaswag (line 164) | def eval_hellaswag(model, tokenizer, device, max_samples, memorize_cfg): function build_winogrande_texts (line 178) | def build_winogrande_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_winogrande (line 186) | def eval_winogrande(model, tokenizer, device, max_samples, memorize_cfg): function build_arc_texts (line 200) | def build_arc_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_arc (line 209) | def eval_arc( function build_boolq_texts (line 225) | def build_boolq_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_boolq (line 232) | def eval_boolq(model, tokenizer, device, max_samples, memorize_cfg): function build_siqa_texts (line 239) | def build_siqa_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_siqa (line 247) | def eval_siqa(model, tokenizer, device, max_samples, memorize_cfg): function build_commonsenseqa_texts (line 254) | def build_commonsenseqa_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_commonsenseqa (line 263) | def eval_commonsenseqa(model, tokenizer, device, max_samples, memorize_c... function build_openbookqa_texts (line 277) | def build_openbookqa_texts(sample: dict) -> Tuple[str, List[str], int]: function eval_openbookqa (line 286) | def eval_openbookqa(model, tokenizer, device, max_samples, memorize_cfg): function main (line 316) | def main( FILE: src/nested_learning/__main__.py function main (line 6) | def main() -> None: FILE: src/nested_learning/assoc_memory.py class AssocMemory (line 9) | class AssocMemory(nn.Module): method forward (line 12) | def forward(self, query: torch.Tensor) -> torch.Tensor: # type: ignor... method update (line 16) | def update( class SupportsReset (line 22) | class SupportsReset(Protocol): method reset_state (line 23) | def reset_state(self) -> None: ... FILE: src/nested_learning/backbones.py class AttentionConfig (line 13) | class AttentionConfig: class SelfAttention (line 24) | class SelfAttention(nn.Module): method __init__ (line 25) | def __init__(self, config: AttentionConfig): method forward (line 51) | def forward( # type: ignore[override] method _compute_qkv (line 91) | def _compute_qkv(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.T... method _scaled_dot_product_attn (line 103) | def _scaled_dot_product_attn( FILE: src/nested_learning/capabilities.py class RuntimeCapabilities (line 12) | class RuntimeCapabilities: method to_dict (line 32) | def to_dict(self) -> dict[str, Any]: function collect_runtime_capabilities (line 36) | def collect_runtime_capabilities() -> RuntimeCapabilities: FILE: src/nested_learning/cli.py function _resolve_cli_device (line 23) | def _resolve_cli_device(device: str) -> torch.device: function doctor (line 32) | def doctor( function smoke (line 89) | def smoke( function train (line 161) | def train( function audit (line 207) | def audit( FILE: src/nested_learning/cms.py class CMSBlock (line 11) | class CMSBlock(nn.Module): method __init__ (line 12) | def __init__( method forward (line 38) | def forward(self, x: torch.Tensor) -> torch.Tensor: # type: ignore[ov... class CMS (line 48) | class CMS(nn.Module): method __init__ (line 51) | def __init__( method forward (line 76) | def forward( FILE: src/nested_learning/config_utils.py function find_repo_root (line 15) | def find_repo_root(start: Path | None = None) -> Path | None: function resolved_config_dir (line 24) | def resolved_config_dir(config_dir: Path | None = None) -> Iterator[Path]: function compose_config (line 40) | def compose_config( FILE: src/nested_learning/continual_classification.py class ClassificationExample (line 8) | class ClassificationExample: class LoadedClassificationDataset (line 14) | class LoadedClassificationDataset: function load_hf_classification_dataset (line 21) | def load_hf_classification_dataset( function load_clinc_oos (line 75) | def load_clinc_oos( function load_banking77 (line 90) | def load_banking77( function load_dbpedia14 (line 105) | def load_dbpedia14( function unique_labels (line 120) | def unique_labels(examples: Iterable[ClassificationExample]) -> List[str]: function filter_examples_by_labels (line 131) | def filter_examples_by_labels( FILE: src/nested_learning/continual_streaming.py class StreamingTask (line 15) | class StreamingTask: class ContinualEvalConfig (line 23) | class ContinualEvalConfig: function _logprob_completion (line 33) | def _logprob_completion( function predict_label (line 54) | def predict_label( function _balanced_split (line 81) | def _balanced_split( function build_streaming_tasks (line 109) | def build_streaming_tasks( class ContinualEvalResult (line 142) | class ContinualEvalResult: function evaluate_continual_classification (line 149) | def evaluate_continual_classification( FILE: src/nested_learning/data.py class SyntheticTextConfig (line 13) | class SyntheticTextConfig: class SyntheticTextDataset (line 19) | class SyntheticTextDataset(Dataset[torch.Tensor]): method __init__ (line 20) | def __init__(self, config: SyntheticTextConfig): method __len__ (line 23) | def __len__(self) -> int: method __getitem__ (line 26) | def __getitem__(self, idx: int) -> torch.Tensor: class TokenShardDataset (line 31) | class TokenShardDataset(Dataset[torch.Tensor]): method __init__ (line 34) | def __init__(self, shard_dir: str | Path): method __len__ (line 53) | def __len__(self) -> int: method _load_array (line 56) | def _load_array(self, shard_idx: int) -> np.memmap: method __getitem__ (line 61) | def __getitem__(self, idx: int) -> torch.Tensor: method _find_shard (line 71) | def _find_shard(self, idx: int) -> int: class ShardSourceConfig (line 86) | class ShardSourceConfig: class ShardSource (line 92) | class ShardSource: method __init__ (line 93) | def __init__(self, config: ShardSourceConfig): method sample (line 105) | def sample(self, rng: np.random.Generator) -> np.ndarray: class MixtureShardDataset (line 114) | class MixtureShardDataset(IterableDataset[torch.Tensor]): method __init__ (line 115) | def __init__( method __len__ (line 131) | def __len__(self) -> int: method __iter__ (line 134) | def __iter__(self) -> Iterator[torch.Tensor]: function collate_batch (line 152) | def collate_batch(batch: list[torch.Tensor]) -> torch.Tensor: FILE: src/nested_learning/device.py function resolve_device (line 6) | def resolve_device(device_str: str) -> torch.device: FILE: src/nested_learning/eval_state.py class EvalStreamingState (line 9) | class EvalStreamingState: function parse_eval_state_mode (line 14) | def parse_eval_state_mode(mode: str) -> bool: function init_eval_streaming_state (line 29) | def init_eval_streaming_state( function forward_with_eval_state (line 53) | def forward_with_eval_state( FILE: src/nested_learning/fast_state.py class CMSChunkBuffer (line 16) | class CMSChunkBuffer: function init_module_deltas (line 30) | def init_module_deltas(module: nn.Module) -> ParamDict: class BlockFastState (line 43) | class BlockFastState: function build_block_fast_state (line 51) | def build_block_fast_state( class ModelFastState (line 82) | class ModelFastState: class AttentionKVCache (line 87) | class AttentionKVCache: class ModelAttentionCache (line 101) | class ModelAttentionCache: FILE: src/nested_learning/functional.py function params_with_deltas (line 12) | def params_with_deltas(module: nn.Module, deltas: ParamDict) -> ParamDict: function module_buffers (line 28) | def module_buffers(module: nn.Module) -> ParamDict: function call_with_params (line 32) | def call_with_params( function call_with_deltas (line 42) | def call_with_deltas( function require_grad_params (line 51) | def require_grad_params( function grads_to_dict (line 63) | def grads_to_dict(params: ParamDict, grads: Tuple[torch.Tensor | None, .... FILE: src/nested_learning/hope/block.py function _chunk_loss (line 27) | def _chunk_loss( function _min_update_period (line 48) | def _min_update_period(levels: Sequence[LevelSpec]) -> int: class _CmsBuffer (line 54) | class _CmsBuffer: function _clear_buffer (line 61) | def _clear_buffer(buffer: _CmsBuffer | CMSChunkBuffer) -> None: function _fast_state_buffers (line 68) | def _fast_state_buffers( function _pop_buffer_chunk (line 78) | def _pop_buffer_chunk( class HOPEBlockConfig (line 115) | class HOPEBlockConfig: class HOPEAttentionBlockConfig (line 135) | class HOPEAttentionBlockConfig: class HOPEAttentionBlock (line 151) | class HOPEAttentionBlock(nn.Module): method __init__ (line 158) | def __init__(self, config: HOPEAttentionBlockConfig): method forward (line 187) | def forward( method set_surprise_threshold (line 248) | def set_surprise_threshold(self, threshold: float | None) -> None: method set_surprise_metric (line 251) | def set_surprise_metric(self, metric: str) -> None: method set_allowed_levels (line 254) | def set_allowed_levels(self, allowed: Set[str] | None) -> None: method pop_update_stats (line 257) | def pop_update_stats(self) -> Dict[str, Dict[str, float]]: method _cms_forward_fast (line 262) | def _cms_forward_fast( method _cms_forward_online (line 276) | def _cms_forward_online( method _cms_forward_online_fast (line 381) | def _cms_forward_online_fast( method _update_cms_fast (line 498) | def _update_cms_fast( method _is_level_allowed (line 561) | def _is_level_allowed(self, level_name: str) -> bool: method _passes_surprise (line 566) | def _passes_surprise(self, surprise_value: float | None) -> bool: method _record_gate (line 573) | def _record_gate(self, level_name: str, *, hit: bool) -> None: method _update_cms (line 578) | def _update_cms( method _update_cms_chunk (line 633) | def _update_cms_chunk( method _update_cms_chunk_fast (line 667) | def _update_cms_chunk_fast( class HOPESelfModBlockConfig (line 719) | class HOPESelfModBlockConfig: class HOPESelfModBlock (line 745) | class HOPESelfModBlock(nn.Module): method __init__ (line 752) | def __init__(self, config: HOPESelfModBlockConfig): method forward (line 790) | def forward( method set_surprise_threshold (line 847) | def set_surprise_threshold(self, threshold: float | None) -> None: method set_surprise_metric (line 850) | def set_surprise_metric(self, metric: str) -> None: method set_allowed_levels (line 853) | def set_allowed_levels(self, allowed: Set[str] | None) -> None: method pop_update_stats (line 856) | def pop_update_stats(self) -> Dict[str, Dict[str, float]]: method _cms_forward_fast (line 861) | def _cms_forward_fast( method _cms_forward_online (line 875) | def _cms_forward_online( method _cms_forward_online_fast (line 980) | def _cms_forward_online_fast( method _is_level_allowed (line 1091) | def _is_level_allowed(self, level_name: str) -> bool: method _passes_surprise (line 1096) | def _passes_surprise(self, surprise_value: float | None) -> bool: method _record_gate (line 1103) | def _record_gate(self, level_name: str, *, hit: bool) -> None: method _update_cms (line 1108) | def _update_cms( method _update_cms_fast (line 1163) | def _update_cms_fast( method _update_cms_chunk (line 1219) | def _update_cms_chunk( method _update_cms_chunk_fast (line 1252) | def _update_cms_chunk_fast( class HOPEBlock (line 1298) | class HOPEBlock(nn.Module): method __init__ (line 1299) | def __init__(self, config: HOPEBlockConfig): method forward (line 1337) | def forward( method set_surprise_threshold (line 1403) | def set_surprise_threshold(self, threshold: float | None) -> None: method set_surprise_metric (line 1406) | def set_surprise_metric(self, metric: str) -> None: method set_allowed_levels (line 1409) | def set_allowed_levels(self, allowed: Set[str] | None) -> None: method _cms_forward_fast (line 1412) | def _cms_forward_fast( method _cms_forward_online (line 1427) | def _cms_forward_online( method _cms_forward_online_fast (line 1532) | def _cms_forward_online_fast( method _update_titan (line 1642) | def _update_titan( method _update_titan_fast (line 1702) | def _update_titan_fast( method _update_cms (line 1762) | def _update_cms( method _update_cms_fast (line 1817) | def _update_cms_fast( method _update_cms_chunk (line 1873) | def _update_cms_chunk( method _update_cms_chunk_fast (line 1906) | def _update_cms_chunk_fast( method pop_update_stats (line 1951) | def pop_update_stats(self) -> Dict[str, Dict[str, float]]: method _passes_surprise (line 1956) | def _passes_surprise(self, surprise_value: float | None) -> bool: method _is_level_allowed (line 1963) | def _is_level_allowed(self, level_name: str) -> bool: method _record_gate (line 1970) | def _record_gate(self, level_name: str, *, hit: bool) -> None: FILE: src/nested_learning/hope/self_mod.py class SelfModifier (line 7) | class SelfModifier(nn.Module): method __init__ (line 21) | def __init__(self, dim: int, hidden_multiplier: int = 4): method forward (line 32) | def forward( FILE: src/nested_learning/instrumentation.py class UpdateEvent (line 8) | class UpdateEvent: class UpdateLog (line 15) | class UpdateLog: method record (line 20) | def record(self, *, step: int, level: str, magnitude: float | None = N... method summary (line 23) | def summary(self) -> Dict[str, Dict[str, float]]: FILE: src/nested_learning/levels.py class LevelSpec (line 8) | class LevelSpec: method __post_init__ (line 17) | def __post_init__(self) -> None: class LevelState (line 30) | class LevelState: class LevelClock (line 35) | class LevelClock: method __init__ (line 38) | def __init__(self, specs: Sequence[LevelSpec]): method step (line 47) | def step(self) -> int: method tick (line 50) | def tick(self) -> None: method should_update (line 53) | def should_update(self, name: str) -> bool: method record_update (line 64) | def record_update(self, name: str) -> None: method levels_in_frequency_order (line 70) | def levels_in_frequency_order(self) -> List[LevelSpec]: method stats (line 73) | def stats(self) -> Dict[str, LevelState]: method timeline (line 78) | def timeline(self) -> List[dict]: function ensure_level_specs (line 82) | def ensure_level_specs(entries: Iterable[LevelSpec]) -> List[LevelSpec]: FILE: src/nested_learning/logging_utils.py class BaseLogger (line 10) | class BaseLogger: method log (line 11) | def log(self, metrics: Dict[str, Any], step: int) -> None: method finish (line 14) | def finish(self) -> None: class NullLogger (line 18) | class NullLogger(BaseLogger): method log (line 19) | def log(self, metrics: Dict[str, Any], step: int) -> None: class JSONLogger (line 23) | class JSONLogger(BaseLogger): method __init__ (line 24) | def __init__(self, path: Path): method log (line 28) | def log(self, metrics: Dict[str, Any], step: int) -> None: method finish (line 32) | def finish(self) -> None: class WandbLogger (line 37) | class WandbLogger(BaseLogger): method __init__ (line 38) | def __init__(self, cfg: DictConfig, full_cfg: DictConfig): method log (line 46) | def log(self, metrics: Dict[str, Any], step: int) -> None: method finish (line 50) | def finish(self) -> None: function init_logger (line 55) | def init_logger(logging_cfg: DictConfig | None, full_cfg: DictConfig) ->... FILE: src/nested_learning/memorize.py class MemorizeConfig (line 14) | class MemorizeConfig: function snapshot_state_dict (line 26) | def snapshot_state_dict(model: torch.nn.Module) -> Dict[str, torch.Tensor]: function restore_state_dict (line 30) | def restore_state_dict(model: torch.nn.Module, state: Dict[str, torch.Te... function _setup_memorization_context (line 34) | def _setup_memorization_context(model, cfg: MemorizeConfig): function _teardown_memorization_context (line 58) | def _teardown_memorization_context(model, prev_allowed, prev_threshold, ... function _collect_metrics (line 72) | def _collect_metrics(model, stats: dict[str, float]): function _layernorm_backward (line 102) | def _layernorm_backward( function _get_model_surprise_metric (line 127) | def _get_model_surprise_metric(model) -> str: function _compute_surprise_value (line 134) | def _compute_surprise_value( function memorize_tokens (line 169) | def memorize_tokens( function memorize_sequence (line 366) | def memorize_sequence( FILE: src/nested_learning/model.py class ModelConfig (line 29) | class ModelConfig: class HOPEModel (line 65) | class HOPEModel(nn.Module): method __init__ (line 66) | def __init__(self, config: ModelConfig): method set_teach_runtime (line 163) | def set_teach_runtime(self, *, scale: float | None = None, clip: float... method set_surprise_threshold (line 169) | def set_surprise_threshold(self, threshold: float | None) -> None: method get_surprise_threshold (line 174) | def get_surprise_threshold(self) -> float | None: method set_surprise_metric (line 177) | def set_surprise_metric(self, metric: str) -> None: method get_surprise_metric (line 188) | def get_surprise_metric(self) -> str: method set_allowed_update_levels (line 191) | def set_allowed_update_levels(self, levels: set[str] | None) -> None: method get_allowed_update_levels (line 196) | def get_allowed_update_levels(self) -> set[str] | None: method set_allowed_update_layers (line 199) | def set_allowed_update_layers(self, layers: set[int] | None) -> None: method get_allowed_update_layers (line 214) | def get_allowed_update_layers(self) -> set[int] | None: method forward (line 217) | def forward( method forward_with_pre_norm (line 262) | def forward_with_pre_norm( method forward_with_block_outputs (line 317) | def forward_with_block_outputs( method _run_blocks (line 379) | def _run_blocks( method _gather_block_stats (line 514) | def _gather_block_stats(self) -> Dict[str, float]: method pop_update_metrics (line 526) | def pop_update_metrics(self) -> Dict[str, float]: method init_fast_state (line 531) | def init_fast_state(self) -> ModelFastState: method init_attention_cache (line 578) | def init_attention_cache(self) -> ModelAttentionCache: method freeze_backbone (line 581) | def freeze_backbone(self) -> None: class _UpdateControlledBlock (line 599) | class _UpdateControlledBlock(Protocol): method set_surprise_threshold (line 600) | def set_surprise_threshold(self, threshold: float | None) -> None: ... method set_surprise_metric (line 602) | def set_surprise_metric(self, metric: str) -> None: ... method set_allowed_levels (line 604) | def set_allowed_levels(self, allowed: set[str] | None) -> None: ... FILE: src/nested_learning/optim/deep.py class DeepMomentumState (line 11) | class DeepMomentumState: class DeepMomentum (line 16) | class DeepMomentum(nn.Module): method __init__ (line 19) | def __init__( method reset_state (line 36) | def reset_state(self) -> None: method _precondition (line 39) | def _precondition(self, grad: torch.Tensor, state: DeepMomentumState) ... method _nl_precondition (line 46) | def _nl_precondition( method forward (line 76) | def forward( # type: ignore[override] FILE: src/nested_learning/optim/factory.py function build_optimizer (line 8) | def build_optimizer(config: Dict[str, Any]) -> DeepMomentum: FILE: src/nested_learning/optim/m3.py function _newton_schulz (line 8) | def _newton_schulz(matrix: torch.Tensor, steps: int, eps: float = 1e-6) ... function _orthogonalize (line 23) | def _orthogonalize(tensor: torch.Tensor, steps: int, eps: float) -> torc... class M3 (line 31) | class M3(torch.optim.Optimizer): method __init__ (line 42) | def __init__( method step (line 70) | def step(self, closure=None): # type: ignore[override] FILE: src/nested_learning/optim/manager.py class LevelConfig (line 14) | class LevelConfig: class LevelOptimizerManager (line 20) | class LevelOptimizerManager: method __init__ (line 21) | def __init__(self, config: LevelConfig): method should_update (line 37) | def should_update(self, level: str) -> bool: method optimize (line 40) | def optimize( method apply_module_grads (line 71) | def apply_module_grads( method tick (line 103) | def tick(self) -> None: method pop_last_metrics (line 106) | def pop_last_metrics(self, level: str) -> Dict[str, float]: method apply_grads (line 109) | def apply_grads( FILE: src/nested_learning/titan/memory.py class TitanMemoryConfig (line 13) | class TitanMemoryConfig: function _activation (line 20) | def _activation(name: str) -> nn.Module: class TitanMemory (line 31) | class TitanMemory(AssocMemory): method __init__ (line 34) | def __init__(self, config: TitanMemoryConfig): method forward (line 47) | def forward(self, query: torch.Tensor) -> torch.Tensor: # type: ignor... method surprise (line 56) | def surprise(self, residual: torch.Tensor) -> torch.Tensor: method update (line 60) | def update( method apply_deltas (line 83) | def apply_deltas(self, deltas: Dict[str, torch.Tensor], scale: float =... FILE: src/nested_learning/titan/model.py class TitanOnlyModelConfig (line 31) | class TitanOnlyModelConfig: class TitanOnlyBlock (line 52) | class TitanOnlyBlock(nn.Module): method __init__ (line 53) | def __init__(self, config: TitanOnlyModelConfig): method forward (line 83) | def forward( method set_surprise_threshold (line 128) | def set_surprise_threshold(self, threshold: float | None) -> None: method set_surprise_metric (line 131) | def set_surprise_metric(self, metric: str) -> None: method set_enabled (line 134) | def set_enabled(self, enabled: bool) -> None: method _passes_surprise (line 137) | def _passes_surprise(self, surprise_value: float | None) -> bool: method _update_titan (line 144) | def _update_titan( method _update_titan_fast (line 197) | def _update_titan_fast( class TitanOnlyModel (line 252) | class TitanOnlyModel(nn.Module): method __init__ (line 253) | def __init__(self, config: TitanOnlyModelConfig): method set_teach_runtime (line 271) | def set_teach_runtime(self, *, scale: float | None = None, clip: float... method set_surprise_threshold (line 277) | def set_surprise_threshold(self, threshold: float | None) -> None: method get_surprise_threshold (line 282) | def get_surprise_threshold(self) -> float | None: method set_surprise_metric (line 285) | def set_surprise_metric(self, metric: str) -> None: method get_surprise_metric (line 296) | def get_surprise_metric(self) -> str: method set_allowed_update_levels (line 299) | def set_allowed_update_levels(self, levels: set[str] | None) -> None: method get_allowed_update_levels (line 307) | def get_allowed_update_levels(self) -> set[str] | None: method forward (line 312) | def forward( method freeze_backbone (line 381) | def freeze_backbone(self) -> None: method init_fast_state (line 396) | def init_fast_state(self) -> ModelFastState: method init_attention_cache (line 411) | def init_attention_cache(self) -> ModelAttentionCache: FILE: src/nested_learning/titan/self_modifying.py class SelfModifyingTitansConfig (line 13) | class SelfModifyingTitansConfig: method __post_init__ (line 29) | def __post_init__(self) -> None: class ResidualMLPMemoryState (line 49) | class ResidualMLPMemoryState: method clone (line 57) | def clone(self) -> "ResidualMLPMemoryState": class SelfModifyingTitansState (line 69) | class SelfModifyingTitansState: method clone (line 84) | def clone(self) -> "SelfModifyingTitansState": class ResidualMLPMemory (line 95) | class ResidualMLPMemory(nn.Module): method __init__ (line 96) | def __init__( method forward (line 119) | def forward(self, x: torch.Tensor) -> torch.Tensor: # type: ignore[ov... class SelfModifyingTitans (line 129) | class SelfModifyingTitans(nn.Module): method __init__ (line 140) | def __init__(self, config: SelfModifyingTitansConfig): method init_fast_state (line 177) | def init_fast_state(self) -> SelfModifyingTitansState: method apply_updates_inplace (line 187) | def apply_updates_inplace( method forward (line 210) | def forward(self, x: torch.Tensor) -> torch.Tensor: # type: ignore[ov... method forward_with_state (line 217) | def forward_with_state( method forward_with_updates (line 238) | def forward_with_updates( method _apply_local_conv (line 376) | def _apply_local_conv(self, x: torch.Tensor) -> torch.Tensor: method _load_state_mean_ (line 388) | def _load_state_mean_(self, state: SelfModifyingTitansState) -> None: method _apply_chunk_update (line 411) | def _apply_chunk_update( method _apply_chunk_update_seq (line 433) | def _apply_chunk_update_seq( method _memory_grads (line 477) | def _memory_grads( method _memory_grads_chunk (line 514) | def _memory_grads_chunk( method _apply_param_update (line 589) | def _apply_param_update( method _apply_momentum (line 616) | def _apply_momentum( method _init_memory_state (line 632) | def _init_memory_state(self, module: ResidualMLPMemory) -> ResidualMLP... method _ensure_batched_state (line 640) | def _ensure_batched_state( method _expand_memory_state (line 660) | def _expand_memory_state( method _memory_forward (line 678) | def _memory_forward( method _straight_through_meta (line 718) | def _straight_through_meta(fast: torch.Tensor, meta: torch.Tensor) -> ... FILE: src/nested_learning/tokenizer.py class SentencePieceTokenizer (line 10) | class SentencePieceTokenizer: method __init__ (line 11) | def __init__(self, model_path: str | Path): method vocab_size (line 15) | def vocab_size(self) -> int: method encode (line 18) | def encode(self, text: str, add_bos: bool = False, add_eos: bool = Tru... method batch_encode (line 27) | def batch_encode(self, texts: Sequence[str]) -> list[torch.Tensor]: FILE: src/nested_learning/tokenizer_coverage.py function compute_tokenizer_coverage_stats (line 10) | def compute_tokenizer_coverage_stats( FILE: src/nested_learning/training.py class DistributedContext (line 35) | class DistributedContext: function unwrap_config (line 41) | def unwrap_config(cfg: DictConfig) -> DictConfig: function build_model_from_cfg (line 52) | def build_model_from_cfg(model_cfg: DictConfig) -> torch.nn.Module: function build_dataloader (line 148) | def build_dataloader( function _build_dataset (line 192) | def _build_dataset(data_cfg: DictConfig): function compute_teach_signal (line 225) | def compute_teach_signal( function _compute_layer_teach_signals (line 295) | def _compute_layer_teach_signals( function _compute_surprise_override (line 314) | def _compute_surprise_override( function _infer_online_chunk_size (line 336) | def _infer_online_chunk_size(model: HOPEModel) -> int | None: function _iter_online_token_chunks (line 352) | def _iter_online_token_chunks( function _iter_online_boundary_chunks (line 369) | def _iter_online_boundary_chunks( class _HasLMHead (line 391) | class _HasLMHead(Protocol): function _checksum_path (line 395) | def _checksum_path(path: str | None) -> str | None: function maybe_save_checkpoint (line 408) | def maybe_save_checkpoint( function _validate_distributed_config (line 451) | def _validate_distributed_config(cfg: DictConfig, distributed: bool) -> ... function _emit_streaming_warning (line 489) | def _emit_streaming_warning( function _validate_paper_auditing_variant (line 501) | def _validate_paper_auditing_variant(cfg: DictConfig) -> None: function _validate_tied_lm_head_for_paper_auditing (line 522) | def _validate_tied_lm_head_for_paper_auditing( function _validate_fast_state_batch_semantics (line 546) | def _validate_fast_state_batch_semantics(cfg: DictConfig) -> None: function _validate_online_update_fast_state_semantics (line 574) | def _validate_online_update_fast_state_semantics(cfg: DictConfig) -> None: function _resolve_algorithm_mode (line 598) | def _resolve_algorithm_mode(cfg: DictConfig) -> str: function _validate_algorithm_mode_constraints (line 606) | def _validate_algorithm_mode_constraints( function _validate_online_chunking_constraints (line 650) | def _validate_online_chunking_constraints(cfg: DictConfig) -> None: function _check_online_supervised_pairs (line 663) | def _check_online_supervised_pairs( function run_training_loop (line 685) | def run_training_loop( function _apply_teach_schedule (line 1072) | def _apply_teach_schedule(model: HOPEModel, cfg: DictConfig, step: int) ... function _maybe_compile_model (line 1093) | def _maybe_compile_model(model: torch.nn.Module, compile_cfg: dict | Non... function _make_autocast_factory (line 1110) | def _make_autocast_factory(device: torch.device, mp_cfg: dict | None): function _resolve_autocast_dtype (line 1128) | def _resolve_autocast_dtype(name: str) -> torch.dtype: function _build_optimizer (line 1138) | def _build_optimizer( function _build_muon_optimizer (line 1194) | def _build_muon_optimizer( function _build_m3_optimizer (line 1257) | def _build_m3_optimizer( function _select_outer_named_parameters (line 1327) | def _select_outer_named_parameters( function _is_memory_param_name (line 1346) | def _is_memory_param_name(name: str) -> bool: function _is_muon_candidate (line 1351) | def _is_muon_candidate(name: str, param: torch.nn.Parameter) -> bool: class _HybridOptimizer (line 1360) | class _HybridOptimizer: method __init__ (line 1361) | def __init__( method zero_grad (line 1378) | def zero_grad(self) -> None: method step (line 1384) | def step(self) -> None: method state_dict (line 1390) | def state_dict(self) -> dict: method load_state_dict (line 1396) | def load_state_dict(self, state: dict) -> None: method param_groups (line 1403) | def param_groups(self): method get_param_split (line 1411) | def get_param_split(self) -> dict[str, int]: function _log_run_features (line 1418) | def _log_run_features( function _detect_flash_attention (line 1482) | def _detect_flash_attention(model: torch.nn.Module) -> bool: function write_checkpoint_metadata (line 1492) | def write_checkpoint_metadata(cfg: DictConfig, ckpt_path: Path, step: in... function verify_checkpoint_integrity (line 1520) | def verify_checkpoint_integrity(ckpt_path: Path) -> Dict[str, object]: function _capture_rng_states (line 1554) | def _capture_rng_states() -> Dict[str, object]: function _encode_pickle (line 1567) | def _encode_pickle(obj: object) -> str: function _tensor_state_to_hex (line 1571) | def _tensor_state_to_hex(state: torch.Tensor) -> str: function _seed_everything (line 1575) | def _seed_everything(seed: int, *, deterministic: bool = False) -> None: function _make_worker_init_fn (line 1593) | def _make_worker_init_fn(base_seed: int): FILE: src/nested_learning/transformer.py class TransformerBlockConfig (line 13) | class TransformerBlockConfig: class FeedForward (line 22) | class FeedForward(nn.Module): method __init__ (line 23) | def __init__( method forward (line 45) | def forward(self, x: torch.Tensor) -> torch.Tensor: # type: ignore[ov... class TransformerBlock (line 51) | class TransformerBlock(nn.Module): method __init__ (line 58) | def __init__(self, config: TransformerBlockConfig) -> None: method forward (line 75) | def forward( method set_surprise_threshold (line 97) | def set_surprise_threshold(self, threshold: float | None) -> None: method set_surprise_metric (line 100) | def set_surprise_metric(self, metric: str) -> None: method set_allowed_levels (line 103) | def set_allowed_levels(self, allowed) -> None: FILE: tests/test_algorithm_mode_grad.py function _manager (line 7) | def _manager() -> LevelOptimizerManager: function test_apply_grads_differentiable_preserves_gradient_path (line 17) | def test_apply_grads_differentiable_preserves_gradient_path() -> None: function test_apply_grads_nondifferentiable_breaks_gradient_path (line 35) | def test_apply_grads_nondifferentiable_breaks_gradient_path() -> None: FILE: tests/test_attention_cache.py function _build_transformer_model (line 9) | def _build_transformer_model() -> HOPEModel: function test_attention_cache_chunked_logits_match_full_logits (line 24) | def test_attention_cache_chunked_logits_match_full_logits() -> None: function test_attention_cache_reset_changes_continuation_state (line 44) | def test_attention_cache_reset_changes_continuation_state() -> None: function test_transformer_block_rejects_kv_cache_with_local_conv (line 59) | def test_transformer_block_rejects_kv_cache_with_local_conv() -> None: FILE: tests/test_attention_features.py function test_self_attention_qk_l2_norm_unit_vectors (line 6) | def test_self_attention_qk_l2_norm_unit_vectors() -> None: function test_self_attention_local_conv_window_preserves_shape (line 16) | def test_self_attention_local_conv_window_preserves_shape() -> None: function test_self_attention_local_conv_is_causal (line 25) | def test_self_attention_local_conv_is_causal() -> None: FILE: tests/test_boundary_state_mode.py function _build_attention_model (line 9) | def _build_attention_model() -> HOPEModel: function _two_chunk_grad_norm (line 23) | def _two_chunk_grad_norm(*, differentiable_updates: bool) -> float: function test_boundary_state_grad_mode_propagates_across_write_path (line 66) | def test_boundary_state_grad_mode_propagates_across_write_path() -> None: function test_stopgrad_mode_blocks_boundary_state_grad_path (line 70) | def test_stopgrad_mode_blocks_boundary_state_grad_path() -> None: FILE: tests/test_boundary_state_training_loop.py function _tiny_boundary_state_cfg (line 9) | def _tiny_boundary_state_cfg(): function test_boundary_state_mode_runs_in_training_loop (line 61) | def test_boundary_state_mode_runs_in_training_loop() -> None: FILE: tests/test_build_model_from_cfg_selfmod.py function test_build_model_from_cfg_plumbs_selfmod_fields (line 7) | def test_build_model_from_cfg_plumbs_selfmod_fields() -> None: FILE: tests/test_checkpoint_metadata_and_eval_loaders.py function _tiny_cfg (line 17) | def _tiny_cfg(): function _load_script_module (line 44) | def _load_script_module(script_path: Path): function test_checkpoint_metadata_includes_algorithm_and_online_flags (line 52) | def test_checkpoint_metadata_includes_algorithm_and_online_flags(tmp_pat... function test_eval_loaders_accept_boundary_state_checkpoint (line 69) | def test_eval_loaders_accept_boundary_state_checkpoint(tmp_path: Path) -... FILE: tests/test_cli_tooling.py function test_doctor_json_output (line 15) | def test_doctor_json_output() -> None: function test_smoke_cpu_passes (line 25) | def test_smoke_cpu_passes() -> None: function test_smoke_auto_passes (line 49) | def test_smoke_auto_passes() -> None: function test_audit_reports_tied_weights (line 70) | def test_audit_reports_tied_weights() -> None: function test_train_dry_run_prints_config (line 81) | def test_train_dry_run_prints_config() -> None: function test_compose_config_with_explicit_config_dir (line 99) | def test_compose_config_with_explicit_config_dir(tmp_path: Path) -> None: function test_python_module_entrypoint_help (line 121) | def test_python_module_entrypoint_help() -> None: FILE: tests/test_cms.py function test_cms_forward_preserves_shape (line 8) | def test_cms_forward_preserves_shape() -> None: function test_cms_can_disable_layernorm (line 20) | def test_cms_can_disable_layernorm() -> None: function test_cms_updates_respect_update_period_tokens (line 33) | def test_cms_updates_respect_update_period_tokens() -> None: function test_cms_updates_skip_when_no_signal (line 54) | def test_cms_updates_skip_when_no_signal() -> None: function test_cms_online_updates_affect_later_tokens (line 69) | def test_cms_online_updates_affect_later_tokens() -> None: FILE: tests/test_cms_cross_call.py function _build_variant (line 16) | def _build_variant(variant: str, *, flush_partial: bool): function test_cms_fast_state_buffers_persist_across_calls (line 79) | def test_cms_fast_state_buffers_persist_across_calls(variant: str) -> None: function test_cms_fast_state_flushes_only_on_finalize (line 97) | def test_cms_fast_state_flushes_only_on_finalize(variant: str) -> None: FILE: tests/test_cms_delta_rule.py function test_cms_target_shift_loss_grad_is_proportional_to_delta (line 6) | def test_cms_target_shift_loss_grad_is_proportional_to_delta() -> None: function test_cms_chunk_loss_sum_scales_relative_to_mean (line 25) | def test_cms_chunk_loss_sum_scales_relative_to_mean() -> None: FILE: tests/test_cms_flush_partial.py function _run_block (line 8) | def _run_block(*, flush_partial: bool, use_fast_state: bool) -> dict[str... function test_cms_flush_partial_disabled_leaves_remainder_unupdated (line 35) | def test_cms_flush_partial_disabled_leaves_remainder_unupdated() -> None: function test_cms_flush_partial_enabled_updates_final_remainder (line 42) | def test_cms_flush_partial_enabled_updates_final_remainder() -> None: FILE: tests/test_compare_variants_cli.py function _train_tiny_sentencepiece (line 13) | def _train_tiny_sentencepiece(tmp_path: Path, *, vocab_size: int) -> Path: function _write_minimal_model_config (line 40) | def _write_minimal_model_config(path: Path, *, vocab_size: int, block_va... function _write_checkpoint (line 55) | def _write_checkpoint(path: Path, config_path: Path) -> None: function test_compare_variants_cli_smoke (line 61) | def test_compare_variants_cli_smoke(tmp_path: Path) -> None: FILE: tests/test_compile_toggle.py function _tiny_compile_cfg (line 9) | def _tiny_compile_cfg(): function test_compile_toggle_smoke_does_not_crash (line 60) | def test_compile_toggle_smoke_does_not_crash() -> None: FILE: tests/test_compliance_report.py function _run_report (line 11) | def _run_report(config_path: Path, output_path: Path, repo_root: Path) -... function test_compliance_report_includes_algorithm_mode_checks (line 30) | def test_compliance_report_includes_algorithm_mode_checks(tmp_path: Path... function test_compliance_report_validates_boundary_mode_constraints (line 41) | def test_compliance_report_validates_boundary_mode_constraints(tmp_path:... FILE: tests/test_continual_classification.py function _train_tiny_sentencepiece (line 18) | def _train_tiny_sentencepiece(tmp_path: Path, *, vocab_size: int) -> Path: function _tiny_transformer_model (line 46) | def _tiny_transformer_model(vocab_size: int) -> HOPEModel: function _toy_examples (line 59) | def _toy_examples() -> list[ClassificationExample]: function test_build_streaming_tasks_balanced_split (line 67) | def test_build_streaming_tasks_balanced_split() -> None: function test_evaluate_continual_classification_runs (line 77) | def test_evaluate_continual_classification_runs(tmp_path: Path) -> None: function test_evaluate_continual_classification_with_memorize_fast_state (line 101) | def test_evaluate_continual_classification_with_memorize_fast_state(tmp_... FILE: tests/test_continual_eval_state_mode.py function _load_evaluate_segment (line 12) | def _load_evaluate_segment(): class _TokenDataset (line 26) | class _TokenDataset(Dataset): method __init__ (line 27) | def __init__(self) -> None: method __len__ (line 30) | def __len__(self) -> int: method __getitem__ (line 33) | def __getitem__(self, idx: int) -> torch.Tensor: function _build_model (line 37) | def _build_model() -> HOPEModel: function test_continual_eval_state_modes_run_without_errors (line 50) | def test_continual_eval_state_modes_run_without_errors() -> None: FILE: tests/test_data_scripts_help.py function test_data_scripts_help_smoke (line 7) | def test_data_scripts_help_smoke() -> None: FILE: tests/test_data_split_fallbacks.py function test_train_tokenizer_manifest_supports_text_data_files (line 13) | def test_train_tokenizer_manifest_supports_text_data_files(tmp_path: Pat... function test_shard_corpus_accepts_text_data_files_with_train_split (line 42) | def test_shard_corpus_accepts_text_data_files_with_train_split(tmp_path:... function test_train_tokenizer_allows_small_corpus_with_no_hard_vocab_limit (line 67) | def test_train_tokenizer_allows_small_corpus_with_no_hard_vocab_limit(tm... function test_split_fallback_prefers_validation_then_test (line 115) | def test_split_fallback_prefers_validation_then_test() -> None: function test_split_fallback_uses_first_when_no_standard_split (line 122) | def test_split_fallback_uses_first_when_no_standard_split() -> None: FILE: tests/test_determinism_seed.py function test_seed_everything_reproducible_python_numpy_torch (line 9) | def test_seed_everything_reproducible_python_numpy_torch() -> None: function test_seed_everything_toggles_deterministic_algorithms (line 25) | def test_seed_everything_toggles_deterministic_algorithms() -> None: FILE: tests/test_device_resolution.py function test_resolve_device_mps_falls_back_when_unavailable (line 6) | def test_resolve_device_mps_falls_back_when_unavailable() -> None: FILE: tests/test_distributed_fail_fast.py function test_fail_if_paper_faithful_disabled_blocks_ddp_per_layer_teach (line 7) | def test_fail_if_paper_faithful_disabled_blocks_ddp_per_layer_teach() ->... function test_fail_if_paper_faithful_disabled_blocks_ddp_online_updates (line 21) | def test_fail_if_paper_faithful_disabled_blocks_ddp_online_updates() -> ... function test_fail_if_paper_faithful_disabled_allows_single_process (line 35) | def test_fail_if_paper_faithful_disabled_allows_single_process() -> None: function test_strict_streaming_contract_blocks_ddp_online_features (line 48) | def test_strict_streaming_contract_blocks_ddp_online_features() -> None: function test_fail_if_paper_faithful_disabled_blocks_ddp_boundary_targets (line 63) | def test_fail_if_paper_faithful_disabled_blocks_ddp_boundary_targets() -... function test_fail_if_paper_faithful_disabled_blocks_ddp_attention_cache_carry (line 78) | def test_fail_if_paper_faithful_disabled_blocks_ddp_attention_cache_carr... FILE: tests/test_eval_builders.py function test_commonsenseqa_builder (line 9) | def test_commonsenseqa_builder() -> None: function test_openbookqa_builder (line 24) | def test_openbookqa_builder() -> None: FILE: tests/test_eval_state.py function _transformer_model (line 12) | def _transformer_model() -> HOPEModel: function test_parse_eval_state_mode_variants (line 25) | def test_parse_eval_state_mode_variants() -> None: function test_forward_with_eval_state_attention_cache_continuity (line 32) | def test_forward_with_eval_state_attention_cache_continuity() -> None: function test_forward_with_eval_state_none_state_passthrough (line 51) | def test_forward_with_eval_state_none_state_passthrough() -> None: FILE: tests/test_eval_state_cli.py function _load_eval_script (line 7) | def _load_eval_script(name: str): function test_zeroshot_rejects_carry_eval_state_mode (line 22) | def test_zeroshot_rejects_carry_eval_state_mode() -> None: function test_zeroshot_allows_reset_eval_state_mode_for_task_listing (line 42) | def test_zeroshot_allows_reset_eval_state_mode_for_task_listing() -> None: function test_niah_rejects_carry_eval_state_mode_before_loading_inputs (line 62) | def test_niah_rejects_carry_eval_state_mode_before_loading_inputs(tmp_pa... FILE: tests/test_faithfulness_harness.py function _cms_delta_l1 (line 8) | def _cms_delta_l1(state, level_name: str) -> float: function test_e2e_update_paths_and_surprise_gate (line 13) | def test_e2e_update_paths_and_surprise_gate() -> None: FILE: tests/test_fast_state_batch_semantics.py function test_fast_state_batch_semantics_raises_when_strict (line 7) | def test_fast_state_batch_semantics_raises_when_strict() -> None: function test_fast_state_batch_semantics_allows_batch1 (line 18) | def test_fast_state_batch_semantics_allows_batch1() -> None: function test_fast_state_batch_semantics_warns_with_structured_payload_when_not_strict (line 28) | def test_fast_state_batch_semantics_warns_with_structured_payload_when_n... FILE: tests/test_fast_state_forward_equivalence.py function test_fast_state_zero_deltas_matches_meta_forward (line 7) | def test_fast_state_zero_deltas_matches_meta_forward() -> None: FILE: tests/test_fast_state_meta_grads.py function test_fast_state_preserves_outer_grads_for_memory_meta_params (line 8) | def test_fast_state_preserves_outer_grads_for_memory_meta_params() -> None: FILE: tests/test_fast_state_selfmod_meta_grads.py function test_hope_selfmod_fast_state_preserves_meta_forward_at_init (line 8) | def test_hope_selfmod_fast_state_preserves_meta_forward_at_init() -> None: function test_hope_selfmod_fast_state_preserves_outer_grads_for_meta_memory_init (line 28) | def test_hope_selfmod_fast_state_preserves_outer_grads_for_meta_memory_i... FILE: tests/test_git_tracked_sizes_check.py function test_git_tracked_sizes_check_passes_repo_defaults (line 7) | def test_git_tracked_sizes_check_passes_repo_defaults() -> None: FILE: tests/test_hope_block.py function make_block (line 7) | def make_block() -> HOPEBlock: function test_hope_block_forward (line 17) | def test_hope_block_forward() -> None: function test_hope_block_self_mod (line 24) | def test_hope_block_self_mod() -> None: FILE: tests/test_hope_selfmod_fast_state_meta_unchanged.py function test_hope_selfmod_fast_state_updates_do_not_mutate_meta_params (line 9) | def test_hope_selfmod_fast_state_updates_do_not_mutate_meta_params() -> ... FILE: tests/test_hope_selfmod_integration.py function test_hope_selfmod_variant_updates_selfmod_state_in_fast_mode (line 8) | def test_hope_selfmod_variant_updates_selfmod_state_in_fast_mode() -> None: FILE: tests/test_hope_selfmod_update_pass.py function test_hope_selfmod_updates_module_params_only_in_update_pass (line 8) | def test_hope_selfmod_updates_module_params_only_in_update_pass() -> None: FILE: tests/test_levels.py function test_level_clock_updates_on_schedule (line 4) | def test_level_clock_updates_on_schedule() -> None: FILE: tests/test_m3.py function test_m3_updates_and_slow_momentum (line 6) | def test_m3_updates_and_slow_momentum() -> None: function test_m3_step_matches_reference_denominator_for_first_update (line 30) | def test_m3_step_matches_reference_denominator_for_first_update() -> None: function test_m3_two_steps_match_closed_form_without_slow_momentum (line 57) | def test_m3_two_steps_match_closed_form_without_slow_momentum() -> None: function test_m3_weight_decay_is_included_in_reference_step (line 93) | def test_m3_weight_decay_is_included_in_reference_step() -> None: function test_m3_slow_buffer_resets_and_o2_updates_on_chunk_boundary (line 121) | def test_m3_slow_buffer_resets_and_o2_updates_on_chunk_boundary() -> None: FILE: tests/test_m3_slow_timing.py function test_m3_slow_momentum_applies_next_chunk_not_boundary_step (line 6) | def test_m3_slow_momentum_applies_next_chunk_not_boundary_step() -> None: FILE: tests/test_memorization.py function _tiny_model (line 8) | def _tiny_model() -> HOPEModel: function _tiny_model_update_every_call (line 27) | def _tiny_model_update_every_call() -> HOPEModel: function _tiny_model_with_self_mod_lr (line 46) | def _tiny_model_with_self_mod_lr(lr: float) -> HOPEModel: function _fast_titan_delta_norm (line 62) | def _fast_titan_delta_norm(fast_state, before: dict[str, torch.Tensor]) ... function test_memorize_fast_state_does_not_mutate_meta_params (line 72) | def test_memorize_fast_state_does_not_mutate_meta_params() -> None: function test_memorize_fast_state_changes_outputs_and_resets (line 84) | def test_memorize_fast_state_changes_outputs_and_resets() -> None: function test_memorize_respects_surprise_threshold (line 105) | def test_memorize_respects_surprise_threshold() -> None: function test_memorize_paths_filter_blocks_updates (line 116) | def test_memorize_paths_filter_blocks_updates() -> None: function test_memorize_online_chunking_updates_once_per_target (line 127) | def test_memorize_online_chunking_updates_once_per_target() -> None: function test_teach_mask_restricts_memorization_updates (line 136) | def test_teach_mask_restricts_memorization_updates() -> None: function test_self_mod_lr_scales_fast_state_update_magnitude (line 161) | def test_self_mod_lr_scales_fast_state_update_magnitude() -> None: FILE: tests/test_model.py function test_model_forward (line 7) | def test_model_forward() -> None: FILE: tests/test_model_streaming_cadence.py function _metric (line 8) | def _metric(metrics: dict[str, float], key: str) -> float: function _build_attention_model (line 12) | def _build_attention_model(*, flush_partial: bool) -> HOPEModel: function _build_attention_model_with_period (line 26) | def _build_attention_model_with_period(*, update_period: int) -> HOPEModel: function test_model_streaming_cadence_matches_single_call_counts (line 40) | def test_model_streaming_cadence_matches_single_call_counts() -> None: function test_model_streaming_cadence_matches_for_multiple_periods (line 80) | def test_model_streaming_cadence_matches_for_multiple_periods(update_per... function test_model_finalize_flushes_partial_once (line 115) | def test_model_finalize_flushes_partial_once() -> None: function test_slow_cms_level_does_not_starve_under_segmented_calls (line 157) | def test_slow_cms_level_does_not_starve_under_segmented_calls() -> None: FILE: tests/test_online_chunking.py function test_online_chunking_carries_boundary_overlap_and_token_pairs (line 13) | def test_online_chunking_carries_boundary_overlap_and_token_pairs() -> N... function test_online_chunking_supports_chunk_size_one (line 26) | def test_online_chunking_supports_chunk_size_one() -> None: function test_online_chunking_chunk_size_one_preserves_train_loop_token_accounting (line 36) | def test_online_chunking_chunk_size_one_preserves_train_loop_token_accou... function test_online_boundary_chunks_emit_next_tokens_and_exact_target_count (line 46) | def test_online_boundary_chunks_emit_next_tokens_and_exact_target_count(... function _supervised_targets_overlap (line 59) | def _supervised_targets_overlap(tokens: torch.Tensor, chunk_size: int) -... function _supervised_targets_boundary (line 68) | def _supervised_targets_boundary(tokens: torch.Tensor, chunk_size: int) ... function _build_transformer_model (line 78) | def _build_transformer_model() -> HOPEModel: function test_online_boundary_chunked_loss_matches_monolithic_with_attention_cache (line 91) | def test_online_boundary_chunked_loss_matches_monolithic_with_attention_... function test_online_target_coverage_property_randomized (line 128) | def test_online_target_coverage_property_randomized() -> None: function test_chunk_schedule_permutations_preserve_supervision_set (line 140) | def test_chunk_schedule_permutations_preserve_supervision_set() -> None: function test_per_layer_teach_with_boundary_chunks_runs_update_path (line 155) | def test_per_layer_teach_with_boundary_chunks_runs_update_path() -> None: FILE: tests/test_optim.py function test_deep_momentum_nl_preconditioner_projects_grad (line 6) | def test_deep_momentum_nl_preconditioner_projects_grad() -> None: function test_deep_momentum_nl_preconditioner_reduces_simple_objective (line 18) | def test_deep_momentum_nl_preconditioner_reduces_simple_objective() -> N... function test_deep_momentum_keeps_state_per_param_key (line 32) | def test_deep_momentum_keeps_state_per_param_key() -> None: function test_deep_momentum_nl_preconditioner_skips_mismatched_shapes (line 44) | def test_deep_momentum_nl_preconditioner_skips_mismatched_shapes() -> None: function test_deep_momentum_nl_preconditioner_outputs_orthogonal_update (line 53) | def test_deep_momentum_nl_preconditioner_outputs_orthogonal_update() -> ... FILE: tests/test_optimizer_param_policy.py function _make_small_hope_model (line 9) | def _make_small_hope_model() -> HOPEModel: function _optimizer_param_set (line 23) | def _optimizer_param_set(optimizer: torch.optim.Optimizer) -> set[torch.... function test_param_policy_all_includes_all_trainable_params (line 31) | def test_param_policy_all_includes_all_trainable_params() -> None: function test_param_policy_exclude_memory_drops_memory_params (line 44) | def test_param_policy_exclude_memory_drops_memory_params() -> None: function test_param_policy_only_memory_keeps_only_memory_params (line 63) | def test_param_policy_only_memory_keeps_only_memory_params() -> None: FILE: tests/test_package_release_script.py function test_package_script_includes_train_flags_and_excludes_raw_data (line 8) | def test_package_script_includes_train_flags_and_excludes_raw_data(tmp_p... FILE: tests/test_paper_faithful_configs.py function _compose_config (line 9) | def _compose_config(name: str, overrides: list[str] | None = None): function test_pilot_paper_faithful_config_composes (line 16) | def test_pilot_paper_faithful_config_composes() -> None: function test_pilot_selfmod_paper_faithful_config_composes (line 33) | def test_pilot_selfmod_paper_faithful_config_composes() -> None: function test_paper_faithful_variants_are_explicitly_paper_defined (line 50) | def test_paper_faithful_variants_are_explicitly_paper_defined() -> None: function test_pilot_paper_faithful_override_to_boundary_state_mode_applies (line 58) | def test_pilot_paper_faithful_override_to_boundary_state_mode_applies() ... function test_pilot_paper_faithful_never_implicitly_falls_back_to_stopgrad (line 66) | def test_pilot_paper_faithful_never_implicitly_falls_back_to_stopgrad() ... FILE: tests/test_phase2_memorization_delta.py function _tiny_variant (line 8) | def _tiny_variant(variant: str) -> HOPEModel: function test_hope_attention_adapts_transformer_does_not (line 25) | def test_hope_attention_adapts_transformer_does_not() -> None: FILE: tests/test_residual_mlp_memory.py function test_residual_mlp_memory_matches_eq91_when_dims_match (line 7) | def test_residual_mlp_memory_matches_eq91_when_dims_match() -> None: function test_residual_mlp_memory_uses_projection_skip_when_dims_differ (line 18) | def test_residual_mlp_memory_uses_projection_skip_when_dims_differ() -> ... function test_residual_mlp_memory_disables_projection_skip_in_faithful_mode (line 23) | def test_residual_mlp_memory_disables_projection_skip_in_faithful_mode()... FILE: tests/test_run_features.py class _CaptureLogger (line 11) | class _CaptureLogger: method __init__ (line 12) | def __init__(self) -> None: method log (line 15) | def log(self, data: dict[str, object], step: int) -> None: function _tiny_model (line 19) | def _tiny_model() -> HOPEModel: function _tiny_cfg (line 32) | def _tiny_cfg(algorithm_mode: str) -> object: function test_run_features_reports_stopgrad_mode_flag (line 50) | def test_run_features_reports_stopgrad_mode_flag() -> None: function test_run_features_reports_boundary_state_mode_flag (line 62) | def test_run_features_reports_boundary_state_mode_flag() -> None: FILE: tests/test_self_modifying_titans.py function test_self_modifying_titans_forward_shape (line 6) | def test_self_modifying_titans_forward_shape() -> None: function test_self_modifying_titans_updates_fast_state (line 13) | def test_self_modifying_titans_updates_fast_state() -> None: function test_self_modifying_titans_supports_batch_fast_state_updates (line 24) | def test_self_modifying_titans_supports_batch_fast_state_updates() -> None: function test_self_modifying_titans_chunked_outputs_match_no_update_with_single_chunk (line 35) | def test_self_modifying_titans_chunked_outputs_match_no_update_with_sing... function test_self_modifying_titans_flushes_partial_chunks_for_memory_updates (line 57) | def test_self_modifying_titans_flushes_partial_chunks_for_memory_updates... FILE: tests/test_selfmod_adaptive_q.py function test_selfmod_fixed_q_does_not_update_q_memory (line 6) | def test_selfmod_fixed_q_does_not_update_q_memory() -> None: function test_selfmod_adaptive_q_updates_q_memory (line 16) | def test_selfmod_adaptive_q_updates_q_memory() -> None: FILE: tests/test_selfmod_dgd_linear.py function test_selfmod_linear_memory_l2_grad_matches_analytic (line 10) | def test_selfmod_linear_memory_l2_grad_matches_analytic() -> None: FILE: tests/test_selfmod_grad_flow.py function test_hope_selfmod_forward_allows_outer_gradients (line 8) | def test_hope_selfmod_forward_allows_outer_gradients() -> None: FILE: tests/test_selfmod_local_conv.py function test_selfmod_local_conv_is_causal (line 6) | def test_selfmod_local_conv_is_causal() -> None: FILE: tests/test_selfmod_online.py function test_selfmod_updates_on_update_pass_even_with_zero_teach_signal (line 8) | def test_selfmod_updates_on_update_pass_even_with_zero_teach_signal() ->... FILE: tests/test_strict_streaming_contract.py function test_strict_streaming_contract_rejects_non_paper_variant (line 14) | def test_strict_streaming_contract_rejects_non_paper_variant() -> None: function test_non_strict_streaming_contract_warns_for_non_paper_variant (line 25) | def test_non_strict_streaming_contract_warns_for_non_paper_variant( function test_strict_streaming_contract_allows_paper_defined_variants (line 40) | def test_strict_streaming_contract_allows_paper_defined_variants() -> None: function test_online_updates_without_fast_state_warns_when_not_strict (line 51) | def test_online_updates_without_fast_state_warns_when_not_strict( function test_online_updates_without_fast_state_fails_in_strict_mode (line 70) | def test_online_updates_without_fast_state_fails_in_strict_mode() -> None: function test_online_supervised_pairs_mismatch_warns_when_not_strict (line 85) | def test_online_supervised_pairs_mismatch_warns_when_not_strict( function test_online_supervised_pairs_mismatch_fails_in_strict_mode (line 93) | def test_online_supervised_pairs_mismatch_fails_in_strict_mode() -> None: function test_algorithm_mode_defaults_to_two_pass_stopgrad_updates (line 98) | def test_algorithm_mode_defaults_to_two_pass_stopgrad_updates() -> None: function test_algorithm_mode_rejects_unknown_values (line 103) | def test_algorithm_mode_rejects_unknown_values() -> None: function test_algorithm_mode_accepts_boundary_state_mode_name (line 109) | def test_algorithm_mode_accepts_boundary_state_mode_name() -> None: function test_boundary_state_mode_requires_online_per_layer_and_fast_state (line 114) | def test_boundary_state_mode_requires_online_per_layer_and_fast_state() ... function test_boundary_state_mode_rejects_distributed (line 133) | def test_boundary_state_mode_rejects_distributed() -> None: function test_boundary_state_mode_emits_experimental_warning (line 152) | def test_boundary_state_mode_emits_experimental_warning( function test_online_cache_requires_boundary_targets (line 176) | def test_online_cache_requires_boundary_targets() -> None: function test_online_cache_requires_online_updates (line 190) | def test_online_cache_requires_online_updates() -> None: FILE: tests/test_surprise_metric.py function _cms_delta_l1 (line 8) | def _cms_delta_l1(state, level_name: str) -> float: function _logit_entropy (line 13) | def _logit_entropy(logits: torch.Tensor) -> float: function _next_token_loss (line 20) | def _next_token_loss(logits: torch.Tensor, tokens: torch.Tensor) -> float: function test_surprise_metric_loss_gates_updates_when_threshold_set (line 28) | def test_surprise_metric_loss_gates_updates_when_threshold_set() -> None: function test_surprise_metric_entropy_gates_updates_when_threshold_set (line 69) | def test_surprise_metric_entropy_gates_updates_when_threshold_set() -> N... function test_surprise_metric_requires_external_value_when_threshold_set (line 110) | def test_surprise_metric_requires_external_value_when_threshold_set() ->... function test_surprise_metric_l2_uses_chunk_gate_then_token_mask (line 136) | def test_surprise_metric_l2_uses_chunk_gate_then_token_mask() -> None: FILE: tests/test_surprise_override.py function _entropy (line 6) | def _entropy(logits: torch.Tensor) -> float: function test_logit_entropy_surprise_uses_boundary_target_step_when_present (line 12) | def test_logit_entropy_surprise_uses_boundary_target_step_when_present()... function test_logit_entropy_surprise_default_excludes_last_unsupervised_step (line 27) | def test_logit_entropy_surprise_default_excludes_last_unsupervised_step(... function test_logit_entropy_surprise_returns_none_when_no_supervised_steps (line 41) | def test_logit_entropy_surprise_returns_none_when_no_supervised_steps() ... FILE: tests/test_teach_signal.py function _tiny_config (line 10) | def _tiny_config() -> ModelConfig: function _tiny_titan_config (line 28) | def _tiny_titan_config() -> TitanOnlyModelConfig: function test_teach_signal_matches_gradient (line 41) | def test_teach_signal_matches_gradient() -> None: function test_teach_signal_matches_gradient_titan (line 69) | def test_teach_signal_matches_gradient_titan() -> None: function test_per_layer_teach_signal_shapes (line 97) | def test_per_layer_teach_signal_shapes() -> None: function test_per_layer_teach_signal_matches_autograd_grads (line 113) | def test_per_layer_teach_signal_matches_autograd_grads() -> None: function test_teach_signal_matches_gradient_with_ignore_index (line 129) | def test_teach_signal_matches_gradient_with_ignore_index() -> None: function test_teach_signal_matches_gradient_with_boundary_target (line 164) | def test_teach_signal_matches_gradient_with_boundary_target() -> None: function test_teach_signal_matches_gradient_with_boundary_target_and_ignore_index (line 194) | def test_teach_signal_matches_gradient_with_boundary_target_and_ignore_i... FILE: tests/test_tied_weight_guard.py function _tiny_hope_model (line 10) | def _tiny_hope_model() -> HOPEModel: function test_paper_auditing_guard_accepts_tied_weights (line 23) | def test_paper_auditing_guard_accepts_tied_weights() -> None: function test_paper_auditing_guard_rejects_untied_weights (line 29) | def test_paper_auditing_guard_rejects_untied_weights() -> None: FILE: tests/test_variants.py function _base_cfg (line 10) | def _base_cfg(*, block_variant: str) -> ModelConfig: function test_hope_hybrid_variant_contains_titan_memory (line 25) | def test_hope_hybrid_variant_contains_titan_memory() -> None: function test_hope_attention_variant_excludes_titan_memory (line 32) | def test_hope_attention_variant_excludes_titan_memory() -> None: function test_hope_selfmod_variant_excludes_titan_memory (line 43) | def test_hope_selfmod_variant_excludes_titan_memory() -> None: function test_transformer_variant_runs_with_and_without_fast_state (line 56) | def test_transformer_variant_runs_with_and_without_fast_state() -> None: FILE: tests/test_verify_docs_refs.py function _load_verify_docs_refs (line 5) | def _load_verify_docs_refs(): function test_parse_referenced_paths_extracts_repo_paths (line 15) | def test_parse_referenced_paths_extracts_repo_paths() -> None: function test_verify_docs_refs_reports_missing_paths (line 31) | def test_verify_docs_refs_reports_missing_paths(tmp_path: Path) -> None: function test_verify_docs_refs_validates_markdown_anchors (line 47) | def test_verify_docs_refs_validates_markdown_anchors(tmp_path: Path) -> ... FILE: tests/test_verify_update_cadence.py function _load_verify_cadence (line 6) | def _load_verify_cadence(): function _write_log (line 18) | def _write_log(path: Path, payload: dict[str, float]) -> None: function test_verify_update_cadence_no_flush (line 22) | def test_verify_update_cadence_no_flush(tmp_path: Path) -> None: function test_verify_update_cadence_with_flush (line 44) | def test_verify_update_cadence_with_flush(tmp_path: Path) -> None: function test_verify_update_cadence_detects_mismatch (line 66) | def test_verify_update_cadence_detects_mismatch(tmp_path: Path) -> None: function test_verify_update_cadence_report_schema_is_non_empty (line 88) | def test_verify_update_cadence_report_schema_is_non_empty(tmp_path: Path... FILE: train.py function main (line 11) | def main(cfg: DictConfig) -> None: FILE: train_deepspeed.py function setup_distributed (line 30) | def setup_distributed() -> DistributedContext: function load_ds_config (line 40) | def load_ds_config(path: str | Path) -> dict: function main (line 46) | def main(cfg: DictConfig) -> None: FILE: train_dist.py function setup_distributed (line 13) | def setup_distributed(backend: str | None = None) -> DistributedContext: function main (line 28) | def main(cfg: DictConfig) -> None: FILE: train_fsdp.py function setup_distributed (line 38) | def setup_distributed() -> DistributedContext: function build_fsdp_model (line 48) | def build_fsdp_model(cfg: DictConfig, device: torch.device) -> tuple[FSD... function unwrap_model (line 72) | def unwrap_model(module: torch.nn.Module) -> torch.nn.Module: function save_checkpoint (line 80) | def save_checkpoint( function maybe_resume (line 114) | def maybe_resume(cfg: DictConfig, model: FSDP, optimizer: torch.optim.Op... function main (line 136) | def main(cfg: DictConfig) -> None: