# kickereb/poiesis-ansh architecture

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

- Interactive diagram: https://gitdiagram.com/kickereb/poiesis-ansh
- Repository: https://github.com/kickereb/poiesis-ansh

## Overview

Poiesis Ansh is a research experiment suite for measuring prompt, model-prior, and seed contributions to generated images. Its principal workflow is to generate or model an image, compute attribution measures, and record experiment results. The repository also contains robustness, spectral, architecture-prior, and real Stable Diffusion studies. The graph emphasizes documented entry points and sampled call relationships; connections for unsampled implementations are omitted rather than inferred.

Main entry points: [`real_model/model_utils.py`](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/model_utils.py) (Model Loading and Generation), [`experiment.py`](https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py) (Exact Toy Experiment), [`real_model/weight_tools.py`](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/weight_tools.py) (Low-Rank Weight Tools), [`real_model/run_seed_robustness.py`](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_seed_robustness.py) (Seed Robustness Study)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_toy["Toy Attribution"]
  node_toyexperiment["Exact Toy Experiment<br/>[experiment.py]"]
  node_toyprior["Learned Scene Prior<br/>[experiment.py]"]
  node_toymeasure["MI and Shapley<br/>[experiment.py]"]
  node_toyprobe["Attention Probe<br/>[experiment.py]"]
end

subgraph group_analysis["Attribution Studies"]
  node_robustness["Robustness Checks<br/>[robustness.py]"]
  node_spectral["Gaussian Spectral Benchmark<br/>[spectral_theory.py]"]
  node_architecture["Architecture Prior Pilot"]
end

subgraph group_real["Stable Diffusion Studies"]
  node_realreadme["Real Model Experiments<br/>[README.md]"]
  node_baseline["Baseline Generation<br/>[run_baseline.py]"]
  node_patchrun["Activation Patching Study"]
  node_patchtools["Activation Recorder and Patcher"]
  node_seedstudy["Seed Robustness Study"]
  node_weightstudy["Weight Direction Study"]
  node_gradientstudy["Gradient-Aligned LoRA"]
  node_outputgradient["Output Weight Gradients"]
  node_trainedlora["Trained LoRA Study"]
  node_weighttools["Low-Rank Weight Tools<br/>[weight_tools.py]"]
end

subgraph group_shared["Real Model Runtime"]
  node_runtime["Model Loading and Generation<br/>[model_utils.py]"]
end

node_researcher(("Researcher"))
node_checkpoint[("Stable Diffusion Checkpoint")]

node_researcher -->|"runs"| node_toyexperiment
node_toyexperiment -->|"learns prior"| node_toyprior
node_toyexperiment -->|"computes attribution"| node_toymeasure
node_toyexperiment -->|"probes routing"| node_toyprobe
node_researcher -->|"runs checks"| node_robustness
node_robustness -->|"uses core"| node_toyexperiment
node_researcher -->|"runs benchmark"| node_spectral
node_researcher -->|"runs pilot"| node_architecture
node_architecture -->|"uses benchmark"| node_spectral
node_researcher -->|"runs studies"| node_realreadme
node_realreadme -->|"documents experiment"| node_baseline
node_baseline -->|"loads and generates"| node_runtime
node_patchrun -->|"loads and generates"| node_runtime
node_patchrun -->|"uses hooks"| node_patchtools
node_seedstudy -->|"loads and generates"| node_runtime
node_seedstudy -->|"patches activations"| node_patchtools
node_seedstudy -->|"uses directions"| node_weighttools
node_weightstudy -->|"loads and generates"| node_runtime
node_weightstudy -->|"builds directions"| node_weighttools
node_gradientstudy -->|"loads and generates"| node_runtime
node_gradientstudy -->|"uses low-rank tools"| node_weighttools
node_outputgradient -->|"loads model"| node_runtime
node_outputgradient -->|"approximates gradients"| node_weighttools
node_outputgradient -->|"reuses helpers"| node_gradientstudy
node_trainedlora -->|"loads and generates"| node_runtime
node_trainedlora -->|"trains adapter"| node_weighttools
node_runtime -->|"loads snapshot"| node_checkpoint

click node_toyexperiment "https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py"
click node_toyprior "https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py"
click node_toymeasure "https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py"
click node_toyprobe "https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py"
click node_robustness "https://github.com/kickereb/poiesis-ansh/blob/main/robustness.py"
click node_spectral "https://github.com/kickereb/poiesis-ansh/blob/main/spectral_theory.py"
click node_architecture "https://github.com/kickereb/poiesis-ansh/blob/main/architecture_prior.py"
click node_realreadme "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/README.md"
click node_baseline "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_baseline.py"
click node_patchrun "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_activation_patching.py"
click node_patchtools "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/activation_tools.py"
click node_seedstudy "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_seed_robustness.py"
click node_weightstudy "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_weight_directions.py"
click node_gradientstudy "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_gradient_svd_lora.py"
click node_outputgradient "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_output_weight_gradients.py"
click node_trainedlora "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_trained_lora.py"
click node_weighttools "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/weight_tools.py"
click node_runtime "https://github.com/kickereb/poiesis-ansh/blob/main/real_model/model_utils.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_toyexperiment,node_toyprior,node_toymeasure,node_toyprobe toneBlue
class node_robustness,node_spectral,node_architecture,node_checkpoint toneAmber
class node_realreadme,node_baseline,node_patchrun,node_patchtools,node_seedstudy,node_weightstudy,node_gradientstudy,node_outputgradient,node_trainedlora,node_weighttools toneMint
class node_runtime toneRose
class node_researcher toneIndigo
```

## Components

### Toy Attribution

- [Exact Toy Experiment](https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py): `experiment.py`
- [Learned Scene Prior](https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py): `experiment.py`
- [MI and Shapley](https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py): `experiment.py`
- [Attention Probe](https://github.com/kickereb/poiesis-ansh/blob/main/experiment.py): `experiment.py`

### Attribution Studies

- [Robustness Checks](https://github.com/kickereb/poiesis-ansh/blob/main/robustness.py): `robustness.py`
- [Gaussian Spectral Benchmark](https://github.com/kickereb/poiesis-ansh/blob/main/spectral_theory.py): `spectral_theory.py`
- [Architecture Prior Pilot](https://github.com/kickereb/poiesis-ansh/blob/main/architecture_prior.py): `architecture_prior.py`

### Stable Diffusion Studies

- [Real Model Experiments](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/README.md): `real_model/README.md`
- [Baseline Generation](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_baseline.py): `real_model/run_baseline.py`
- [Activation Patching Study](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_activation_patching.py): `real_model/run_activation_patching.py`
- [Activation Recorder and Patcher](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/activation_tools.py): `real_model/activation_tools.py`
- [Seed Robustness Study](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_seed_robustness.py): `real_model/run_seed_robustness.py`
- [Weight Direction Study](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_weight_directions.py): `real_model/run_weight_directions.py`
- [Gradient-Aligned LoRA](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_gradient_svd_lora.py): `real_model/run_gradient_svd_lora.py`
- [Output Weight Gradients](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_output_weight_gradients.py): `real_model/run_output_weight_gradients.py`
- [Trained LoRA Study](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/run_trained_lora.py): `real_model/run_trained_lora.py`
- [Low-Rank Weight Tools](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/weight_tools.py): `real_model/weight_tools.py`

### Real Model Runtime

- [Model Loading and Generation](https://github.com/kickereb/poiesis-ansh/blob/main/real_model/model_utils.py): `real_model/model_utils.py`

### Other components

- **Researcher**
- **Stable Diffusion Checkpoint**

## Connections

- Researcher → Exact Toy Experiment: runs (evidence: `README.md`)
- Exact Toy Experiment → Learned Scene Prior: learns prior (evidence: `experiment.py`)
- Exact Toy Experiment → MI and Shapley: computes attribution (evidence: `experiment.py`)
- Exact Toy Experiment → Attention Probe: probes routing (evidence: `experiment.py`)
- Researcher → Robustness Checks: runs checks (evidence: `README.md`)
- Robustness Checks → Exact Toy Experiment: uses core (evidence: `robustness.py`)
- Researcher → Gaussian Spectral Benchmark: runs benchmark (evidence: `README.md`)
- Researcher → Architecture Prior Pilot: runs pilot (evidence: `README.md`)
- Architecture Prior Pilot → Gaussian Spectral Benchmark: uses benchmark (evidence: `architecture_prior.py`)
- Researcher → Real Model Experiments: runs studies (evidence: `README.md`)
- Real Model Experiments → Baseline Generation: documents experiment (evidence: `README.md`)
- Baseline Generation → Model Loading and Generation: loads and generates (evidence: `real_model/run_baseline.py`)
- Activation Patching Study → Model Loading and Generation: loads and generates (evidence: `real_model/run_activation_patching.py`)
- Activation Patching Study → Activation Recorder and Patcher: uses hooks (evidence: `real_model/run_activation_patching.py`)
- Seed Robustness Study → Model Loading and Generation: loads and generates (evidence: `real_model/run_seed_robustness.py`)
- Seed Robustness Study → Activation Recorder and Patcher: patches activations (evidence: `real_model/run_seed_robustness.py`)
- Seed Robustness Study → Low-Rank Weight Tools: uses directions (evidence: `real_model/run_seed_robustness.py`)
- Weight Direction Study → Model Loading and Generation: loads and generates (evidence: `real_model/run_weight_directions.py`)
- Weight Direction Study → Low-Rank Weight Tools: builds directions (evidence: `real_model/run_weight_directions.py`)
- Gradient-Aligned LoRA → Model Loading and Generation: loads and generates (evidence: `real_model/run_gradient_svd_lora.py`)
- Gradient-Aligned LoRA → Low-Rank Weight Tools: uses low-rank tools (evidence: `real_model/run_gradient_svd_lora.py`)
- Output Weight Gradients → Model Loading and Generation: loads model (evidence: `real_model/run_output_weight_gradients.py`)
- Output Weight Gradients → Low-Rank Weight Tools: approximates gradients (evidence: `real_model/run_output_weight_gradients.py`)
- Output Weight Gradients → Gradient-Aligned LoRA: reuses helpers (evidence: `real_model/run_output_weight_gradients.py`)
- Trained LoRA Study → Model Loading and Generation: loads and generates (evidence: `real_model/run_trained_lora.py`)
- Trained LoRA Study → Low-Rank Weight Tools: trains adapter (evidence: `real_model/run_trained_lora.py`)
- Model Loading and Generation → Stable Diffusion Checkpoint: loads snapshot (evidence: `real_model/model_utils.py`)
