Skip to content

analysis

analysis

ForkAnalysis(spec: ExecutionSpec, base: Optional[Node] = None)

Bases: AnalysisBase[ForkAnalysisConfig, GPT]

Export tokenwise fork diversity and a per-fork logit lens.

capture_fork_blocks(module: Any, method: str) -> bool staticmethod

Capture fork outputs before attention/MLP, and boundary block states.

measure_tokenwise_diversity(states: np.ndarray, token_index: np.ndarray, sequence_length: int) -> list[dict[str, int | float | None]] staticmethod

Measure non-rightmost sibling cosine distance for each input token.

decode_token(token_id: int) -> str

Keep padded vocabulary IDs visible even without a tokenizer spelling.

measure_stage(*, stage: str, block_output: tuple[jax.Array, jax.Array, jax.Array], predictions: tuple[np.ndarray, np.ndarray, np.ndarray], token_ids: list[int], token_text: list[str]) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]

Turn one captured fork stage into diversity and lens records.

AnalyzeScratchbubbles(spec: ExecutionSpec, base: Optional[Node] = None)

Bases: ForkAnalysis

Analyze fork behavior in a Scratchbubbles checkpoint.

AnalyzeThoughtbubbles(spec: ExecutionSpec, base: Optional[Node] = None)

Bases: ForkAnalysis

Analyze fork behavior in a regular Thoughtbubbles checkpoint.

AnalyzeGPTForks(spec: ExecutionSpec, base: Optional[Node] = None)

Bases: ForkAnalysis

Unforked baseline at explicitly configured comparison layers.