# ashy5454/cmp-research architecture

> Architecture diagram of the GitHub repository ashy5454/cmp-research, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashy5454/cmp-research
- Repository: https://github.com/ashy5454/cmp-research

## Overview

#### Purpose and entry points
CMP Research evaluates a proposed sparse, recurrent, pattern-native alternative to attention for converting surface patterns into reusable semantic state. The repository is experiment-first rather than a deployable application. Primary runnable entry points are probe/training scripts under `src/`, experiment-specific runners under `experiments/`, and an autonomous research loop under `cmp_autoresearch/loop_v2.py`.

#### Core CMP probe suite
The `src/` scripts implement the current empirical evidence for learned semantic state, pattern decoding, causal subspaces, and context behavior:
- `src/cmp_pattern_probe.py`
- `src/cmp_meaning_probe_v5.py`
- `src/cmp_meaning_subspace_ablation_probe_v3.py`
- `src/cmp_long_context_probe.py`
- `src/cmp_compute_stats.py`

These are the principal boundary between CMP model hypotheses and measurable results. They produce metrics used to decide whether CMP representations encode semantics beyond token-level prediction.

#### Stage 0: pattern-decoder objective
The first proof gate compares next-vocabulary prediction, sparse-pattern binary prediction, and hybrid objectives. The experiment is organized in:
- `experiments/stage0_pattern_decoder/README.md`
- `src/cmp_pattern_probe.py`
- `src/cmp_wikitext.py`

Dataset handling and training inputs are separated from the core probes through `cmp_wikitext.py`. This stage determines whether CMP’s distinctive “predict sparse patterns” objective is warranted before scaling.

#### Matched-model and geometry validation
CMP-specific claims must survive matched controls rather than standalone results. Baseline comparisons and semantic-geometry tests reside in:
- `experiments/matched_baselines/README.md`
- `experiments/matched_semantic_geometry/run_matched_geometry.py`
- `experiments/matched_semantic_geometry/README.md`

The intended controls include GRU/hash-input and hash-attention models, with Mamba/SSM conditional on a clean implementation. This is the key causal boundary between architectural effect and generic trained-sequence-model behavior.

#### Activation-density sweep
Activation density `k` is treated as a first-class architectural control variable, tested across planned sparsity levels. The executable sweep and retained curated results are:
- `experiments/activation_density/cmp_density_sweep.py`
- `artifacts/density_sweep/2026-05-16/density_sweep_results.json`
- `artifacts/density_sweep/2026-05-16/density_sweep_log.txt`

This stage links sparse activation configuration to model quality and compute behavior; it gates later architecture and local-learning work.

#### Autonomous research orchestration
`cmp_autoresearch/` is a separate agentic research-control subsystem rather than CMP model code:
- `cmp_autoresearch/loop_v2.py`
- `cmp_autoresearch/hypothesis_council.py`
- `cmp_autoresearch/challenger.py`
- `cmp_autoresearch/dashboard/api.py`

It appears to coordinate hypothesis generation/challenge, paper reading, narration, and dashboard exposure, configured through `cmp_autoresearch/research.yaml`. The dashboard has a static frontend at `cmp_autoresearch/dashboard/static/index.html`.

#### Research governance and external inputs
Research direction, proof gates, datasets, and source provenance are controlled through documentation rather than an application service:
- `docs/team/current_direction.md`
- `docs/team/datasets.md`
- `docs/CMP_Research_Log.md`
- `papers/local_paper_manifest.csv`

External dependencies are Python packages listed in `requirements.txt`, corpus/data sources registered in the dataset documentation, and locally indexed—but uncommitted—papers. Checkpoints, dataset caches, and large pattern files are deliberately outside version control; small reproducible summaries are retained under `artifacts/`.

Main entry points: [`cmp_autoresearch/loop_v2.py`](https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/loop_v2.py) (Research loop), [`src/cmp_meaning_probe_v5.py`](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_meaning_probe_v5.py) (Semantic state probe), [`src/cmp_pattern_probe.py`](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_pattern_probe.py) (Pattern decoder probe), [`src/cmp_compute_stats.py`](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_compute_stats.py) (Compute statistics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cmp["CMP Probe Suite"]
  node_wikitext["Training data pipeline<br/>dataset loader<br/>[cmp_wikitext.py]"]
  node_pattern_probe["Pattern decoder probe<br/>training probe"]
  node_meaning_probe["Semantic state probe<br/>representation probe"]
  node_subspace_probe["Causal subspace ablation<br/>ablation probe"]
  node_context_probe["Long-context probe"]
  node_compute_stats["Compute statistics<br/>metrics analysis"]
end

subgraph group_experiments["Validation Experiments"]
  node_stage0["Stage 0 proof gate<br/>experiment plan<br/>[README.md]"]
  node_baselines["Matched baselines<br/>control plan<br/>[README.md]"]
  node_geometry["Matched geometry runner<br/>validation runner"]
  node_density_sweep["Activation-density sweep<br/>sparsity experiment"]
  node_density_results["Density results<br/>curated metrics"]
end

subgraph group_research_loop["Autonomous Research"]
  node_research_loop_node{{"Research loop<br/>orchestrator<br/>[loop_v2.py]"}}
  node_council["Hypothesis council<br/>hypothesis generator"]
  node_challenger["Claim challenger<br/>research critic<br/>[challenger.py]"]
  node_dashboard_api["Research dashboard API<br/>dashboard backend<br/>[api.py]"]
  node_dashboard_ui["Research dashboard<br/>static frontend<br/>[index.html]"]
end

subgraph group_governance["Research Governance"]
  node_direction["Current direction<br/>research plan"]
  node_datasets["Dataset registry<br/>dataset policy<br/>[datasets.md]"]
  node_research_log["Research log<br/>research record"]
  node_paper_manifest["Paper manifest<br/>source index"]
end

node_direction -.->|"sets gate"| node_stage0
node_direction -.->|"requires controls"| node_baselines
node_datasets -.->|"governs sources"| node_wikitext
node_wikitext -->|"supplies training inputs"| node_pattern_probe
node_stage0 -->|"organizes objective test"| node_pattern_probe
node_pattern_probe -->|"produces candidate representations"| node_meaning_probe
node_meaning_probe -->|"tests semantic geometry"| node_subspace_probe
node_meaning_probe -->|"extends to context behavior"| node_context_probe
node_pattern_probe -->|"reports metrics"| node_compute_stats
node_context_probe -->|"reports metrics"| node_compute_stats
node_baselines -->|"specifies matched controls"| node_geometry
node_meaning_probe -->|"compares semantic geometry"| node_geometry
node_density_sweep -->|"writes curated results"| node_density_results
node_density_sweep -->|"relates sparsity to compute"| node_compute_stats
node_research_loop_node -->|"solicits hypotheses"| node_council
node_research_loop_node -->|"solicits challenges"| node_challenger
node_paper_manifest -.->|"provides paper provenance"| node_research_loop_node
node_research_loop_node -->|"publishes status"| node_dashboard_api
node_dashboard_api -->|"serves research data"| node_dashboard_ui
node_research_loop_node -->|"records outcomes"| node_research_log

click node_direction "https://github.com/ashy5454/cmp-research/blob/master/docs/team/current_direction.md"
click node_datasets "https://github.com/ashy5454/cmp-research/blob/master/docs/team/datasets.md"
click node_research_log "https://github.com/ashy5454/cmp-research/blob/master/docs/CMP_Research_Log.md"
click node_paper_manifest "https://github.com/ashy5454/cmp-research/blob/master/papers/local_paper_manifest.csv"
click node_wikitext "https://github.com/ashy5454/cmp-research/blob/master/src/cmp_wikitext.py"
click node_pattern_probe "https://github.com/ashy5454/cmp-research/blob/master/src/cmp_pattern_probe.py"
click node_meaning_probe "https://github.com/ashy5454/cmp-research/blob/master/src/cmp_meaning_probe_v5.py"
click node_subspace_probe "https://github.com/ashy5454/cmp-research/blob/master/src/cmp_meaning_subspace_ablation_probe_v3.py"
click node_context_probe "https://github.com/ashy5454/cmp-research/blob/master/src/cmp_long_context_probe.py"
click node_compute_stats "https://github.com/ashy5454/cmp-research/blob/master/src/cmp_compute_stats.py"
click node_stage0 "https://github.com/ashy5454/cmp-research/blob/master/experiments/stage0_pattern_decoder/README.md"
click node_baselines "https://github.com/ashy5454/cmp-research/blob/master/experiments/matched_baselines/README.md"
click node_geometry "https://github.com/ashy5454/cmp-research/blob/master/experiments/matched_semantic_geometry/run_matched_geometry.py"
click node_density_sweep "https://github.com/ashy5454/cmp-research/blob/master/experiments/activation_density/cmp_density_sweep.py"
click node_density_results "https://github.com/ashy5454/cmp-research/blob/master/artifacts/density_sweep/2026-05-16/density_sweep_results.json"
click node_research_loop_node "https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/loop_v2.py"
click node_council "https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/hypothesis_council.py"
click node_challenger "https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/challenger.py"
click node_dashboard_api "https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/dashboard/api.py"
click node_dashboard_ui "https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/dashboard/static/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wikitext,node_pattern_probe,node_meaning_probe,node_subspace_probe,node_context_probe,node_compute_stats toneBlue
class node_stage0,node_baselines,node_geometry,node_density_sweep,node_density_results toneAmber
class node_research_loop_node,node_council,node_challenger,node_dashboard_api,node_dashboard_ui toneMint
class node_direction,node_datasets,node_research_log,node_paper_manifest toneRose
```

## Components

### CMP Probe Suite

Empirical scripts testing learned semantic state and context behavior.

- [Training data pipeline](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_wikitext.py): dataset loader · Separates corpus handling from probe logic. · `src/cmp_wikitext.py`
- [Pattern decoder probe](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_pattern_probe.py): training probe · Tests vocabulary, sparse-pattern, and hybrid objectives. · `src/cmp_pattern_probe.py`
- [Semantic state probe](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_meaning_probe_v5.py): representation probe · Measures reusable semantic state beyond token prediction. · `src/cmp_meaning_probe_v5.py`
- [Causal subspace ablation](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_meaning_subspace_ablation_probe_v3.py): ablation probe · Tests causal semantic subspaces in CMP representations. · `src/cmp_meaning_subspace_ablation_probe_v3.py`
- [Long-context probe](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_long_context_probe.py): context probe · `src/cmp_long_context_probe.py`
- [Compute statistics](https://github.com/ashy5454/cmp-research/blob/master/src/cmp_compute_stats.py): metrics analysis · Summarizes quality and compute behavior. · `src/cmp_compute_stats.py`

### Validation Experiments

Stage gates, controls, and architecture sweeps.

- [Stage 0 proof gate](https://github.com/ashy5454/cmp-research/blob/master/experiments/stage0_pattern_decoder/README.md): experiment plan · Decides whether sparse-pattern prediction is warranted before scaling. · `experiments/stage0_pattern_decoder/README.md`
- [Matched baselines](https://github.com/ashy5454/cmp-research/blob/master/experiments/matched_baselines/README.md): control plan · Defines matched sequence-model controls for CMP claims. · `experiments/matched_baselines/README.md`
- [Matched geometry runner](https://github.com/ashy5454/cmp-research/blob/master/experiments/matched_semantic_geometry/run_matched_geometry.py): validation runner · Executes semantic-geometry comparisons against controls. · `experiments/matched_semantic_geometry/run_matched_geometry.py`
- [Activation-density sweep](https://github.com/ashy5454/cmp-research/blob/master/experiments/activation_density/cmp_density_sweep.py): sparsity experiment · Tests activation density k as an architectural control. · `experiments/activation_density/cmp_density_sweep.py`
- [Density results](https://github.com/ashy5454/cmp-research/blob/master/artifacts/density_sweep/2026-05-16/density_sweep_results.json): curated metrics · Retained reproducible sweep summary. · `artifacts/density_sweep/2026-05-16/density_sweep_results.json`

### Autonomous Research

Agentic subsystem for directing and exposing research work.

- [Research loop](https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/loop_v2.py): orchestrator · Coordinates autonomous hypothesis-driven research cycles. · `cmp_autoresearch/loop_v2.py`
- [Hypothesis council](https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/hypothesis_council.py): hypothesis generator · `cmp_autoresearch/hypothesis_council.py`
- [Claim challenger](https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/challenger.py): research critic · `cmp_autoresearch/challenger.py`
- [Research dashboard API](https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/dashboard/api.py): dashboard backend · Exposes research-loop status and narration. · `cmp_autoresearch/dashboard/api.py`
- [Research dashboard](https://github.com/ashy5454/cmp-research/blob/master/cmp_autoresearch/dashboard/static/index.html): static frontend · `cmp_autoresearch/dashboard/static/index.html`

### Research Governance

Documents and provenance controlling research direction and inputs.

- [Current direction](https://github.com/ashy5454/cmp-research/blob/master/docs/team/current_direction.md): research plan · Defines proof gates and research priorities. · `docs/team/current_direction.md`
- [Dataset registry](https://github.com/ashy5454/cmp-research/blob/master/docs/team/datasets.md): dataset policy · Registers corpus sources and handling guidance. · `docs/team/datasets.md`
- [Research log](https://github.com/ashy5454/cmp-research/blob/master/docs/CMP_Research_Log.md): research record · `docs/CMP_Research_Log.md`
- [Paper manifest](https://github.com/ashy5454/cmp-research/blob/master/papers/local_paper_manifest.csv): source index · Indexes locally available research papers. · `papers/local_paper_manifest.csv`

## Connections

- Current direction → Stage 0 proof gate: sets gate
- Current direction → Matched baselines: requires controls
- Dataset registry → Training data pipeline: governs sources
- Training data pipeline → Pattern decoder probe: supplies training inputs
- Stage 0 proof gate → Pattern decoder probe: organizes objective test
- Pattern decoder probe → Semantic state probe: produces candidate representations
- Semantic state probe → Causal subspace ablation: tests semantic geometry
- Semantic state probe → Long-context probe: extends to context behavior
- Pattern decoder probe → Compute statistics: reports metrics
- Long-context probe → Compute statistics: reports metrics
- Matched baselines → Matched geometry runner: specifies matched controls
- Semantic state probe → Matched geometry runner: compares semantic geometry
- Activation-density sweep → Density results: writes curated results
- Activation-density sweep → Compute statistics: relates sparsity to compute
- Research loop → Hypothesis council: solicits hypotheses
- Research loop → Claim challenger: solicits challenges
- Paper manifest → Research loop: provides paper provenance
- Research loop → Research dashboard API: publishes status
- Research dashboard API → Research dashboard: serves research data
- Research loop → Research log: records outcomes
