# kds1123001/corruption-visualizer architecture

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

- Interactive diagram: https://gitdiagram.com/kds1123001/corruption-visualizer
- Repository: https://github.com/kds1123001/corruption-visualizer

## Overview

weight-glitcher trains a small image or text model, repeatedly corrupts selected live weights, and shows how inference changes. The CLI owns mode selection, training, corruption steps, and result presentation; `corrupt.py` implements the weight mutations. The image implementation is visible in `vision.py`. The `text` implementation is not excerpted, so its training and generation are represented only at the documented module boundary; edges reflect calls visible in `glitcher.py` or capabilities stated in the README.

Main entry points: [`glitcher.py`](https://github.com/kds1123001/corruption-visualizer/blob/main/glitcher.py) (Image runner), [`corrupt.py`](https://github.com/kds1123001/corruption-visualizer/blob/main/corrupt.py) (Corruption step), [`vision.py`](https://github.com/kds1123001/corruption-visualizer/blob/main/vision.py) (CNN training), [`text`](https://github.com/kds1123001/corruption-visualizer/blob/main/text) (Character-LSTM training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Run orchestration"]
  node_cli["CLI workflow<br/>[glitcher.py]"]
  node_image_runner["Image runner<br/>[glitcher.py]"]
  node_text_runner["Text runner<br/>[glitcher.py]"]
end

subgraph group_corruption["Weight corruption"]
  node_corrupt_step["Corruption step<br/>[corrupt.py]"]
end

subgraph group_image["Image target"]
  node_shape_data["Shape generation<br/>[vision.py]"]
  node_image_training["CNN training<br/>[vision.py]"]
  node_tinycnn["TinyCNN inference<br/>[vision.py]"]
end

subgraph group_text["Text target"]
  node_text_training["Character-LSTM training"]
  node_text_generation["Text generation"]
end

node_user(("User"))
node_image_result["Image probabilities"]
node_text_result["Generated text"]

node_user -->|"selects mode"| node_cli
node_cli -->|"dispatches image"| node_image_runner
node_cli -->|"dispatches text"| node_text_runner
node_image_runner -->|"trains model"| node_image_training
node_image_runner -->|"creates test shape"| node_shape_data
node_image_training -->|"builds batches"| node_shape_data
node_image_training -->|"trains"| node_tinycnn
node_image_runner -->|"corrupts weights"| node_corrupt_step
node_text_runner -->|"trains model"| node_text_training
node_text_runner -->|"corrupts weights"| node_corrupt_step
node_text_runner -->|"generates output"| node_text_generation
node_corrupt_step -->|"mutates parameters"| node_tinycnn
node_corrupt_step -->|"mutates parameters"| node_text_training
node_image_runner -->|"runs inference"| node_tinycnn
node_image_runner -->|"renders probabilities"| node_image_result
node_text_runner -->|"prints output"| node_text_result

click node_cli "https://github.com/kds1123001/corruption-visualizer/blob/main/glitcher.py"
click node_image_runner "https://github.com/kds1123001/corruption-visualizer/blob/main/glitcher.py"
click node_text_runner "https://github.com/kds1123001/corruption-visualizer/blob/main/glitcher.py"
click node_corrupt_step "https://github.com/kds1123001/corruption-visualizer/blob/main/corrupt.py"
click node_shape_data "https://github.com/kds1123001/corruption-visualizer/blob/main/vision.py"
click node_image_training "https://github.com/kds1123001/corruption-visualizer/blob/main/vision.py"
click node_tinycnn "https://github.com/kds1123001/corruption-visualizer/blob/main/vision.py"
click node_text_training "https://github.com/kds1123001/corruption-visualizer/blob/main/text"
click node_text_generation "https://github.com/kds1123001/corruption-visualizer/blob/main/text"

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_cli,node_image_runner,node_text_runner,node_user toneBlue
class node_corrupt_step toneAmber
class node_shape_data,node_image_training,node_tinycnn toneMint
class node_text_training,node_text_generation toneRose
class node_image_result,node_text_result toneIndigo
```

## Components

### Run orchestration

- [CLI workflow](https://github.com/kds1123001/corruption-visualizer/blob/main/glitcher.py): `glitcher.py`
- [Image runner](https://github.com/kds1123001/corruption-visualizer/blob/main/glitcher.py): `glitcher.py`
- [Text runner](https://github.com/kds1123001/corruption-visualizer/blob/main/glitcher.py): `glitcher.py`

### Weight corruption

- [Corruption step](https://github.com/kds1123001/corruption-visualizer/blob/main/corrupt.py): `corrupt.py`

### Image target

- [Shape generation](https://github.com/kds1123001/corruption-visualizer/blob/main/vision.py): `vision.py`
- [CNN training](https://github.com/kds1123001/corruption-visualizer/blob/main/vision.py): `vision.py`
- [TinyCNN inference](https://github.com/kds1123001/corruption-visualizer/blob/main/vision.py): `vision.py`

### Text target

- [Character-LSTM training](https://github.com/kds1123001/corruption-visualizer/blob/main/text): `text`
- [Text generation](https://github.com/kds1123001/corruption-visualizer/blob/main/text): `text`

### Other components

- **User**
- **Image probabilities**
- **Generated text**

## Connections

- User → CLI workflow: selects mode (evidence: `README.md`)
- CLI workflow → Image runner: dispatches image (evidence: `glitcher.py`)
- CLI workflow → Text runner: dispatches text (evidence: `glitcher.py`)
- Image runner → CNN training: trains model (evidence: `glitcher.py`)
- Image runner → Shape generation: creates test shape (evidence: `glitcher.py`)
- CNN training → Shape generation: builds batches (evidence: `vision.py`)
- CNN training → TinyCNN inference: trains (evidence: `vision.py`)
- Image runner → Corruption step: corrupts weights (evidence: `glitcher.py`)
- Text runner → Character-LSTM training: trains model (evidence: `glitcher.py`)
- Text runner → Corruption step: corrupts weights (evidence: `glitcher.py`)
- Text runner → Text generation: generates output (evidence: `glitcher.py`)
- Corruption step → TinyCNN inference: mutates parameters (evidence: `corrupt.py`)
- Corruption step → Character-LSTM training: mutates parameters (evidence: `corrupt.py`)
- Image runner → TinyCNN inference: runs inference (evidence: `glitcher.py`)
- Image runner → Image probabilities: renders probabilities (evidence: `glitcher.py`)
- Text runner → Generated text: prints output (evidence: `glitcher.py`)
