Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
docs: a short README for regular people; the details move to INSTALL, MODELS, TROUBLESHOOTING, HOW_IT_WORKS
Niko1221f9384124993e
diff --git a/.github/FUNDING.yml b/.github/FUNDING.ymlnew file mode 100644index 000000000..35b26a9a0--- /dev/null+++ b/.github/FUNDING.yml@@ -0,0 +1 @@+buy_me_a_coffee: strataenginediff --git a/AGENTS.md b/AGENTS.mdnew file mode 100644index 000000000..3bcf107ae--- /dev/null+++ b/AGENTS.md@@ -0,0 +1,23 @@+# AGENTS.md++Strata runs the Qwen3.8-Flash-Next mixture-of-experts model (and its Coder, Swift 1.5 and Unsloth variants) on a+normal PC: one NVIDIA or AMD graphics card plus system RAM, on Windows or Linux. It has a C++/CUDA/HIP engine+(`src/`, `include/`), a Python server with an OpenAI- and Anthropic-compatible API and a web app (`serve/`), and a+one-click installer (`setup.py`, started by `START-HERE.bat` / `setup.sh`).++## Installing Strata for a user++Follow **[docs/AI_SETUP.md](docs/AI_SETUP.md)**: check the PC, pick the model by RAM, run setup non-interactively,+start and verify the server, and connect the user's apps. Never expose the server beyond `127.0.0.1` without+`--api-key`. As an alternative to shell commands, Strata's MCP server ([docs/MCP_SERVER.md](docs/MCP_SERVER.md))+offers the same steps as tools.++## Working on the code++- How the engine works, every measured number, the API and all settings: [docs/DETAILS.md](docs/DETAILS.md) and+ the [paper](docs/paper/Strata-Paper.pdf).+- AMD (HIP) build and validation: [docs/AMD_HIP.md](docs/AMD_HIP.md); multi-GPU: [docs/MULTI_GPU.md](docs/MULTI_GPU.md).+- Setup's own tests run without a GPU or downloads: `python tools/test_setup_<name>.py` (for example+ `tools/test_setup_amd.py`, `tools/test_setup_choices.py`).+- Keep the docs' style: plain words, measured numbers with what they were measured on, no claims without a+ measurement.diff --git a/README.md b/README.mdindex 55bdbebbc..fd2994df3 100644--- a/README.md+++ b/README.md@@ -1,279 +1,182 @@<h1 align="center">Strata</h1>-<p align="center"><b>Run a 125-billion-parameter AI model on a normal gaming PC</b><br>-one NVIDIA card (12-24 GB) + 64 GB of RAM · Windows or Linux · one click to install</p>+<p align="center"><b>Run a 125-billion-parameter AI model on your own gaming PC</b><br>+NVIDIA or AMD graphics card (12 GB or more) · Windows or Linux · free and open source</p><p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br><sub>A voxel pagoda garden, 1 shot prompt running on an RTX 5070 with Strata (IQ3_S, 128K context) ·<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">full video (49 s)</a></sub></p>Strata runs **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)** - a large, smart AI model that-normally needs a server - on your own PC. It writes its answers at **60-95 tokens per second** (a token is about ¾-of a word): faster than you can read.+normally needs a server - on a normal PC. It chats, writes code, reads pictures and works with your apps and coding+agents, and nothing leaves your PC.-- **Free and open source.**--> **Jump to:** [How fast?](#how-fast-is-it) · [Which model?](#which-model-should-i-pick) · [Install](#install) ·-> [Using it](#using-it) · [Problems?](#something-went-wrong) · [How it works](#how-does-it-work) ·-> [All the details](docs/DETAILS.md)+## How fast is it?----+Measured on two ordinary gaming PCs. "Writes answers" is how fast the reply appears in a short chat; "reads your+prompt" is how fast it takes in what you send (a 32K-token document, code or chat history). A token is about ¾ of a+word, so 60 tokens per second is faster than you can read.-## How fast is it?+<table>+<tr><th>NVIDIA: RTX 5070 (12 GB), Ryzen 5 7600, 64 GB RAM</th><th>AMD: RX 9070 XT (16 GB), Ryzen 9 3900X, 47 GB RAM</th></tr>+<tr><td>-Measured on an RTX 5070 (12 GB), a Ryzen 5 7600 and 64 GB of RAM:+| Size | Writes answers | Reads your prompt |+| --- | ---: | ---: |+| **Q2_0** | 93 tokens/s | 2,170 tokens/s |+| **IQ2_XS** | 79 tokens/s | 2,090 tokens/s |+| **IQ3_XXS** | 62 tokens/s | 1,750 tokens/s |+| **IQ3_S** | 53 tokens/s | 1,620 tokens/s |+| **Coder** | 55 tokens/s | 2,180 tokens/s |-| Size | Writes answers (short chat) | Writes answers (128K context) | Reads your prompt |-| --- | ---: | ---: | ---: |-| **Q2_0** | 93 tokens/s | 74 tokens/s | 2,170 tokens/s |-| **IQ2_XS** | 79 tokens/s | 63 tokens/s | 2,090 tokens/s |-| **IQ3_XXS** | 62 tokens/s | 49 tokens/s | 1,750 tokens/s |-| **IQ3_S** | 53 tokens/s | 46 tokens/s | 1,620 tokens/s |-| **Coder** (IQ1_M) | 55 tokens/s | 43 tokens/s | 2,180 tokens/s |+</td><td>-- **Writes answers** = how fast the reply appears (tokens per second).-- **Reads your prompt** = how fast it takes in what you send (long documents, code, chat history), measured on a- 32K-token prompt; a 4K prompt reads at 910-1,580 tokens/s. A 32K prompt takes about 15 seconds with Q2_0.+| Size | Writes answers | Reads your prompt |+| --- | ---: | ---: |+| **Q2_0** | TODO-AMD | TODO-AMD |+| **IQ2_XS** | TODO-AMD | TODO-AMD |+| **Coder** | TODO-AMD | TODO-AMD |-A card with more VRAM is faster, because more of the model fits on the GPU: an RTX 3090 (24 GB) should do roughly-100-140 tokens per second. All measurements, long-context numbers and estimates for other cards are in the-[details](docs/DETAILS.md#speed-measured).+</td></tr>+</table>-Every PC is different: `START-HERE.bat --calibrate` measures a few engine settings on yours and keeps the fastest-(about 5-10 minutes; on the PC above it made the Coder 7% faster).+A card with more VRAM is faster: an RTX 3090 (24 GB) should write roughly 100-140 tokens per second. Long chats,+other cards: [speed of each model](docs/MODELS.md#how-fast-is-each-size), [community results](docs/COMMUNITY_BENCHMARKS.md).-Measured Strata on your own PC? See [Community benchmark results](docs/COMMUNITY_BENCHMARKS.md)-for a report template and how to share your results in a pull request.+<p align="center"><a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a><br>+<sub>Strata is free. If it runs well on your PC, a coffee keeps the work on it going.</sub></p>-**Two or three NVIDIA cards?** Just run `START-HERE.bat`: it lists your cards, says which ones Strata can use, and-asks whether to share the model across them (recommended when two can). An install made on one card asks once at-its next start. Or choose yourself: `START-HERE.bat --gpus 0,2` (both, remembered), `--gpus all`, or `--gpu 0` (one-card, this start only). Each card keeps the experts of its own layers, and prompts flow through the cards in a-pipeline: on an RTX 5080 + RTX 3090 prompts were read 18-20% faster than on the 5080 alone, decoding on par.-Every card must be an RTX 20 series or newer with 8 GB or more. See [docs/MULTI_GPU.md](docs/MULTI_GPU.md).+## What you need-## Which model should I pick?+| | |+| --- | --- |+| **Graphics card** | **NVIDIA** GeForce RTX 20, 30, 40 or 50 series, or **AMD** Radeon RX 7900 XT / XTX, RX 7800 XT / 7700 XT, RX 9060 XT, RX 9070 / 9070 XT, Radeon AI PRO R9700 or RX 6800 / 6900 series - with **12 GB of VRAM or more** |+| **RAM** | 32 GB or more - how much decides [which model](#which-model-should-i-pick) fits; 64 GB runs every size |+| **Disk** | about 80 GB free, on an SSD if you can (the first start is much faster) |+| **System** | Windows 10 / 11 or Linux, and a current graphics driver from NVIDIA or AMD |-**The size** (the same model, compressed more or less):--| Model | RAM+VRAM Requirements | Speed | Quality |-| --- | ---: | --- | --- |-| **Q2_0** | 37.6 GB | fastest | good |-| **IQ2_XS** | 39.2 GB | fast | better (**recommended**) |-| **IQ3_XXS** | 47.0 GB | slower | great |-| **IQ3_S** | 54.8 GB | slowest | best: matches the full model on the published tests (original model only) |--**Will it fit?** Shard 1 is the part of the model that gets loaded when it starts: its experts go into your **RAM**,-the rest onto your graphics card (the second shard, a 29 GB lookup table, stays on the SSD). So it fits when your-**RAM is at least shard 1 + about 10 GB** for Windows and your other programs. With 64 GB of RAM every size fits-(IQ3_S with little else open); with 48 GB, Q2_0 and IQ2_XS. A bigger graphics card makes it faster, but it doesn't-lower the RAM needed.--**The version:**--- **Qwen3.8-Flash-Next** - the original.-- **[Coder](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-Coder-GGUF)** - ISTA-DASLab's coding- version: half of the experts removed, keeping the ones that code, tool use and images need (91% of the full model's- SWE-bench Verified score, 99% of LiveCodeBench, by its authors). One size (IQ1_M: its experts stored like IQ3_S):- shard 1 is **29.6 GB**, so it fits a PC with **32 GB of RAM**, runs 262K context on 64 GB, and reads long prompts- the fastest of all. Weaker outside coding.-- **[Swift 1.5](https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF)** - a fine-tune by UkisAI- that thinks much shorter before answering, so you get the answer sooner, with about the same quality. Same speed per- token, and about the same RAM as the same size of the original (no IQ3_S). Its own license applies (see its page).--Not sure? Take **IQ2_XS** - or the **Coder** if you mainly write code, or have 32-48 GB of RAM. You can add another-one later with `SETUP.bat` (the same as `START-HERE.bat --setup`; on Linux `./setup.sh --setup`).--For **OrcaRouter's Flash-Next Uncensored IQ3_XXS**, see the [manual compatibility setup](docs/ORCA.md).-It needs an explicit packing conversion and is not an installer menu option.--**Unsloth's 4-bit UD-Q4_K_XL** (experimental) is the fourth version in setup's menu (`--family unsloth`): the closest-to the full model, but a 111 GB download whose 77 GB of experts do not fit in RAM. Strata keeps your RAM minus 24 GB-of them in RAM and reads the rest from the SSD while it answers: 7-8.5 tokens/s on a 64 GB PC with a 12 GB GPU, several-times slower than the sizes above, and long prompts are slow. It needs 48 GB of RAM or more, an NVMe SSD and one-NVIDIA GPU (no images yet). Details and measurements: [UD-Q4_K_XL](docs/UNSLOTH_Q4.md).--An **AMD Radeon RX 7900 XT / XTX, RX 9070 / 9070 XT or Radeon AI PRO R9700 on Linux** works too (experimental; the-RX 7800 XT / 7700 XT and RX 9060 XT were validated by their owners; the RX 6800 / 6900 series, gfx1030, is community-reported):-`./setup.sh --backend hip`, chosen by itself on a PC with no NVIDIA card Strata can use. It installs ROCm without sudo-and compiles the engine (no images yet; several cards with `--gpus`). Details: [AMD HIP](docs/AMD_HIP.md).+Everything else is installed for you. Two or three cards can share the model ([multi-GPU](docs/MULTI_GPU.md)).+The full list: [docs/INSTALL.md](docs/INSTALL.md#what-you-need).## Install-**You need:** an NVIDIA RTX 20, 30, 40 or 50 card with 12 GB of VRAM or more (RTX 20 since 0.1.27), enough RAM for the size you pick (above;-a big GPU makes up for less RAM - the [low-RAM mode](docs/DETAILS.md)),-~80 GB of free disk space (an SSD makes the first start much faster), and Windows 10/11 or Linux. The only thing you-install yourself is a current **NVIDIA driver** ([nvidia.com/drivers](https://www.nvidia.com/drivers) or the NVIDIA-App). Everything else - Python, the engine, the model - is set up for you.+### Let your AI set it up++Use an AI coding assistant (Claude Code, Cursor, Codex, GitHub Copilot, ...)? Paste this into it:++```text+Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.+```-**Windows**+It checks your graphics card, RAM and disk, picks the model that fits, installs it, starts it and tells you how to+connect your apps. AI tools can also install, start and stop Strata themselves through its+[MCP server](docs/MCP_SERVER.md).-1. [Download this project](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) and unzip it (or `git clone` it).-2. Double-click **`START-HERE.bat`**.-3. Answer a few questions - or just press Enter each time for the recommended choice:- - **Which model and size?** The original or Swift 1.5, and Q2_0, IQ2_XS, IQ3_XXS or IQ3_S - see [above](#which-model-should-i-pick)- - **How much context?** How much text it can keep in mind at once (it suggests one for your card). 384K and- 512K (experimental) extend the model past its trained 262K by rope scaling - the setup turns it on itself (yarn and a- covering factor; `--rope-scaling`/`--rope-scale` override) ([details](docs/DETAILS.md))- - **Images?** Whether it should also read pictures- - **Experimental speed projection?** Off unless you say yes - [read what it does](docs/DETAILS.md#experimental-speed-projection-experimental-off-by-default) first+### Or do it yourself-Then it downloads everything (the model is ~70 GB, so the first time takes a while - you can stop and it picks up-where it left off) and **starts the model**. Your browser opens the Strata app at `http://127.0.0.1:8080`.+[Download Strata](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) and unzip it (or `git clone` it).+**Windows:** double-click **`START-HERE.bat`**. **Linux:** run **`./setup.sh`** in the Strata folder.++The same steps for NVIDIA and AMD: the installer finds your card and sets up the right engine for it. It asks which+model, which size, how much context (how much text it keeps in mind) and whether it should read pictures - press+Enter each time for the recommended answer. Then it downloads the model (~70 GB; you can stop and it continues where+it left off) and starts it. Your browser opens the Strata app at `http://127.0.0.1:8080`.> **While the model starts, your PC can be slow or stop responding for 1-3 minutes** (longest the first time): Strata> loads 35-55 GB into your RAM and locks part of it for the graphics card. That's normal - wait, and don't close the> window. The window tells you what it is doing.-**Next time**, just double-click `START-HERE.bat` again: it starts right away, nothing is downloaded twice. Close its-window to stop the model.--**Updating:** download the new version and unzip it anywhere (or `git pull`), then run `START-HERE.bat` in it. The-model files are kept in a `Strata-data` folder next to your Strata folder, so a new copy finds them and sets itself up-the same way - nothing big is downloaded again.--**Linux:** run `./setup.sh` - same questions, same result.--**Docker (Linux):** the same idea, in a container.--1. Host: Docker with the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)- and a driver **580 or newer** (CUDA 13.0).-2. Build (this compiles the engine into the image, so the container never compiles):- `docker build -t strata .`- `docker build -t strata --build-arg CUDA_ARCHITECTURES=89 .` builds for one card only (faster).- The default covers RTX 30 (86), RTX 40 (89), RTX 50 (120) and A-series (80); a card outside that- set needs a rebuild with its own arch. Add `--build-arg BUILD_VISION=0` to skip the image encoder.-3. Run (the first start downloads the ~70 GB model, then starts; later starts go straight to serving):- `docker run --rm --gpus all -p 8080:8080 --ulimit memlock=-1 -v strata-data:/data strata`-- The setup choices are env vars: `-e MODEL=IQ2_XS -e FAMILY=qwen -e CONTEXT=32768 -e VISION=no`- (or `MODEL=Q2_0|IQ3_XXS|IQ3_S`, `FAMILY=swift|coder`; the defaults above are the recommended ones).- `-e VISION=cpu` keeps the image encoder on the CPU. `-e KV=int8|q4_0|k8v4` picks the KV cache- precision; `k8v4` is INT8 K with 4-bit V and keeps its KV in VRAM from 64K up.- Only the model files, the prepared pack, the MTP layer and the install config live in the- `strata-data` volume; the engine is part of the image. Switching between models already on the- volume needs no setup pass: `-e MODEL=Q2_0 -e FAMILY=coder` picks that model's config. Add- `-e REINSTALL=1` only to change settings for a model already set up (context, vision, KV, host,- api_key, LOW_RAM), since those are recorded in its config.- Strata loads 32-62 GB into RAM. `--gpus all` on a host with two usable cards takes both: the- layer split is setup's recommended default ([docs/MULTI_GPU.md](docs/MULTI_GPU.md)), and a volume- set up for one card switches to the pair on its first start there. Pin one card with `-e GPU=0`,- or name them with `-e GPUS=0,2` and where the later card's layers start with `-e LAYER_SPLIT=18`.- A memory limit needs `-e LOW_RAM=on`, which maps the model's experts from the pack instead of- keeping them in RAM: setup.py measures the host's RAM, not the container's limit, so it cannot- see a cap. LOW_RAM runs on one card.- The server listens on `0.0.0.0:8080` by default; set `-e API_KEY=<secret>` before exposing the port- to a network. The image has a `HEALTHCHECK` on `/health`, so `docker ps` shows the container- healthy once the model is loaded, and `GET /v1/status` says what it is running.+**Next time**, run `START-HERE.bat` (or `./setup.sh`) again: it starts right away, nothing is downloaded twice. Close+its window to stop the model. Updating, Docker, several cards, where the files go and every option:+[docs/INSTALL.md](docs/INSTALL.md).-## Using it+## Which model should I pick?-<p align="center"><img src="docs/media/runpagoda.png" width="900" alt="The Strata app's Monitor tab next to a coding agent"><br>-<sub>The Strata app's <b>Monitor</b> (left) while a coding agent writes the pagoda garden from the video (right)</sub></p>+The installer recommends one for your RAM. The same model comes in sizes that are compressed more or less: smaller+is faster, larger is a bit smarter.-- **In the browser:** `http://127.0.0.1:8080` - the Strata app (it opens by itself when the model starts): **Chat**, a- live **Monitor** of the model and your GPU/CPU/RAM, and **About** with the settings and addresses.-- **Chat in the terminal:** `.venv\Scripts\python chat.py`-- **Your apps and coding agents:** add it as an "OpenAI-compatible" provider with base URL- **`http://127.0.0.1:8080/v1`**, any API key and any model name. Apps that use Anthropic's API: `http://127.0.0.1:8080/v1/messages`.-- **Thinking:** the model thinks before it answers. Choose **off, low, medium or high** - in the chat page menu, with- `/think low` in `chat.py`, or with your app's "reasoning effort" setting. Off is fastest; high is best for hard questions.-- **Pictures:** in the chat page click **Picture**; in `chat.py` type `/image <path>`; in apps just attach them.-- **From your phone or another PC:** `START-HERE.bat --setup --host 0.0.0.0 --api-key <secret>`, then open the- address the server window prints; see the [details](docs/DETAILS.md#using-it).-- **Experimental speed projection (off by default):** an experimental control vector that setup can turn on; it- changes how the model answers - read [what it does](docs/DETAILS.md#experimental-speed-projection-experimental-off-by-default) first.--**Good to know:** it answers one request at a time. The first message of a chat is read in full (about 1 minute per-30,000 tokens); after that it keeps the conversation and reads only what is new, so follow-ups start in seconds.--### Where things are stored--- **Your chats: only in your browser.** The Chat tab keeps the conversation, its settings and the API key you typed- in the browser's local storage (`strata.*` keys) - not on the server and not in the Strata folder. Pictures are not- kept, only their names. Another browser or a private window starts empty; clearing the site's data deletes them.-- **How the model starts:** `strata-<model>.json` in the Strata folder (context, GPUs, host, API key, ...), written- by setup; next to it `run-<model>.bat` / `.sh`, the log `strata-<model>.log` and, when you use "Use for other- apps too", `strata-<model>.shared-settings.json`.-- **The model files** (`models/`, `packs/`, `mtp/`, 70-120 GB): in **`Strata-data` next to the Strata folder**, or- wherever `--data-dir` put them.-- **Where that data folder is:** `%APPDATA%\Strata\settings.json` on Windows, `~/.config/strata/settings.json` on- Linux ([details](docs/DETAILS.md)).+| Your RAM | Take | Why |+| --- | --- | --- |+| **32 GB** | **Coder** | it fits 32 GB, and it is made for code (with a 24 GB card, Q2_0 and IQ2_XS run too) |+| **48 GB** | **IQ2_XS** (or Q2_0, the fastest) | the larger sizes do not fit |+| **64 GB** | **IQ2_XS** (recommended), or IQ3_XXS / IQ3_S | every size fits; IQ3_S is the best, and the slowest |+| **96 GB or more** | **IQ3_S**, or Unsloth's 4-bit (experimental) | room for the largest sizes with everything else open |-## Something went wrong?+- **[Coder](docs/MODELS.md#coder)** - a coding version with half of the experts removed: 91% of the full model's+ SWE-bench Verified score (by its authors), fits 32 GB of RAM. Weaker outside coding.+- **[Swift 1.5](docs/MODELS.md#swift-15)** - a fine-tune that thinks much shorter before it answers, so you get the+ answer sooner, at about the same quality.+- **[Unsloth UD-Q4_K_XL](docs/MODELS.md#unsloth-ud-q4_k_xl-experimental)** (experimental) - the closest to the full+ model, but most of it is read from the SSD while it answers: 7-8.5 tokens/s on a 64 GB PC.+- **[OrcaRouter's Uncensored IQ3_XXS](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** - a manual setup, not in the+ installer's menu.-**My PC froze, or got very slow, the first time Strata started.**-That's normal while it starts, most of all the first time. Strata loads 35-55 GB into your RAM, locks part of it for-the graphics card, and works out how much of the model fits on your GPU. The mouse can freeze for a few minutes. **Wait, and don't close the-window.** The next starts are much faster. Still frozen after 10 minutes? Restart the PC, close other programs-(browsers use a lot of RAM) and try again. If it keeps happening, pick a smaller size (Q2_0 or IQ2_XS).+Sizes, downloads and what fits where: [docs/MODELS.md](docs/MODELS.md). You can add another model later with+`SETUP.bat` (Linux: `./setup.sh --setup`).-**It stopped while downloading or installing.**-Run `START-HERE.bat` again. It continues where it stopped.+## Using it-**It says the NVIDIA driver is too old.**-Update it (NVIDIA App or [nvidia.com/drivers](https://www.nvidia.com/drivers)), restart the PC, and run-`START-HERE.bat` again.+<p align="center"><img src="docs/media/runpagoda.png" width="900" alt="The Strata app's Monitor tab next to a coding agent"><br>+<sub>The Strata app's <b>Monitor</b> (left) while a coding agent writes the pagoda garden from the video (right)</sub></p>-**It says port 8080 is already in use.**-Strata is already running. Look for its window.+- **In the browser:** `http://127.0.0.1:8080` - **Chat**, a live **Monitor** of the model and your GPU/CPU/RAM, and+ **About** with the settings and addresses.+- **Your apps and coding agents:** add an "OpenAI-compatible" provider with base URL **`http://127.0.0.1:8080/v1`**,+ any API key and any model name. Apps that use Anthropic's API: `http://127.0.0.1:8080/v1/messages` (Claude Code:+ `ANTHROPIC_BASE_URL=http://127.0.0.1:8080`).+- **Thinking:** choose **off, low, medium or high** in the chat menu or your app's "reasoning effort". Off is+ fastest; high is best for hard questions.+- **Pictures:** say yes to "Images?" in setup, then click **Picture** in the chat, or attach them in your app.+- **From your phone or another PC:** `START-HERE.bat --setup --host 0.0.0.0 --api-key <secret>` - always with a key.+- **Good to know:** it answers one request at a time. The first message of a chat is read in full (about 1 minute+ per 30,000 tokens); follow-ups start in seconds.-**It's very slow and the disk light keeps blinking.**-Your PC is out of free RAM. Close other programs, or pick a smaller size (Q2_0 or IQ2_XS).+More: [where your chats are stored](docs/INSTALL.md#where-things-are-stored), [the API](docs/DETAILS.md#using-it).-**An answer stopped with "the engine stopped unexpectedly".**-Usually not enough RAM (on Linux the system then stops the engine). Just send your message again: Strata starts the-engine by itself. If it keeps happening, close other programs or pick a smaller size.+## Something went wrong?-**It says the prompt exceeds the context.**-The conversation is longer than the context you chose. Start a new chat, or run `SETUP.bat` and pick more-context.+- **My PC froze the first time Strata started.** Normal while it loads the model: wait, don't close the window.+ Still frozen after 10 minutes? Restart the PC, close other programs and try again, or pick a smaller size.+- **It stopped while downloading or installing.** Run `START-HERE.bat` (or `./setup.sh`) again: it continues where+ it stopped.+- **It's very slow and the disk light keeps blinking, or "the engine stopped unexpectedly".** Not enough free RAM:+ close other programs (browsers use a lot), or pick a smaller size (Q2_0 or IQ2_XS).+- **It says port 8080 is already in use.** Strata is already running - look for its window.-**Still stuck?** Look in the [full troubleshooting table](docs/DETAILS.md#troubleshooting), or open an issue and-attach `strata-<model>.log` from the Strata folder.+More problems and their fixes: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md). Still stuck? Open an+[issue](https://github.com/Niko1221/Strata/issues) and attach `strata-<model>.log` from the Strata folder.## How does it work?Models like this one normally run on servers with hundreds of gigabytes of graphics memory. Your graphics card has-12-24 GB. Strata makes it fit by **sharing the work across your whole PC** - the same idea as a kitchen, where the-things you use all the time stay on the counter and the rest waits in the pantry.+12-24 GB. Strata makes it fit by **sharing the work across your whole PC** - like a kitchen, where the things you use+all the time stay on the counter and the rest waits in the pantry.<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>-- **The model is a team of 24,576 small specialists ("experts"),** and each word it writes needs only 10 of them.- So it doesn't have to have all of them on the graphics card at once.-- **Your graphics card** does the part of the work needed for every word, and keeps the few thousand experts that- are asked most often. It keeps learning which ones those are while you use it.-- **Your RAM** holds every expert. When a word needs one the card doesn't have, **your processor** works on it -- at the same time as the graphics card, so neither waits for the other.-- **Your SSD** holds a big lookup table; the model only reads a few small rows of it per word.+- **The model is a team of 24,576 small specialists ("experts"),** and each word needs only 10 of them.+- **Your graphics card** keeps the few thousand experts that are asked most often; **your RAM** holds all of them,+ and **your processor** works on the rest at the same time. **Your SSD** holds a big lookup table.<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>-- **Guess, then check.** A small, fast helper built into the model guesses the next few words, and the big model- checks all the guesses in one go. It keeps the ones it agrees with and writes the next word itself - so one step- often produces several words. The helper only guesses - the big model decides every word - so you get the same- quality answer, 1.6-1.8x sooner.-- **Long texts are read in big pieces** (up to 8,192 tokens - pieces of words - at a time), which is why a long- document or code base is read at over 1,000 tokens per second.--Want the full picture? The [details](docs/DETAILS.md#how-it-works) explain every part and its numbers, and the-[paper](docs/paper/Strata-Paper.pdf) tells the whole story, with the measurements behind it.--## Credits--- Model: [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) by the Qwen team; compressed versions by- [ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF);- [Swift 1.5](https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF) by UkisAI; the experimental- [UD-Q4_K_XL](https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF) by Unsloth (its support follows- [eddoursul/Strata](https://github.com/eddoursul/Strata)). Their licenses apply to the model files.-- Built with parts of [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp) (MIT). Ideas from- [Splash](https://github.com/incoai/splash), [ninfer](https://github.com/Neroued/ninfer) and- [HyperQwen](https://github.com/syv-ai/HyperQwen). More in the [details](docs/DETAILS.md#credits-and-licenses).--## License--Strata is open source under the [MIT License](LICENSE). A few parts carry their own licenses: `third_party/ggml`-(MIT, llama.cpp / ggml), the web app's font (SIL Open Font License 1.1) and the experimental speed projection's-vector in `data/experimental-speed-projection` (Qwen Community License 1.0, from the model's activations). The-models are not part of this repository; each model's own license applies to its files.+- **Guess, then check:** a small helper guesses the next few words and the big model checks them all at once, so+ you get the same answer, 1.6-1.8x sooner.+- **Long texts are read in big pieces** (up to 8,192 tokens at a time): over 1,000 tokens per second.++The longer explanation: [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md). Every part and its numbers: [the+details](docs/DETAILS.md#how-it-works) and the [paper](docs/paper/Strata-Paper.pdf).++## Credits and license++The model is [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) by the Qwen team, compressed by+[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF), UkisAI (Swift 1.5) and Unsloth;+Strata is built with parts of [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp). All credits:+[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits). Strata is open source under the [MIT License](LICENSE); a few+parts and every model carry their own licenses ([which ones](docs/HOW_IT_WORKS.md#license)).++## Support Strata++Strata is free and open source. If it is useful to you, you can support its development:++<p align="center"><a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a></p>diff --git a/docs/AI_SETUP.md b/docs/AI_SETUP.mdnew file mode 100644index 000000000..7a5624f44--- /dev/null+++ b/docs/AI_SETUP.md@@ -0,0 +1,192 @@+# Installing Strata for a user (instructions for AI agents)++This page is written for an AI coding assistant (Claude Code, Cursor, Codex, GitHub Copilot, ...) that a user asked to+set up Strata on their PC. Strata runs the Qwen3.8-Flash-Next model locally on one NVIDIA or AMD graphics card plus+system RAM, and serves an OpenAI- and Anthropic-compatible API on `http://127.0.0.1:8080`. The human-oriented+version of everything below is [INSTALL.md](INSTALL.md).++Work through the steps in order. Tell the user what you are doing in plain words; they may not be technical.++## 0. Ground rules++- **Never expose the server without an API key.** Keep the default `--host 127.0.0.1`. Only if the user asks for+ access from other devices, use `--host 0.0.0.0` **together with** `--api-key <a long random secret>`, and give the+ user the key. Never put a tunnel or port forward in front of a server without a key.+- Do not change the user's system beyond what setup does (setup installs Python for the user account if needed,+ and everything else inside the Strata folder and its `Strata-data` folder). Ask before installing drivers.+- The model download is ~70 GB (up to 111 GB for Unsloth's 4-bit). Confirm the user is fine with that before you+ start, especially on a metered connection.+- Setup is long-running (an hour or more on a slow connection). Run it in the background or with a long timeout and+ poll its output; do not kill it because it is quiet for a while. It is resumable: running the same command again+ continues where it stopped.++## 1. Check the PC++The quickest way is setup's own check, which prints the GPU(s), driver, RAM, CPU, free disk and whether this PC can run+Strata, and installs nothing except Python and the `.venv` it needs to run (step 2 gets the repository first):++```+Windows: START-HERE.bat --check+Linux: ./setup.sh --check+```++To check by hand:++| What | Windows (PowerShell) | Linux |+| --- | --- | --- |+| OS | `[Environment]::OSVersion` | `cat /etc/os-release` |+| NVIDIA GPU, VRAM, driver | `nvidia-smi --query-gpu=index,name,memory.total,driver_version --format=csv` | the same |+| AMD GPU | `Get-CimInstance Win32_VideoController \| Select-Object Name, AdapterRAM` (AdapterRAM is capped at 4 GB; trust the model name) | `lspci \| grep -i -E 'vga\|display'`; VRAM: `cat /sys/class/drm/card*/device/mem_info_vram_total` (bytes); `rocm-smi` only if ROCm is installed |+| RAM | `(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB` | `free -g` |+| Free disk | `Get-PSDrive -PSProvider FileSystem` | `df -h .` |++Requirements (details: [INSTALL.md](INSTALL.md#what-you-need)):++- **GPU:** NVIDIA RTX 20, 30, 40 or 50 series, or AMD Radeon RX 7900 XT / XTX, RX 7800 XT / 7700 XT, RX 9060 XT,+ RX 9070 / 9070 XT, Radeon AI PRO R9700, RX 6800 / 6900 series; 12 GB of VRAM or more (an NVIDIA card with 8 GB runs,+ slowly). GTX 10 series and older, and integrated GPUs, are not supported.+- **Driver:** NVIDIA 580 or newer. AMD on Linux: the kernel's amdgpu driver; on Windows: a current AMD Adrenalin+ driver. If the driver is missing or too old, tell the user to update it (NVIDIA App / nvidia.com/drivers, or AMD+ Software) and restart; do not install drivers yourself unless they ask.+- **RAM:** 32 GB or more (see step 3). **Disk:** ~80 GB free, ideally on an NVMe SSD. **CPU:** x86-64 with AVX2.+- **OS:** Windows 10/11 or Linux (Ubuntu 22.04/24.04 are fully automatic).++If the PC does not meet them, say which part is missing and stop.++## 2. Get Strata++```+git clone https://github.com/Niko1221/Strata.git+```++Without git: download https://github.com/Niko1221/Strata/archive/refs/heads/main.zip and unzip it. Pick a drive with+enough free space: the model files go to a `Strata-data` folder **next to** the Strata folder (or `--data-dir <path>`+on another drive).++## 3. Pick the model++By the PC's RAM (ask the user whether they mainly want it for code - then the Coder is a good pick at any RAM size):++| RAM | `--family` / `--model` | Notes |+| --- | --- | --- |+| 32 GB | `--family coder` (size IQ1_M) | for code; with a 24 GB card Q2_0 and IQ2_XS also run (setup picks the low-RAM mode) |+| 48 GB | `--family qwen --model IQ2_XS` | or `Q2_0` (fastest) |+| 64 GB | `--family qwen --model IQ2_XS` (recommended) | `IQ3_XXS` / `IQ3_S` are slower and a bit better |+| 96 GB+ | `--family qwen --model IQ3_S` | `--family unsloth --model UD-Q4_K_XL` is experimental: NVIDIA only, NVMe SSD, 7-8.5 tokens/s on 64 GB |++`--family swift` (Swift 1.5, a fine-tune that thinks shorter; sizes Q2_0, IQ2_XS, IQ3_XXS) is the alternative to+`qwen`. With `--yes` and no `--model`, setup picks the recommended size for the RAM itself. More: [MODELS.md](MODELS.md).++## 4. Run setup without questions++From the Strata folder (Windows: in `cmd`, or `cmd /c START-HERE.bat ...` from PowerShell):++```+Windows: START-HERE.bat --yes --family qwen --model IQ2_XS --no-start+Linux: ./setup.sh --yes --family qwen --model IQ2_XS --no-start+```++The flags (all of them: `START-HERE.bat --help`):++| Flag | Meaning |+| --- | --- |+| `--yes` | take the recommended answer to every question (no prompts) |+| `--family qwen\|swift\|coder\|unsloth` | the model version |+| `--model Q2_0\|IQ2_XS\|IQ3_XXS\|IQ3_S\|IQ1_M\|UD-Q4_K_XL` | the size (the Coder is IQ1_M, Unsloth UD-Q4_K_XL) |+| `--context N` | context in tokens; default by VRAM: 32768 under 14 GB, 65536 under 20 GB, else 131072 |+| `--vision yes\|no\|gpu\|cpu` | read pictures; `--yes` leaves images off. AMD cards: `cpu` |+| `--gpu N` / `--gpus 0,1` / `--gpus all` | one card, or several sharing the model (default: the card with the most VRAM) |+| `--backend cuda\|hip` | NVIDIA or AMD engine; chosen by itself on a PC with only one kind of card |+| `--data-dir PATH` | where the 70-120 GB of model files go |+| `--port N` | the server port (default 8080) |+| `--host H --api-key K` | listen beyond this PC; **only together with a key** |+| `--no-start` | install only, do not start the server |+| `--setup` | install another model or change settings of an installed one |+| `--check` | only check the PC |++`--no-start` is recommended for agents: the server runs in the foreground until its window is closed, which would+block your shell. Start it separately in step 6.++Notes:+- **Linux:** setup uses `sudo apt` (or dnf/pacman) to install Python with venv if it is missing, and on AMD may need+ `build-essential` and `git`. You cannot type the user's password: if a `sudo` step is needed, ask the user to run it+ (e.g. `sudo apt install python3-venv build-essential git`) and then rerun setup.+- **AMD on Linux:** setup installs ROCm into `.venv` (~10 GB, no sudo) unless a system ROCm 7 exists, and compiles the+ engine for the card (10-20 minutes, once).+- **NVIDIA with no ready-made engine for the card:** setup offers to install build tools and compile (20-40 minutes);+ `--yes` accepts.++## 5. While it downloads, tell the user++- It downloads about 70 GB from Hugging Face; how long depends on their connection (at 100 Mbit/s roughly 1.5-2+ hours). It can be stopped and continues where it left off.+- Then it prepares the model for their PC (a few minutes) and, on AMD on Linux, compiles the engine.+- **When the model starts, the PC can be slow or stop responding for 1-3 minutes** (longest the first time): Strata+ loads 35-55 GB into RAM and locks part of it for the graphics card. That is normal; they should not close the window.+- Nothing leaves their PC: the model runs locally.++## 6. Start the server++Setup prints the start script it wrote (`start script: run-<model>.bat`). The name is the family tag plus the size,+lower case: `run-iq2_xs`, `run-swift-iq2_xs`, `run-coder-iq1_m`, `run-unsloth-ud-q4_k_xl`.++```+Windows (PowerShell): Start-Process -FilePath ".\run-iq2_xs.bat" (opens its own window)+Linux: nohup ./run-iq2_xs.sh > strata-server.out 2>&1 &+```++Or `START-HERE.bat` / `./setup.sh` without flags, which starts the installed model (it asks which one when several are+installed; add `--yes` to take the first). The server opens the user's browser on `http://127.0.0.1:8080` when it is+ready. Closing its window (or stopping the process) stops the model.++## 7. Verify++The HTTP server answers once the model is loaded (30-90 s on later starts, a few minutes the first time). Poll:++```+curl http://127.0.0.1:8080/health+```++It returns `{"status": "ok", "model": ..., "max_context": ..., "images": ..., "api_key": ..., "loaded": true, ...}`.+Then:++```+curl http://127.0.0.1:8080/v1/models+curl http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" -d "{\"model\": \"strata\", \"messages\": [{\"role\": \"user\", \"content\": \"Say hello in five words.\"}], \"max_tokens\": 64, \"reasoning_effort\": \"none\"}"+```++With an API key, add `-H "Authorization: Bearer <key>"`. The server window prints a `ready: http://127.0.0.1:8080/v1`+line when it is ready; the engine log is `strata-<model>.log` in the Strata folder.++## 8. Connect the user's apps++- **Browser:** `http://127.0.0.1:8080` - Chat, a live Monitor, and About (settings and addresses).+- **Any OpenAI-compatible app or agent:** base URL `http://127.0.0.1:8080/v1`, any API key (or the configured one),+ any model name.+- **Anthropic-compatible apps:** `http://127.0.0.1:8080/v1/messages`.+- **Claude Code:** `ANTHROPIC_BASE_URL=http://127.0.0.1:8080`, `ANTHROPIC_MODEL` set to a Claude model name it knows+ (Strata ignores the name), and any `ANTHROPIC_AUTH_TOKEN` (or the configured key).+- **Thinking level:** `"reasoning_effort": "none" | "low" | "medium" | "high"` (default high).+- Strata answers one request at a time. API details: [DETAILS.md](DETAILS.md#using-it).++## 9. When something fails++| Symptom | What to do |+| --- | --- |+| `the NVIDIA driver is too old` | The user updates the driver (NVIDIA App or nvidia.com/drivers) and restarts; rerun setup. |+| Download or install stopped | Rerun the same setup command; it continues. |+| `port 8080 is already in use` | Strata is already running (check `/health`), or use `--port 8081`. |+| Very slow, disk busy, or "the engine stopped unexpectedly" | Not enough free RAM: close programs, or set up a smaller size (`--setup --model Q2_0` or IQ2_XS). |+| `ExpertCache: cudaMalloc(...) failed: out of memory` with free VRAM (Windows) | The page file is off or tiny: set it to "System managed" and restart. |+| `prompt ... exceeds the context` | Rerun setup with `--setup --context <bigger>`. |+| No AMD GPU found (Linux) | The amdgpu driver lists no GPU; check the card and driver. Integrated GPUs are not supported. |+| Python or build tools could not be installed | Install what the message names (links are printed), then rerun. |++More: [TROUBLESHOOTING.md](TROUBLESHOOTING.md) and the [full table](DETAILS.md#troubleshooting). If it still fails,+collect `strata-<model>.log` and the setup output, and suggest an issue at https://github.com/Niko1221/Strata/issues.++## Alternative: the MCP server++Strata also has an MCP server, so an AI tool can check, install, start and stop Strata through tool calls+(`strata_status`, `strata_models`, `strata_install`, `strata_start`, `strata_stop`, `strata_logs`) instead of the+shell commands above. See [MCP_SERVER.md](MCP_SERVER.md).diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.mdindex 8df4bb85f..780b86789 100644--- a/docs/AMD_HIP.md+++ b/docs/AMD_HIP.md@@ -1,10 +1,12 @@-# Experimental AMD HIP backend (gfx1100, gfx1101, gfx1200, gfx1201, gfx1030)+# AMD Radeon: the HIP backend (gfx1100, gfx1101, gfx1200, gfx1201, gfx1030)-This is a Linux source build for the RX 7900 XT / XTX (RDNA3, gfx1100) and the+Strata runs on AMD Radeon cards through its HIP backend, the same engine as on NVIDIA compiled for AMD. This page+covers the build on Linux for the RX 7900 XT / XTX (RDNA3, gfx1100) and theRX 9070 / 9070 XT / Radeon AI PRO R9700 (RDNA4, gfx1201; see [RDNA4](#rdna4-gfx1201)). The RX 7800 XT / 7700 XT(gfx1101) and the RX 9060 XT (gfx1200) were validated by their owners (see [Community-validated-cards](#community-validated-cards)); the RX 6800 / 6900 series (RDNA2, gfx1030) builds and runs too, reported by a community machine and not yet validated by the maintainers (see [RDNA2](#rdna2-gfx1030)). It is opt-in; the NVIDIA installer and CUDA build remain the default. Other AMD-architectures, wave64, Windows HIP, and mixed AMD/NVIDIA execution are outside this contribution.+cards](#community-validated-cards)); the RX 6800 / 6900 series (RDNA2, gfx1030) builds and runs too, reported by a community machine and not yet validated by the maintainers (see [RDNA2](#rdna2-gfx1030)). Setup chooses it by itself on a PC with no NVIDIA card Strata can use (`--backend hip` on a PC with both); the+install steps for users are in [INSTALL.md](INSTALL.md#amd-cards). Other AMD architectures, wave64, and mixed+AMD/NVIDIA execution in one run are not supported.The backend maps the CUDA-shaped runtime and BLAS calls to HIP/hipBLAS, usesRDNA2/RDNA3/RDNA4's signed integer dot instruction for quantized kernels, and supplies@@ -123,7 +125,7 @@ The worker count above was used on a 16-core CPU; measure it for your CPU.The 4K context is a smoke-test starting point, not a model limit. The expert cachesizes itself automatically and leaves 1 GiB of VRAM headroom.-The installer supports this backend (see "Install with setup" above). The vision helper is NVIDIA-only for now.+The installer supports this backend (see "Install with setup" above). Images run through the CPU encoder for now (`--vision cpu`).Setup installs one AMD card, or several with `--gpus` (the engine's layer split; see RDNA4 below).## RDNA4 (gfx1201)diff --git a/docs/DETAILS.md b/docs/DETAILS.mdindex 08737ec2c..de0be74db 100644--- a/docs/DETAILS.md+++ b/docs/DETAILS.md@@ -1,7 +1,8 @@# Strata - the detailsThe technical side of Strata: every measured number, the API, images, all settings and how the engine works.-New here? Start with the [README](../README.md) - it has everything you need to install and use it.+New here? Start with the [README](../README.md); installing step by step is in [INSTALL.md](INSTALL.md), the models in+[MODELS.md](MODELS.md), common problems in [TROUBLESHOOTING.md](TROUBLESHOOTING.md).> **On this page:** [Speed](#speed-measured) · [Other GPUs](#other-gpus-estimated) · [Which model?](#which-model) ·> [Requirements](#before-you-start) · [Windows](#windows) · [Linux](#linux) · [API](#using-it) ·@@ -235,12 +236,13 @@ the positions of short greedy answers, 90-91% after a 16K prompt, differing most## Before you start-You need **only an NVIDIA driver** (version 580 or newer; update it with the NVIDIA App or from-[nvidia.com/drivers](https://www.nvidia.com/drivers)). Everything else is installed for you the first time.+You need **only a graphics driver**: NVIDIA 580 or newer (update it with the NVIDIA App or from+[nvidia.com/drivers](https://www.nvidia.com/drivers)), or for AMD the one in [INSTALL.md](INSTALL.md#what-you-need).+Everything else is installed for you the first time.| | || --- | --- |-| GPU | NVIDIA **RTX 20, 30, 40 or 50 series**, **12 GB VRAM or more** (8 GB runs, slowly). Measured on an RTX 5070 and an RTX 3090; RTX 20 (Turing, since 0.1.27) was tested by a contributor on an RTX 2070. |+| GPU | NVIDIA **RTX 20, 30, 40 or 50 series**, **12 GB VRAM or more** (8 GB runs, slowly). Measured on an RTX 5070 and an RTX 3090; RTX 20 (Turing, since 0.1.27) was tested by a contributor on an RTX 2070. Or AMD **Radeon RX 7900 XT / XTX, RX 7800 XT / 7700 XT, RX 9060 XT, RX 9070 / 9070 XT, Radeon AI PRO R9700, RX 6800 / 6900 series**: [AMD_HIP.md](AMD_HIP.md). || RAM | **64 GB** recommended (see the table above). || CPU | x86-64 with AVX2 (any Intel/AMD desktop CPU from the last ~8 years). AVX-512 (Ryzen 7000/9000) is a bit faster. || Disk | ~70-80 GB free for the model, ~6 GB for the MTP layer (+1 GB with images). **Q2_0 on an AVX-512 CPU** also writes a one-time ~40 GB copy of its experts for the fast CPU kernel. An NVMe SSD is strongly recommended. |diff --git a/docs/HOW_IT_WORKS.md b/docs/HOW_IT_WORKS.mdnew file mode 100644index 000000000..7c8f9eecf--- /dev/null+++ b/docs/HOW_IT_WORKS.md@@ -0,0 +1,77 @@+# How does Strata work?++Models like Qwen3.8-Flash-Next normally run on servers with hundreds of gigabytes of graphics memory. Your graphics+card has 12-24 GB. Strata makes it fit by **sharing the work across your whole PC** - the same idea as a kitchen, where+the things you use all the time stay on the counter and the rest waits in the pantry. Back to the+[README](../README.md#how-does-it-work).++## Who does what++<p align="center"><img src="media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>++- **The model is a team of 24,576 small specialists ("experts"),** and each word it writes needs only 10 of them.+ So it doesn't have to have all of them on the graphics card at once.+- **Your graphics card** does the part of the work needed for every word, and keeps the few thousand experts that+ are asked most often. It keeps learning which ones those are while you use it.+- **Your RAM** holds every expert. When a word needs one the card doesn't have, **your processor** works on it -+ at the same time as the graphics card, so neither waits for the other.+- **Your SSD** holds a big lookup table; the model only reads a few small rows of it per word.++The same in technical terms:++- **GPU (VRAM):** attention and DeltaNet mixers, the gated-residual weights, routers, shared experts, output head, the+ MTP draft layer, the KV cache (from 64K: only its most-read part, the rest streams from RAM), and an **expert+ cache** that fills the rest of VRAM with the most-used experts (it adapts to the conversation while you chat).+ More VRAM matters more than a faster GPU: every extra GB holds ~700 more experts, and every expert on the GPU is one+ the CPU does not have to compute.+- **RAM:** all 24,576 experts, pinned. The CPU computes the experts that are not on the GPU **in place**, at the same+ time as the GPU works on the cached ones (AVX-512 / AVX2 kernels, ggml's for the i-quants). On a PC with little RAM+ and a big card, the [low-RAM mode](MODELS.md#a-big-graphics-card-and-little-ram) keeps in RAM only what the GPU does+ not hold.+- **SSD:** the 28.8 GB n-gram table, read a few rows per token through the OS cache.++This works the same on NVIDIA (CUDA) and AMD (HIP) cards: the same engine, compiled for each.++## Guess, then check++<p align="center"><img src="media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>++- **Guess, then check.** A small, fast helper built into the model guesses the next few words, and the big model+ checks all the guesses in one go. It keeps the ones it agrees with and writes the next word itself - so one step+ often produces several words. The helper only guesses - the big model decides every word - so you get the same+ quality answer, 1.6-1.8x sooner.+- In technical terms: the model's own MTP layer drafts up to 3 tokens; one pass over all 48 layers checks them, 2.4-3.2+ tokens per pass on average. When the reply repeats the context (code edits, quoted text), **prompt lookup** drafts+ up to 5 tokens from the earlier copy, but only where its measured acceptance and cost say it pays: code edits 6-11%+ faster, other text unchanged. The drafts are checked like the MTP's, so the output is the same.++## Reading long texts++**Long texts are read in big pieces** (up to 8,192 tokens - pieces of words - at a time), which is why a long+document or code base is read at over 1,000 tokens per second. The experts of the next layer stream to the GPU over+PCIe while the current layer's attention runs. After the first message, Strata keeps the conversation and reads only+what is new, so follow-ups start in seconds.++## More++The [details](DETAILS.md#how-it-works) explain every part and its numbers, and the+[paper](paper/Strata-Paper.pdf) tells the whole story, with the measurements behind it.++## Credits++- Model: [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) by the Qwen team; compressed versions by+ [ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF);+ [Swift 1.5](https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF) by UkisAI; the experimental+ [UD-Q4_K_XL](https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF) by Unsloth (its support follows+ [eddoursul/Strata](https://github.com/eddoursul/Strata)). Their licenses apply to the model files.+- Built with parts of [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp) (MIT). Ideas from+ [Splash](https://github.com/incoai/splash), [ninfer](https://github.com/Neroued/ninfer) and+ [HyperQwen](https://github.com/syv-ai/HyperQwen). More in the [details](DETAILS.md#credits-and-licenses).+- The AMD (HIP) backend: [AMD_HIP.md](AMD_HIP.md) names the contributors and the machines it was validated on.++## License++Strata is open source under the [MIT License](../LICENSE). A few parts carry their own licenses: `third_party/ggml`+(MIT, llama.cpp / ggml), the web app's font (SIL Open Font License 1.1) and the experimental speed projection's+vector in `data/experimental-speed-projection` (Qwen Community License 1.0, from the model's activations). The+models are not part of this repository; each model's own license applies to its files.diff --git a/docs/INSTALL.md b/docs/INSTALL.mdnew file mode 100644index 000000000..a8a768555--- /dev/null+++ b/docs/INSTALL.md@@ -0,0 +1,186 @@+# Installing Strata++Everything about installing, starting, updating and configuring Strata, on Windows and Linux, with an NVIDIA or an+AMD graphics card. The short version is in the [README](../README.md#install); an AI coding assistant can do all of+this for you with [AI_SETUP.md](AI_SETUP.md).++> **On this page:** [What you need](#what-you-need) · [Windows](#windows) · [Linux](#linux) ·+> [AMD cards](#amd-cards) · [Several cards](#two-or-three-cards) · [Docker](#docker-linux) · [Updating](#updating) ·+> [Where things are stored](#where-things-are-stored) · [Setup's questions](#setups-questions) ·+> [Tuning](#tuning-for-your-pc) · [All options](#options-without-questions)++## What you need++| | |+| --- | --- |+| **GPU** | **NVIDIA** RTX 20, 30, 40 or 50 series, **12 GB VRAM or more** (8 GB runs, slowly). Measured on an RTX 5070 and an RTX 3090; RTX 20 (Turing, since 0.1.27) was tested by a contributor on an RTX 2070. **AMD** Radeon RX 7900 XT / XTX, RX 9070 / 9070 XT and Radeon AI PRO R9700 (validated), RX 7800 XT / 7700 XT and RX 9060 XT (validated by their owners), RX 6800 / 6900 series (community-reported), with 12 GB of VRAM or more. See [AMD cards](#amd-cards). |+| **RAM** | Enough for the size you pick ([which model](MODELS.md#pick-by-ram)); **64 GB** runs every size. A big GPU makes up for less RAM - the [low-RAM mode](MODELS.md#a-big-graphics-card-and-little-ram). |+| **CPU** | x86-64 with AVX2 (any Intel/AMD desktop CPU from the last ~8 years). AVX-512 (Ryzen 7000/9000) is a bit faster. |+| **Disk** | ~70-80 GB free for the model, ~6 GB for the MTP layer (+1 GB with images). **Q2_0 on an AVX-512 CPU** also writes a one-time ~40 GB copy of its experts for the fast CPU kernel. On Linux with an AMD card, ROCm takes ~10 GB more when setup installs it. An NVMe SSD is strongly recommended: it makes the first start much faster. |+| **OS** | Windows 10/11, or Linux (Ubuntu 22.04/24.04 get everything installed automatically). |+| **Driver** | **NVIDIA:** a current driver, version 580 or newer ([nvidia.com/drivers](https://www.nvidia.com/drivers) or the NVIDIA App). **AMD:** on Linux the kernel's amdgpu driver (no ROCm install needed); on Windows a current AMD Software: Adrenalin Edition driver ([amd.com/support](https://www.amd.com/en/support)). |++The driver is the only thing you install yourself. Everything else - Python, the engine, the model - is set up for+you the first time: Python 3.12 if you have none (for your user account, no admin), a private Python environment in+`.venv/`, the Strata engine, the model and the MTP draft layer. On NVIDIA it uses the ready-made engine for RTX+20/30/40/50 and NVIDIA's CUDA libraries from pip (~0.4 GB); if no ready-made engine fits your PC, it offers to install+the build tools (Visual Studio Build Tools + CUDA Toolkit on Windows, `build-essential` + CUDA on Ubuntu) and compiles+the engine for your GPU (asks first; 20-40 minutes once). More: [details](DETAILS.md#before-you-start).++## Windows++1. [Download this project](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) and unzip it (or+ `git clone` it).+2. Double-click **`START-HERE.bat`**.+3. Answer a few questions - or just press Enter each time for the recommended choice ([the questions](#setups-questions)).++Then it downloads everything (the model is ~70 GB, so the first time takes a while - you can stop and it picks up+where it left off) and **starts the model**. Your browser opens the Strata app at `http://127.0.0.1:8080`.++> **While the model starts, your PC can be slow or stop responding for 1-3 minutes** (longest the first time): Strata+> loads 35-55 GB into your RAM and locks part of it for the graphics card. That's normal - wait, and don't close the+> window. The window tells you what it is doing.++**Next time**, just double-click `START-HERE.bat` again: it starts right away (30-90 s to load the model), nothing is+downloaded twice. Close its window to stop the model. `SETUP.bat` (the same as `START-HERE.bat --setup`) installs+another model or changes the settings. Starting Strata from Task Scheduler at logon needs two task settings, or the+start is 24x slower: [Running it at startup](DETAILS.md#running-it-at-startup-task-scheduler).++## Linux++```bash+./setup.sh+```++The same questions, the same automatic install (it uses `sudo apt` for Python and, only if it has to compile, for+the build tools), and the same start: `http://127.0.0.1:8080`. Later runs of `./setup.sh` (or `./run-<model>.sh`)+start the model directly; `./setup.sh --setup` installs another model or changes the settings. Other distributions,+WSL and compiling: [details](DETAILS.md#linux).++## AMD cards++The steps are the same as with NVIDIA: `START-HERE.bat` on Windows, `./setup.sh` on Linux. Setup finds the Radeon+card and chooses the AMD (HIP) engine by itself on a PC with no NVIDIA card Strata can use; `--backend hip` chooses+it on a PC that has both. Supported cards: RX 7900 XT / XTX (gfx1100), RX 7800 XT / 7700 XT (gfx1101), RX 9060 XT+(gfx1200), RX 9070 / 9070 XT and Radeon AI PRO R9700 (gfx1201), and the RX 6800 / 6900 series (gfx1030). Integrated+Radeon GPUs are listed as not supported.++On Linux setup uses a system ROCm 7 when there is one, or installs ROCm into `.venv` from AMD's wheels (~10 GB, no+sudo), and compiles the engine on your PC for the card (10-20 minutes, once; it needs a C++ compiler and git:+`sudo apt install build-essential git`). Several AMD cards share the model with `--gpus`, as on NVIDIA.++What differs from NVIDIA for now: pictures are read by the image encoder on the CPU (`--vision cpu`, 10-30 s per+picture), `--calibrate` is NVIDIA-only, and Unsloth's 4-bit model needs an NVIDIA card. Measurements per card, the+build by hand and the tuning tables: [AMD_HIP.md](AMD_HIP.md).++## Two or three cards++**Two or three NVIDIA cards?** Just run `START-HERE.bat`: it lists your cards, says which ones Strata can use, and+asks whether to share the model across them (recommended when two can). An install made on one card asks once at+its next start. Or choose yourself: `START-HERE.bat --gpus 0,2` (both, remembered), `--gpus all`, or `--gpu 0` (one+card, this start only). Each card keeps the experts of its own layers, and prompts flow through the cards in a+pipeline: on an RTX 5080 + RTX 3090 prompts were read 18-20% faster than on the 5080 alone, decoding on par.+Every card must be an RTX 20 series or newer with 8 GB or more. See [MULTI_GPU.md](MULTI_GPU.md).++**Several AMD cards:** setup takes one card (the one with the most VRAM, or `--gpu N`) unless you name more:+`--gpus 1,0` splits the model's layers across them, the first one the main card (numbers as setup lists them). A+split pays only when no single card holds the model's experts ([AMD_HIP.md](AMD_HIP.md#rdna4-gfx1201)).++## Docker (Linux)++The same idea, in a container (NVIDIA cards).++1. Host: Docker with the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)+ and a driver **580 or newer** (CUDA 13.0).+2. Build (this compiles the engine into the image, so the container never compiles):+ `docker build -t strata .`+ `docker build -t strata --build-arg CUDA_ARCHITECTURES=89 .` builds for one card only (faster).+ The default covers RTX 30 (86), RTX 40 (89), RTX 50 (120) and A-series (80); a card outside that+ set needs a rebuild with its own arch. Add `--build-arg BUILD_VISION=0` to skip the image encoder.+3. Run (the first start downloads the ~70 GB model, then starts; later starts go straight to serving):+ `docker run --rm --gpus all -p 8080:8080 --ulimit memlock=-1 -v strata-data:/data strata`++ The setup choices are env vars: `-e MODEL=IQ2_XS -e FAMILY=qwen -e CONTEXT=32768 -e VISION=no`+ (or `MODEL=Q2_0|IQ3_XXS|IQ3_S`, `FAMILY=swift|coder`; the defaults above are the recommended ones).+ `-e VISION=cpu` keeps the image encoder on the CPU. `-e KV=int8|q4_0|k8v4` picks the KV cache+ precision; `k8v4` is INT8 K with 4-bit V and keeps its KV in VRAM from 64K up.+ Only the model files, the prepared pack, the MTP layer and the install config live in the+ `strata-data` volume; the engine is part of the image. Switching between models already on the+ volume needs no setup pass: `-e MODEL=Q2_0 -e FAMILY=coder` picks that model's config. Add+ `-e REINSTALL=1` only to change settings for a model already set up (context, vision, KV, host,+ api_key, LOW_RAM), since those are recorded in its config.+ Strata loads 32-62 GB into RAM. `--gpus all` on a host with two usable cards takes both: the+ layer split is setup's recommended default ([MULTI_GPU.md](MULTI_GPU.md)), and a volume+ set up for one card switches to the pair on its first start there. Pin one card with `-e GPU=0`,+ or name them with `-e GPUS=0,2` and where the later card's layers start with `-e LAYER_SPLIT=18`.+ A memory limit needs `-e LOW_RAM=on`, which maps the model's experts from the pack instead of+ keeping them in RAM: setup.py measures the host's RAM, not the container's limit, so it cannot+ see a cap. LOW_RAM runs on one card.+ The server listens on `0.0.0.0:8080` by default; set `-e API_KEY=<secret>` before exposing the port+ to a network. The image has a `HEALTHCHECK` on `/health`, so `docker ps` shows the container+ healthy once the model is loaded, and `GET /v1/status` says what it is running.++## Updating++Download the new version and unzip it anywhere (or `git pull`), then run `START-HERE.bat` (Linux: `./setup.sh`) in+it. The model files are kept in a `Strata-data` folder next to your Strata folder, so a new copy finds them and sets+itself up the same way - nothing big is downloaded again. On Linux after a `git pull`, setup compiles the engine+again when its source changed (a minute or two for the changed files); if that compile fails, it says so and starts+the engine you had.++## Where things are stored++- **Your chats: only in your browser.** The Chat tab keeps the conversation, its settings and the API key you typed+ in the browser's local storage (`strata.*` keys) - not on the server and not in the Strata folder. Pictures are not+ kept, only their names. Another browser or a private window starts empty; clearing the site's data deletes them.+- **How the model starts:** `strata-<model>.json` in the Strata folder (context, GPUs, host, API key, ...), written+ by setup; next to it `run-<model>.bat` / `.sh`, the log `strata-<model>.log` and, when you use "Use for other+ apps too", `strata-<model>.shared-settings.json`.+- **The model files** (`models/`, `packs/`, `mtp/`, 70-120 GB): in **`Strata-data` next to the Strata folder**, or+ wherever `--data-dir` put them.+- **Where that data folder is:** `%APPDATA%\Strata\settings.json` on Windows, `~/.config/strata/settings.json` on+ Linux ([details](DETAILS.md#before-you-start)).+- **The program itself:** `.venv/`, `engine/` and `third_party/` in the Strata folder.++## Setup's questions++- **Which model and size?** The original, Swift 1.5, the Coder or Unsloth's 4-bit, and Q2_0, IQ2_XS, IQ3_XXS or+ IQ3_S - see [which model](MODELS.md).+- **How much context?** How much text it can keep in mind at once (it suggests one for your card). 384K and+ 512K (experimental) extend the model past its trained 262K by rope scaling - the setup turns it on itself (yarn and a+ covering factor; `--rope-scaling`/`--rope-scale` override) ([details](DETAILS.md): "Context extension past+ 262K").+- **Images?** Whether it should also read pictures. The image encoder (0.9 GB) runs on the GPU (0.1-0.5 s per+ picture, ~1.4 GB of VRAM kept free for it) or on the CPU (10-30 s per picture, nothing on the GPU); with AMD cards+ on the CPU for now. [Details](DETAILS.md#images-vision).+- **Experimental speed projection?** Off unless you say yes - [read what it does](DETAILS.md#experimental-speed-projection-experimental-off-by-default)+ first. It changes how the model answers, and only the original model offers it.++With `--yes` setup takes the recommended answer to every question.++## Tuning for your PC++Every PC is different: `START-HERE.bat --calibrate` (Linux: `./setup.sh --calibrate`) measures a few engine settings+on yours and keeps the fastest (about 5-10 minutes; on an RTX 5070 with a Ryzen 5 7600 it made the Coder 7% faster).+It keeps a setting only when it is more than 3% faster, and the result is remembered per PC and model, so updates+keep it. NVIDIA cards for now. [What it measures](DETAILS.md#double-click-start-herebat).++## Options without questions++```+START-HERE.bat --setup install another model, or change context / images+SETUP.bat the same (double-click it)+START-HERE.bat --model IQ2_XS --context 32768 --vision yes --yes no questions+START-HERE.bat --gguf-dir D:\models\IQ2_XS use GGUF files you already have+START-HERE.bat --data-dir E:\Strata-data keep the model files somewhere else+START-HERE.bat --port 8081 another port+START-HERE.bat --gpu 1 another GPU (setup picks the one with the most VRAM)+START-HERE.bat --gpus 0,2 several GPUs sharing the model+START-HERE.bat --setup --backend hip the AMD engine on a PC that also has an NVIDIA card+START-HERE.bat --setup --host 0.0.0.0 --api-key <secret> reachable from other devices, with a key+START-HERE.bat --calibrate tune the engine for this PC (about 5-10 minutes), then start+START-HERE.bat --check only check this PC+```++On Linux the same options go to `./setup.sh`. `START-HERE.bat --help` lists them all. The server's own settings+(sharing the GPU with games, MCP tools, CORS, API keys, the API itself) are in the [details](DETAILS.md#using-it).diff --git a/docs/MODELS.md b/docs/MODELS.mdnew file mode 100644index 000000000..0f75572de--- /dev/null+++ b/docs/MODELS.md@@ -0,0 +1,127 @@+# Which model? Sizes, versions and what fits++Strata runs one model, [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next), in several **sizes**+(the same model, compressed more or less) and several **versions** (the original, a coding version, a fine-tune).+The installer recommends one for your PC; this page explains the choice. Back to the [README](../README.md).++> **On this page:** [Pick by RAM](#pick-by-ram) · [Speed](#how-fast-is-each-size) · [The sizes](#the-sizes) ·+> [Will it fit?](#will-it-fit) · [The versions](#the-versions) · [Adding another model](#adding-or-switching-models)++## Pick by RAM++| Your RAM | Take | Why |+| --- | --- | --- |+| **32 GB** | **Coder** | it fits 32 GB, and it is made for code (with a 24 GB card, Q2_0 and IQ2_XS run too: [low-RAM mode](#a-big-graphics-card-and-little-ram)) |+| **48 GB** | **IQ2_XS** (or Q2_0, the fastest) | the larger sizes do not fit |+| **64 GB** | **IQ2_XS** (recommended), or IQ3_XXS / IQ3_S | every size fits (IQ3_S with little else open) |+| **96 GB or more** | **IQ3_S**, or [Unsloth's 4-bit](#unsloth-ud-q4_k_xl-experimental) (experimental) | room for the largest sizes |++Not sure? Take **IQ2_XS** - or the **Coder** if you mainly write code, or have 32-48 GB of RAM.++## How fast is each size++Measured on an RTX 5070 (12 GB), a Ryzen 5 7600 and 64 GB of RAM:++| Size | Writes answers (short chat) | Writes answers (128K context) | Reads your prompt |+| --- | ---: | ---: | ---: |+| **Q2_0** | 93 tokens/s | 74 tokens/s | 2,170 tokens/s |+| **IQ2_XS** | 79 tokens/s | 63 tokens/s | 2,090 tokens/s |+| **IQ3_XXS** | 62 tokens/s | 49 tokens/s | 1,750 tokens/s |+| **IQ3_S** | 53 tokens/s | 46 tokens/s | 1,620 tokens/s |+| **Coder** (IQ1_M) | 55 tokens/s | 43 tokens/s | 2,180 tokens/s |++- **Writes answers** = how fast the reply appears (tokens per second; a token is about ¾ of a word).+- **Reads your prompt** = how fast it takes in what you send (long documents, code, chat history), measured on a+ 32K-token prompt; a 4K prompt reads at 910-1,580 tokens/s. A 32K prompt takes about 15 seconds with Q2_0.++A card with more VRAM is faster, because more of the model fits on the GPU: an RTX 3090 (24 GB) should do roughly+100-140 tokens per second. All measurements, long-context numbers and estimates for other cards are in the+[details](DETAILS.md#speed-measured). The AMD measurements per card (RX 9070 XT, Radeon AI PRO R9700, RX 7800 XT,+RX 9060 XT, RX 6900 XT) are in [AMD_HIP.md](AMD_HIP.md#rdna4-gfx1201).++Every PC is different: `START-HERE.bat --calibrate` measures a few engine settings on yours and keeps the fastest+(about 5-10 minutes; on the PC above it made the Coder 7% faster; NVIDIA cards for now). Measured Strata on your own+PC? See [Community benchmark results](COMMUNITY_BENCHMARKS.md) for a report template and how to share your results+in a pull request.++## The sizes++| Model | RAM+VRAM Requirements | Speed | Quality |+| --- | ---: | --- | --- |+| **Q2_0** | 37.6 GB | fastest | good |+| **IQ2_XS** | 39.2 GB | fast | better (**recommended**) |+| **IQ3_XXS** | 47.0 GB | slower | great |+| **IQ3_S** | 54.8 GB | slowest | best: matches the full model on the published tests (original model only) |++The download is 66-76 GB for the three smaller sizes ([details](DETAILS.md#which-model)); the first start also+fetches the MTP draft layer (~6 GB, +1 GB with images).++## Will it fit?++Shard 1 is the part of the model that gets loaded when it starts: its experts go into your **RAM**, the rest onto+your graphics card (the second shard, a 29 GB lookup table, stays on the SSD). So it fits when your **RAM is at least+shard 1 + about 10 GB** for Windows and your other programs. With 64 GB of RAM every size fits (IQ3_S with little+else open); with 48 GB, Q2_0 and IQ2_XS. A bigger graphics card makes it faster, but it doesn't lower the RAM needed+- except in the low-RAM mode below.++### A big graphics card and little RAM++On a PC whose RAM cannot hold the experts beside the system, setup maps them from the model's files instead and keeps+in RAM only what the graphics card does not hold (the [low-RAM mode](DETAILS.md#speed-measured), chosen by setup). For+example, a 32 GB PC with a 24 GB GPU runs Q2_0, IQ2_XS and the Coder this way, and a 32 GB PC with a 12-16 GB GPU the+Coder. With a small card most experts then come from the SSD and it is much slower (setup says so).+`START-HERE.bat --setup --low-ram on|off` overrides the choice.++## The versions++### Qwen3.8-Flash-Next++The original, in all four sizes. With images, and with the+[experimental speed projection](DETAILS.md#experimental-speed-projection-experimental-off-by-default) as an option.++### Coder++**[Coder](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-Coder-GGUF)** - ISTA-DASLab's coding version:+half of the experts removed, keeping the ones that code, tool use and images need (91% of the full model's SWE-bench+Verified score, 99% of LiveCodeBench, by its authors). One size (IQ1_M: its experts stored like IQ3_S): shard 1 is+**29.6 GB**, so it fits a PC with **32 GB of RAM**, runs 262K context on 64 GB, and reads long prompts the fastest of+all. Weaker outside coding. More: [details](DETAILS.md#or-the-coder-half-the-experts-for-code).++```+START-HERE.bat --setup --family coder+```++### Swift 1.5++**[Swift 1.5](https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF)** - a fine-tune by UkisAI that+thinks much shorter before answering, so you get the answer sooner, with about the same quality. Same speed per+token, and about the same RAM as the same size of the original (no IQ3_S). Its own license applies (see its page).+More: [details](DETAILS.md#or-swift-15-a-fine-tune-that-thinks-shorter).++```+START-HERE.bat --setup --family swift --model IQ2_XS+```++### Unsloth UD-Q4_K_XL (experimental)++**Unsloth's 4-bit UD-Q4_K_XL** (experimental) is the fourth version in setup's menu (`--family unsloth`): the closest+to the full model, but a 111 GB download whose 77 GB of experts do not fit in RAM. Strata keeps your RAM minus 24 GB+of them in RAM and reads the rest from the SSD while it answers: 7-8.5 tokens/s on a 64 GB PC with a 12 GB GPU, several+times slower than the sizes above, and long prompts are slow. It needs 48 GB of RAM or more, an NVMe SSD and one+NVIDIA GPU (no images yet). Details and measurements: [UD-Q4_K_XL](UNSLOTH_Q4.md).++```+START-HERE.bat --setup --family unsloth --model UD-Q4_K_XL+```++### OrcaRouter Uncensored IQ3_XXS++For **OrcaRouter's Flash-Next Uncensored IQ3_XXS**, see the [manual compatibility setup](ORCA.md). It needs an+explicit packing conversion and is not an installer menu option.++## Adding or switching models++You can add another model any time with `SETUP.bat` (the same as `START-HERE.bat --setup`; on Linux+`./setup.sh --setup`). Files another model shares are not downloaded again (the Coder uses the original's shard 2 and+vision encoder). With more than one model installed, `START-HERE.bat` asks which one to start; `run-<model>.bat`+(Linux: `run-<model>.sh`) starts one directly.diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.mdnew file mode 100644index 000000000..2d040b09d--- /dev/null+++ b/docs/TROUBLESHOOTING.md@@ -0,0 +1,70 @@+# Something went wrong?++The common problems and what to do. Back to the [README](../README.md#something-went-wrong). The full table of+error messages, with the older engine fixes, is in the [details](DETAILS.md#troubleshooting).++## While installing or starting++**My PC froze, or got very slow, the first time Strata started.**+That's normal while it starts, most of all the first time. Strata loads 35-55 GB into your RAM, locks part of it for+the graphics card, and works out how much of the model fits on your GPU. The mouse can freeze for a few minutes.+**Wait, and don't close the window.** The next starts are much faster. Still frozen after 10 minutes? Restart the+PC, close other programs (browsers use a lot of RAM) and try again. If it keeps happening, pick a smaller size (Q2_0+or IQ2_XS).++**It stopped while downloading or installing.**+Run `START-HERE.bat` (Linux: `./setup.sh`) again. It continues where it stopped.++**It says the NVIDIA driver is too old.**+Update it (NVIDIA App or [nvidia.com/drivers](https://www.nvidia.com/drivers)), restart the PC, and run+`START-HERE.bat` again.++**It says port 8080 is already in use.**+Strata is already running. Look for its window. Or another program uses the port: `START-HERE.bat --port 8081`.++**Python or the build tools could not be installed.**+Install what it names (links are printed), then run it again. Everything already done is kept.++**The first start takes minutes.**+It is reading 34-55 GB into RAM; the second start is faster while the files are in the OS cache. Started from Task+Scheduler, it can be 24x slower: see [Running it at startup](DETAILS.md#running-it-at-startup-task-scheduler).++## While it answers++**It's very slow and the disk light keeps blinking.**+Your PC is out of free RAM. Close other programs, or pick a smaller size (Q2_0 or IQ2_XS).++**An answer stopped with "the engine stopped unexpectedly".**+Usually not enough RAM (on Linux the system then stops the engine). Just send your message again: Strata starts the+engine by itself. If it keeps happening, close other programs or pick a smaller size.++**It says the prompt exceeds the context.**+The conversation is longer than the context you chose. Start a new chat, or run `SETUP.bat` and pick more+context.++**It is slower than the tables.**+The monitor plugged into the graphics card and other GPU programs take VRAM from the expert cache; RAM running below+its rated speed (enable EXPO/XMP in the BIOS) slows the CPU half.++**Pictures are refused, or slow.**+"this server was started without the vision encoder": the model was set up for text only - run setup again with+`--vision gpu` (or `--vision cpu`). Pictures that take 10-30 s are read by the encoder on the CPU; `--vision gpu`+(NVIDIA, ~1.4 GB of VRAM) makes it 0.1-0.5 s.++## AMD cards++**"No AMD GPU found (the amdgpu driver's KFD topology is empty)" on Linux.**+The kernel's amdgpu driver is not loaded for the card. Integrated Radeon GPUs are listed as not supported; setup+lists every card it found and whether Strata can use it.++**The engine stops at start with the card's name, its architecture and the build's list.**+The engine was compiled for another card (for example after moving the Strata folder to another PC). Run+`./setup.sh --setup --backend hip`: it compiles the engine for this card's architecture.++**Large pinned host allocations fail on ROCm although RAM is free.**+See [AMD_HIP.md](AMD_HIP.md#model-and-serving-configuration): the mapped expert mode avoids the full pinned arena.++## Still stuck?++Look in the [full troubleshooting table](DETAILS.md#troubleshooting), or open an+[issue](https://github.com/Niko1221/Strata/issues) and attach `strata-<model>.log` from the Strata folder.