# unsignedchad/qwen4-freetoken-mtp architecture

> Architecture diagram of the GitHub repository unsignedchad/qwen4-freetoken-mtp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unsignedchad/qwen4-freetoken-mtp
- Repository: https://github.com/unsignedchad/qwen4-freetoken-mtp

## Overview

This repository packages launch profiles for Qwen4 inference with FreeToken and llama.cpp, plus reproducible replay and benchmark material. The principal workflow is to start one configured server, send requests with the replay client, and inspect measured results. The README also documents distinct MTP, DFlash2, context, and fused/offload profiles. Source excerpts were unavailable, so relationships below are limited to those stated in the README; launcher internals and patch behavior are not inferred.

Main entry points: [`runtime/serve-linux.sh`](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/serve-linux.sh) (Linux launcher), [`runtime/README.md`](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/README.md) (Runtime setup), [`benchmarks/replay.py`](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/replay.py) (Request replay), [`benchmarks/dflash2-results.json`](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/dflash2-results.json) (DFlash2 results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime profiles"]
  node_launcher["Linux launcher<br/>[serve-linux.sh]"]
  node_setup["Runtime setup<br/>[README.md]"]
  node_checksums["Model checksums<br/>[model-files.sha256]"]
end

subgraph group_port["Qwen4 port"]
  node_freetoken["FreeToken Qwen4 patch"]
  node_dflashpatch["DFlash2 patch"]
end

subgraph group_bench["Benchmark execution"]
  node_replay["Request replay<br/>[replay.py]"]
  node_dflashmethods["DFlash2 methods<br/>[DFLASH2.md]"]
end

subgraph group_results["Measurements"]
  node_observations["Replay observations<br/>[observations.json]"]
  node_dflashresults["DFlash2 results"]
  node_publicresults["Public benchmark"]
  node_figure["Comparison graphics"]
  node_figurebasic["Initial MTP graphic<br/>[generate_figure.py]"]
end

node_user(("Operator"))
node_server["Inference server"]

node_user -->|"starts profile"| node_launcher
node_user -->|"runs replay"| node_replay
node_launcher -->|"starts server"| node_server
node_replay -->|"sends requests"| node_server
node_setup -->|"documents launch"| node_launcher
node_setup -->|"checks files"| node_checksums
node_observations -->|"provides records"| node_figure
node_dflashresults -->|"provides records"| node_figure
node_publicresults -->|"provides measurements"| node_figurebasic
node_dflashmethods -->|"describes methods"| node_dflashresults

click node_launcher "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/serve-linux.sh"
click node_setup "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/README.md"
click node_checksums "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/model-files.sha256"
click node_freetoken "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/port/freetoken-qwen4-public.patch"
click node_dflashpatch "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/port/freetoken-qwen4-dflash2.patch"
click node_replay "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/replay.py"
click node_dflashmethods "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/DFLASH2.md"
click node_observations "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/observations.json"
click node_dflashresults "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/dflash2-results.json"
click node_publicresults "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/public-benchmark.json"
click node_figure "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/generate_all_methods_figure.py"
click node_figurebasic "https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/generate_figure.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_launcher,node_setup,node_checksums toneBlue
class node_freetoken,node_dflashpatch toneAmber
class node_replay,node_dflashmethods,node_server toneMint
class node_observations,node_dflashresults,node_publicresults,node_figure,node_figurebasic toneRose
class node_user toneIndigo
```

## Components

### Runtime profiles

- [Linux launcher](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/serve-linux.sh): `runtime/serve-linux.sh`
- [Runtime setup](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/README.md): `runtime/README.md`
- [Model checksums](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/runtime/model-files.sha256): `runtime/model-files.sha256`

### Qwen4 port

- [FreeToken Qwen4 patch](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/port/freetoken-qwen4-public.patch): `port/freetoken-qwen4-public.patch`
- [DFlash2 patch](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/port/freetoken-qwen4-dflash2.patch): `port/freetoken-qwen4-dflash2.patch`

### Benchmark execution

- [Request replay](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/replay.py): `benchmarks/replay.py`
- [DFlash2 methods](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/DFLASH2.md): `benchmarks/DFLASH2.md`

### Measurements

- [Replay observations](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/observations.json): `benchmarks/observations.json`
- [DFlash2 results](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/dflash2-results.json): `benchmarks/dflash2-results.json`
- [Public benchmark](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/public-benchmark.json): `benchmarks/public-benchmark.json`
- [Comparison graphics](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/generate_all_methods_figure.py): `benchmarks/generate_all_methods_figure.py`
- [Initial MTP graphic](https://github.com/unsignedchad/qwen4-freetoken-mtp/blob/main/benchmarks/generate_figure.py): `benchmarks/generate_figure.py`

### Other components

- **Operator**
- **Inference server**

## Connections

- Operator → Linux launcher: starts profile (evidence: `README.md`)
- Operator → Request replay: runs replay (evidence: `README.md`)
- Linux launcher → Inference server: starts server (evidence: `README.md`)
- Request replay → Inference server: sends requests (evidence: `README.md`)
- Runtime setup → Linux launcher: documents launch (evidence: `README.md`)
- Runtime setup → Model checksums: checks files (evidence: `README.md`)
- Replay observations → Comparison graphics: provides records (evidence: `README.md`)
- DFlash2 results → Comparison graphics: provides records (evidence: `README.md`)
- Public benchmark → Initial MTP graphic: provides measurements (evidence: `README.md`)
- DFlash2 methods → DFlash2 results: describes methods (evidence: `README.md`)
