# jaryp/adaptivesemantictokencommunication architecture

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

- Interactive diagram: https://gitdiagram.com/jaryp/adaptivesemantictokencommunication
- Repository: https://github.com/jaryp/adaptivesemantictokencommunication

## Overview

This repository implements research experiments for adaptive semantic-token communication and edge inference. The primary workflow configures and trains or loads a vision model, evaluates it, and can insert a JSCC encoder/channel/decoder path before communication evaluation. A separate optimization entry point analyzes communication results for resource allocation. The graph preserves the adaptive ViT, channel, baseline evaluation, and optimization branches; some config-driven wiring is only documented or referenced in the source index, so uncertain calls are omitted.

Main entry points: [`main.py`](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/main.py) (Train and evaluate), [`main_opt.py`](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/main_opt.py) (Optimize allocation), [`comm/evaluation.py`](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/evaluation.py) (Communication evaluation), [`comm/channel.py`](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/channel.py) (Noisy channel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Experiment entry points"]
  node_train_run["Train and evaluate<br/>[main.py]"]
  node_opt_run["Optimize allocation<br/>[main_opt.py]"]
  node_experiment_configs["Experiment configs"]
end

subgraph group_model["Adaptive inference"]
  node_adaptive_vit["Adaptive ViT<br/>[base.py]"]
  node_token_loss["Token regularization<br/>[loss.py]"]
end

subgraph group_comm["Communication"]
  node_pipeline["JSCC pipeline<br/>[utils.py]"]
  node_channel["Noisy channel<br/>[channel.py]"]
  node_pipeline_build["Pipeline construction<br/>[pipeline.py]"]
end

subgraph group_analysis["Evaluation and optimization"]
  node_semantic_eval["Semantic evaluation<br/>[evaluation.py]"]
  node_flops["Compute cost<br/>[flops_count.py]"]
  node_baseline_eval["Baseline evaluation<br/>[base.py]"]
  node_comm_eval["Communication evaluation<br/>[evaluation.py]"]
end

subgraph group_support["Runtime support"]
  node_saving["Run naming and serialization<br/>[serialization.py]"]
  node_training_helpers["Training helpers<br/>[utils.py]"]
end

node_experimenter(("Experimenter"))
node_model_provider["Vision model provider"]

node_experimenter -->|"runs"| node_train_run
node_experimenter -->|"runs"| node_opt_run
node_experiment_configs -->|"configures"| node_train_run
node_experiment_configs -->|"configures"| node_opt_run
node_train_run -->|"uses"| node_adaptive_vit
node_train_run -->|"constructs"| node_pipeline
node_train_run -->|"uses"| node_channel
node_train_run -->|"runs"| node_comm_eval
node_train_run -->|"uses"| node_baseline_eval
node_train_run -->|"uses"| node_saving
node_train_run -->|"uses"| node_training_helpers
node_train_run -.->|"wraps"| node_model_provider
node_adaptive_vit -->|"regularized by"| node_token_loss
node_semantic_eval -->|"evaluates"| node_adaptive_vit
node_semantic_eval -->|"measures with"| node_flops
node_baseline_eval -->|"reads symbols"| node_channel
node_comm_eval -->|"inspects"| node_pipeline
node_comm_eval -->|"reads"| node_channel
node_pipeline -->|"transmits through"| node_channel
node_train_run -.->|"uses"| node_pipeline_build
node_opt_run -->|"uses results from"| node_comm_eval
node_opt_run -->|"uses"| node_saving

click node_train_run "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/main.py"
click node_opt_run "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/main_opt.py"
click node_experiment_configs "https://github.com/jaryp/adaptivesemantictokencommunication/tree/master/configs"
click node_adaptive_vit "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/proposal/base.py"
click node_token_loss "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/proposal/loss.py"
click node_semantic_eval "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/proposal/evaluation.py"
click node_flops "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/flops_count.py"
click node_baseline_eval "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/base.py"
click node_comm_eval "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/evaluation.py"
click node_pipeline "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/utils.py"
click node_channel "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/channel.py"
click node_pipeline_build "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/pipeline.py"
click node_saving "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/serialization.py"
click node_training_helpers "https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/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_train_run,node_opt_run,node_experiment_configs toneBlue
class node_adaptive_vit,node_token_loss toneAmber
class node_pipeline,node_channel,node_pipeline_build toneMint
class node_semantic_eval,node_flops,node_baseline_eval,node_comm_eval toneRose
class node_saving,node_training_helpers,node_experimenter,node_model_provider toneIndigo
```

## Components

### Experiment entry points

- [Train and evaluate](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/main.py): `main.py`
- [Optimize allocation](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/main_opt.py): `main_opt.py`
- [Experiment configs](https://github.com/jaryp/adaptivesemantictokencommunication/tree/master/configs): `configs`

### Adaptive inference

- [Adaptive ViT](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/proposal/base.py): `methods/proposal/base.py`
- [Token regularization](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/proposal/loss.py): `methods/proposal/loss.py`

### Communication

- [JSCC pipeline](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/utils.py): `utils.py`
- [Noisy channel](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/channel.py): `comm/channel.py`
- [Pipeline construction](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/pipeline.py): `comm/pipeline.py`

### Evaluation and optimization

- [Semantic evaluation](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/proposal/evaluation.py): `methods/proposal/evaluation.py`
- [Compute cost](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/flops_count.py): `methods/flops_count.py`
- [Baseline evaluation](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/methods/base.py): `methods/base.py`
- [Communication evaluation](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/comm/evaluation.py): `comm/evaluation.py`

### Runtime support

- [Run naming and serialization](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/serialization.py): `serialization.py`
- [Training helpers](https://github.com/jaryp/adaptivesemantictokencommunication/blob/master/utils.py): `utils.py`

### Other components

- **Experimenter**
- **Vision model provider**

## Connections

- Experimenter → Train and evaluate: runs (evidence: `README.md`)
- Experimenter → Optimize allocation: runs (evidence: `README.md`)
- Experiment configs → Train and evaluate: configures (evidence: `main.py`)
- Experiment configs → Optimize allocation: configures (evidence: `main_opt.py`)
- Train and evaluate → Adaptive ViT: uses (evidence: `main.py`)
- Train and evaluate → JSCC pipeline: constructs (evidence: `main.py`)
- Train and evaluate → Noisy channel: uses (evidence: `main.py`)
- Train and evaluate → Communication evaluation: runs (evidence: `main.py`)
- Train and evaluate → Baseline evaluation: uses (evidence: `main.py`)
- Train and evaluate → Run naming and serialization: uses (evidence: `main.py`)
- Train and evaluate → Training helpers: uses (evidence: `main.py`)
- Train and evaluate → Vision model provider: wraps (evidence: `README.md`)
- Adaptive ViT → Token regularization: regularized by (evidence: `methods/proposal/__init__.py`)
- Semantic evaluation → Adaptive ViT: evaluates (evidence: `methods/proposal/evaluation.py`)
- Semantic evaluation → Compute cost: measures with (evidence: `methods/proposal/evaluation.py`)
- Baseline evaluation → Noisy channel: reads symbols (evidence: `methods/base.py`)
- Communication evaluation → JSCC pipeline: inspects (evidence: `comm/evaluation.py`)
- Communication evaluation → Noisy channel: reads (evidence: `comm/evaluation.py`)
- JSCC pipeline → Noisy channel: transmits through (evidence: `utils.py`)
- Train and evaluate → Pipeline construction: uses
- Optimize allocation → Communication evaluation: uses results from (evidence: `main_opt.py`)
- Optimize allocation → Run naming and serialization: uses (evidence: `main_opt.py`)
