# mirros-lab/s-space architecture

> Architecture diagram of the GitHub repository mirros-lab/s-space, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mirros-lab/s-space
- Repository: https://github.com/mirros-lab/s-space

## Overview

S-Space is a research toolkit for constructing and evaluating a spatial representation in multimodal models. Its main workflow prepares benchmark data, extracts model activations to learn spatial axes, validates and publishes those axes, then uses them in readout and intervention experiments. The README also documents distinct prompt-generalization, multi-view, action-supervision, perspective-taking, and reasoning-context studies. The source excerpts show parts of the extraction and model layers; links for unsampled experiment subsystems rely on the README’s documented capabilities.

Main entry points: [`sspace/experiments/workflows.py`](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/workflows.py) (Experiment workflows), [`sspace/core/pipeline.py`](https://github.com/mirros-lab/s-space/blob/main/sspace/core/pipeline.py) (Training pipeline), [`sspace/data/assets.py`](https://github.com/mirros-lab/s-space/blob/main/sspace/data/assets.py) (Pinned assets), [`sspace/data/coco/pipeline.py`](https://github.com/mirros-lab/s-space/blob/main/sspace/data/coco/pipeline.py) (COCO preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Workflow entry"]
  node_workflow["Experiment workflows<br/>[workflows.py]"]
  node_registry["Experiment registry<br/>[registry.py]"]
end

subgraph group_data["Data preparation"]
  node_assets["Pinned assets<br/>[assets.py]"]
  node_dataset_hub["Dataset hub<br/>[hub.py]"]
  node_coco_prep["COCO preparation<br/>[pipeline.py]"]
  node_data_access["Dataset access<br/>[data.py]"]
end

subgraph group_construction["S-Space construction"]
  node_config["Training configuration<br/>[config.py]"]
  node_prompt_templates["Frozen prompts<br/>[templates.py]"]
  node_prompt_rendering["Prompt rendering<br/>[rendering.py]"]
  node_model_runtime["Model runtime<br/>[runtime.py]"]
  node_model_adapters["Model adapters<br/>[molmo.py]"]
  node_extraction["Activation extraction<br/>[execution.py]"]
  node_shard_storage[("Shard storage<br/>[storage.py]")]
  node_shard_merge["Shard merging<br/>[merge.py]"]
  node_training_pipeline["Training pipeline<br/>[pipeline.py]"]
  node_artifacts[("Spatial artifacts<br/>[artifacts.py]")]
  node_layer_selection["Layer selection<br/>[layers.py]"]
end

subgraph group_evaluation["Readout studies"]
  node_pairwise_eval["Pairwise evaluation<br/>[runner.py]"]
  node_prompt_sweeps["Prompt generalization<br/>[run_sweep.py]"]
  node_coordinate_analysis["Object coordinates<br/>[plot.py]"]
  node_lens_analysis["Coordinate lens<br/>[inference.py]"]
end

subgraph group_experiments["Specialized studies"]
  node_multiview["Multi-view reasoning<br/>[hstar_multiview.py]"]
  node_intervention["Spatial interventions"]
  node_action_supervision["Action supervision<br/>[scoring.py]"]
  node_perspective["Perspective taking<br/>[direct.py]"]
  node_cot_evolution["CoT evolution<br/>[runtime.py]"]
  node_context_scaling["Context scaling<br/>[runner.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"selects study"| node_workflow
node_workflow -->|"resolves workflow"| node_registry
node_researcher -->|"prepares datasets"| node_assets
node_assets -->|"downloads assets"| node_dataset_hub
node_assets -.->|"supports COCO prep"| node_coco_prep
node_coco_prep -.->|"produces training data"| node_data_access
node_workflow -->|"runs construction"| node_training_pipeline
node_training_pipeline -->|"uses settings"| node_config
node_training_pipeline -->|"uses samples"| node_data_access
node_training_pipeline -->|"uses runtime"| node_model_runtime
node_model_runtime -->|"selects adapter"| node_model_adapters
node_model_adapters -->|"prepares prompts"| node_prompt_rendering
node_prompt_rendering -->|"renders templates"| node_prompt_templates
node_training_pipeline -->|"extracts activations"| node_extraction
node_extraction -.->|"stores shards"| node_shard_storage
node_training_pipeline -->|"merges shards"| node_shard_merge
node_training_pipeline -->|"selects readout layers"| node_layer_selection
node_training_pipeline -->|"publishes axes"| node_artifacts
node_workflow -->|"runs benchmark studies"| node_pairwise_eval
node_pairwise_eval -.->|"reads released axes"| node_artifacts
node_workflow -->|"runs prompt studies"| node_prompt_sweeps
node_workflow -->|"plots coordinates"| node_coordinate_analysis
node_workflow -.->|"runs coordinate lens"| node_lens_analysis
node_workflow -->|"runs HStar study"| node_multiview
node_workflow -->|"runs causal study"| node_intervention
node_workflow -->|"runs action study"| node_action_supervision
node_workflow -->|"runs perspective study"| node_perspective
node_workflow -->|"runs CoT study"| node_cot_evolution
node_workflow -->|"runs context study"| node_context_scaling

click node_workflow "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/workflows.py"
click node_registry "https://github.com/mirros-lab/s-space/blob/main/sspace/registry.py"
click node_assets "https://github.com/mirros-lab/s-space/blob/main/sspace/data/assets.py"
click node_dataset_hub "https://github.com/mirros-lab/s-space/blob/main/sspace/data/hub.py"
click node_coco_prep "https://github.com/mirros-lab/s-space/blob/main/sspace/data/coco/pipeline.py"
click node_data_access "https://github.com/mirros-lab/s-space/blob/main/sspace/core/data.py"
click node_config "https://github.com/mirros-lab/s-space/blob/main/sspace/core/config.py"
click node_prompt_templates "https://github.com/mirros-lab/s-space/blob/main/sspace/core/prompts/templates.py"
click node_prompt_rendering "https://github.com/mirros-lab/s-space/blob/main/sspace/core/prompts/rendering.py"
click node_model_runtime "https://github.com/mirros-lab/s-space/blob/main/sspace/core/models/runtime.py"
click node_model_adapters "https://github.com/mirros-lab/s-space/blob/main/sspace/core/models/molmo.py"
click node_extraction "https://github.com/mirros-lab/s-space/blob/main/sspace/core/extraction/execution.py"
click node_shard_storage "https://github.com/mirros-lab/s-space/blob/main/sspace/core/extraction/storage.py"
click node_shard_merge "https://github.com/mirros-lab/s-space/blob/main/sspace/core/extraction/merge.py"
click node_training_pipeline "https://github.com/mirros-lab/s-space/blob/main/sspace/core/pipeline.py"
click node_artifacts "https://github.com/mirros-lab/s-space/blob/main/sspace/core/artifacts/artifacts.py"
click node_layer_selection "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/validation/coco1800/selection/layers.py"
click node_pairwise_eval "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/common/pairwise/runner.py"
click node_prompt_sweeps "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/prompt/where/run_sweep.py"
click node_coordinate_analysis "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/analysis/object_coordinates/plot.py"
click node_lens_analysis "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/analysis/object_coordinate_lens/inference.py"
click node_multiview "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/multi_view/hstar/hstar_multiview.py"
click node_intervention "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/intervention/spatial_causality/spatial_jacobian/spatial_causality.py"
click node_action_supervision "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/action_supervision/instructpart/scoring.py"
click node_perspective "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/spinbench/perspective_taking/direct.py"
click node_cot_evolution "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/spinbench/evolving_cot/runtime.py"
click node_context_scaling "https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/analysis/contextual_cases/runner.py"

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_workflow,node_registry toneBlue
class node_assets,node_dataset_hub,node_coco_prep,node_data_access toneAmber
class node_config,node_prompt_templates,node_prompt_rendering,node_model_runtime,node_model_adapters,node_extraction,node_shard_storage,node_shard_merge,node_training_pipeline,node_artifacts,node_layer_selection toneMint
class node_pairwise_eval,node_prompt_sweeps,node_coordinate_analysis,node_lens_analysis toneRose
class node_multiview,node_intervention,node_action_supervision,node_perspective,node_cot_evolution,node_context_scaling,node_researcher toneIndigo
```

## Components

### Workflow entry

- [Experiment workflows](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/workflows.py): `sspace/experiments/workflows.py`
- [Experiment registry](https://github.com/mirros-lab/s-space/blob/main/sspace/registry.py): `sspace/registry.py`

### Data preparation

- [Pinned assets](https://github.com/mirros-lab/s-space/blob/main/sspace/data/assets.py): `sspace/data/assets.py`
- [Dataset hub](https://github.com/mirros-lab/s-space/blob/main/sspace/data/hub.py): `sspace/data/hub.py`
- [COCO preparation](https://github.com/mirros-lab/s-space/blob/main/sspace/data/coco/pipeline.py): `sspace/data/coco/pipeline.py`
- [Dataset access](https://github.com/mirros-lab/s-space/blob/main/sspace/core/data.py): `sspace/core/data.py`

### S-Space construction

- [Training configuration](https://github.com/mirros-lab/s-space/blob/main/sspace/core/config.py): `sspace/core/config.py`
- [Frozen prompts](https://github.com/mirros-lab/s-space/blob/main/sspace/core/prompts/templates.py): `sspace/core/prompts/templates.py`
- [Prompt rendering](https://github.com/mirros-lab/s-space/blob/main/sspace/core/prompts/rendering.py): `sspace/core/prompts/rendering.py`
- [Model runtime](https://github.com/mirros-lab/s-space/blob/main/sspace/core/models/runtime.py): `sspace/core/models/runtime.py`
- [Model adapters](https://github.com/mirros-lab/s-space/blob/main/sspace/core/models/molmo.py): `sspace/core/models/molmo.py`
- [Activation extraction](https://github.com/mirros-lab/s-space/blob/main/sspace/core/extraction/execution.py): `sspace/core/extraction/execution.py`
- [Shard storage](https://github.com/mirros-lab/s-space/blob/main/sspace/core/extraction/storage.py): `sspace/core/extraction/storage.py`
- [Shard merging](https://github.com/mirros-lab/s-space/blob/main/sspace/core/extraction/merge.py): `sspace/core/extraction/merge.py`
- [Training pipeline](https://github.com/mirros-lab/s-space/blob/main/sspace/core/pipeline.py): `sspace/core/pipeline.py`
- [Spatial artifacts](https://github.com/mirros-lab/s-space/blob/main/sspace/core/artifacts/artifacts.py): `sspace/core/artifacts/artifacts.py`
- [Layer selection](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/validation/coco1800/selection/layers.py): `sspace/experiments/validation/coco1800/selection/layers.py`

### Readout studies

- [Pairwise evaluation](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/common/pairwise/runner.py): `sspace/experiments/common/pairwise/runner.py`
- [Prompt generalization](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/prompt/where/run_sweep.py): `sspace/experiments/prompt/where/run_sweep.py`
- [Object coordinates](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/analysis/object_coordinates/plot.py): `sspace/experiments/analysis/object_coordinates/plot.py`
- [Coordinate lens](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/analysis/object_coordinate_lens/inference.py): `sspace/experiments/analysis/object_coordinate_lens/inference.py`

### Specialized studies

- [Multi-view reasoning](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/multi_view/hstar/hstar_multiview.py): `sspace/experiments/multi_view/hstar/hstar_multiview.py`
- [Spatial interventions](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/intervention/spatial_causality/spatial_jacobian/spatial_causality.py): `sspace/experiments/intervention/spatial_causality/spatial_jacobian/spatial_causality.py`
- [Action supervision](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/action_supervision/instructpart/scoring.py): `sspace/experiments/action_supervision/instructpart/scoring.py`
- [Perspective taking](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/spinbench/perspective_taking/direct.py): `sspace/experiments/spinbench/perspective_taking/direct.py`
- [CoT evolution](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/spinbench/evolving_cot/runtime.py): `sspace/experiments/spinbench/evolving_cot/runtime.py`
- [Context scaling](https://github.com/mirros-lab/s-space/blob/main/sspace/experiments/analysis/contextual_cases/runner.py): `sspace/experiments/analysis/contextual_cases/runner.py`

### Other components

- **Researcher**

## Connections

- Researcher → Experiment workflows: selects study
- Experiment workflows → Experiment registry: resolves workflow (evidence: `sspace/registry.py`)
- Researcher → Pinned assets: prepares datasets
- Pinned assets → Dataset hub: downloads assets (evidence: `sspace/data/assets.py`)
- Pinned assets → COCO preparation: supports COCO prep
- COCO preparation → Dataset access: produces training data
- Experiment workflows → Training pipeline: runs construction
- Training pipeline → Training configuration: uses settings (evidence: `sspace/core/pipeline.py`)
- Training pipeline → Dataset access: uses samples (evidence: `sspace/core/pipeline.py`)
- Training pipeline → Model runtime: uses runtime (evidence: `sspace/core/pipeline.py`)
- Model runtime → Model adapters: selects adapter (evidence: `sspace/core/models/runtime.py`)
- Model adapters → Prompt rendering: prepares prompts (evidence: `sspace/core/models/molmo.py`)
- Prompt rendering → Frozen prompts: renders templates (evidence: `sspace/core/prompts/rendering.py`)
- Training pipeline → Activation extraction: extracts activations (evidence: `sspace/core/pipeline.py`)
- Activation extraction → Shard storage: stores shards
- Training pipeline → Shard merging: merges shards (evidence: `sspace/core/pipeline.py`)
- Training pipeline → Layer selection: selects readout layers (evidence: `sspace/core/pipeline.py`)
- Training pipeline → Spatial artifacts: publishes axes (evidence: `sspace/core/pipeline.py`)
- Experiment workflows → Pairwise evaluation: runs benchmark studies
- Pairwise evaluation → Spatial artifacts: reads released axes
- Experiment workflows → Prompt generalization: runs prompt studies
- Experiment workflows → Object coordinates: plots coordinates
- Experiment workflows → Coordinate lens: runs coordinate lens
- Experiment workflows → Multi-view reasoning: runs HStar study
- Experiment workflows → Spatial interventions: runs causal study
- Experiment workflows → Action supervision: runs action study
- Experiment workflows → Perspective taking: runs perspective study
- Experiment workflows → CoT evolution: runs CoT study
- Experiment workflows → Context scaling: runs context study
