Lumine2 Server
Lumine 2 real-time inference engine · SASH context management
English · 简体中文
Overview · Quick start · Installation · Configuration · Client
Real-time inference and an OpenAI-compatible API for Lumine 2, built on Qwen3.5-9B. **Sliding-And-Sawtooth Hybrid (SASH) inference** maintains episodic and recent history for long-running gameplay.
**Requirements:** Linux / WSL2 · Python 3.13 · CUDA 13.0 / 13.3 · NVIDIA RTX 5090 (SM120) / H100 (SM90); other GPUs are not guaranteed.
Deployment: local WSL2 or a separate Linux server
### Why Does Server Use a Linux Environment?
Server accelerates inference with PyTorch / CUDA, FlashAttention, Triton and custom CUDA extensions. Its current installation workflow targets Linux. Upstream support guides this choice: [Triton's supported platforms](https://github.com/triton-lang/triton#compatibility) list Linux, and [FlashAttention's installation requirements](https://github.com/Dao-AILab/flash-attention#installation-and-features) specify Linux while noting that Windows compilation needs more testing. We therefore recommend a Linux environment for Server and its optimized kernels; native Windows server execution has not been validated.
### One Windows PC: WSL2 Recommended
On an **RTX 5090 Windows laptop or desktop**, the game and Client run directly on Windows, while Server runs in WSL2. [WSL2 (Windows Subsystem for Linux)](https://learn.microsoft.com/en-us/windows/wsl/about) runs a real Linux kernel in a lightweight virtual machine. Installing a distribution such as Ubuntu gives you a Linux terminal on that same Windows PC, without another computer or switching between operating systems.
Server accesses the PC's NVIDIA GPU through [CUDA on WSL](https://docs.nvidia.com/cuda/wsl-user-guide/index.html): install the GPU driver on Windows, and the Linux CUDA Toolkit and server Python environment inside WSL2. Client uses its own Windows Python environment and connects to Server at `http://localhost:8000`.
WSL2 is recommended for compatibility with Linux inference dependencies and access to optimized GPU kernels. Actual performance still depends on the GPU, available VRAM and game workload. On one PC, the game and model share GPU resources; size the context according to the [environment and VRAM notes](docs/INSTALL.md#step-1).
### Windows Client + Linux Server: No WSL2 Needed
If you have a separate Linux GPU host, install and run Server directly on it. The Windows PC runs only the game and Client, connecting through the server's address. **Neither machine needs WSL2 for this setup.** Run the installation guide's Linux commands directly in the server's terminal.
| Deployment | Where Server runs | Client connection URL |
|---|---|---|
| One Windows laptop or desktop | Linux environment in local WSL2 | `http://localhost:8000` |
| Windows PC + Linux GPU host | Linux server; no WSL2 | `http://:8000` |
Follow the [server installation guide](docs/INSTALL.md) for setup commands.
## 1. Quick Start
### 1.1 Install Server
In the local **WSL2 Ubuntu terminal**, enter the checkout’s `server/` directory and run:
```bash
bash install.sh --model-path /path/to/model
```
Replace the model path with your checkpoint directory, or omit `--model-path` to be prompted. The [model download link](docs/INSTALL.md#step-3) is still pending. Installer stages are **GPU and build tools → CUDA Toolkit → Python and server dependencies → verify and save**, with bilingual progress messages.
Continue after `Server installation complete` appears.
### 1.2 Start Server
In the same terminal, run the following command. It loads the model path saved during installation:
```bash
bash start.sh --idle-reset-secs 3600
```
Wait for `Uvicorn running on ...:8000` and keep this terminal open.
Notes: sampling, Reasoning and Instant modes
Set sampling, mode and window options with startup flags. The examples use defaults; omit any flags you do not need to change. Restart Server to apply changes. Explicit flags override the corresponding environment variables.
- Thought sampling (temperature / top-p): `--reasoning-temperature 1.0`, `--reasoning-top-p 0.95`.
- Action sampling (temperature / top-p): `--action-temperature 1.0`, `--action-top-p 0.99`.
These are the defaults; you can try adjusting temperature and top-p yourself for better results in a particular game.
**Reasoning (default)** allows thinking before acting. `--force-thinking-steps 120` forces a thought on turn 120 if the preceding 119 turns had none. Set it to `-1` to disable periodic forcing; the model can still choose to think.
```bash
bash start.sh --reasoning \
--reasoning-temperature 1.0 --reasoning-top-p 0.95 \
--action-temperature 1.0 --action-top-p 0.99 \
--action-window-frames 120 --reasoning-history-rounds 15 \
--force-thinking-steps 120 --idle-reset-secs 3600
```
**Instant**: `--no-reasoning` generates actions only; `--action-window-frames 135` retains the latest 135 frames, including the current one.
```bash
bash start.sh --no-reasoning \
--action-temperature 1.0 --action-top-p 0.99 \
--action-window-frames 135 --idle-reset-secs 3600
```
The action window limits history frames. Use **Client’s `--max-steps`** for the total test length in either mode. See the [configuration appendix](docs/CONFIGURATION.md#startup-examples) for details.
### 1.3 Check Server
Open another WSL2 terminal and run:
```bash
curl --fail http://localhost:8000/health
```
**Ready when:** the response contains `"status": "ok"` and `"engine": "sash"`. Follow the [project quick start](../README.md#play) to run Client with Python on Windows and connect to this service.
For later sessions, start Server at **1.2**, then run Client. Press **Ctrl+C** to stop Server. A separate Linux host uses the same installer with its own paths; see [installation](docs/INSTALL.md) for environment setup, storage locations and manual steps.
## 2. Architecture
SASH maintains two timescales of context: **episodic history** holds observation–reasoning–action episodes spanning minutes, while **recent history** holds consecutive observation–action pairs. New reasoning triggers a sawtooth reset of recent history; episodic history is retained in a sliding window.
(a) SASH context window Episodic history + recent history
|
(b) History updates Accumulate → reason → compact
|
O = observation · R = reasoning · A = action · E = reasoning episode. Click either figure to open its original PDF.
Defaults retain up to **15 reasoning episodes** and **120 recent frames** (24 seconds at 5 Hz). See [architecture and implementation](docs/ARCHITECTURE.md) for complete update rules, action-only mode and kernels.
## 3. Find the Details
| Your task | Documentation |
|---|---|
| Install, prepare weights, start and verify | [Installation](docs/INSTALL.md) |
| Set up storage locations and check VRAM requirements | [Paths and storage](docs/INSTALL.md#storage) · [Environment and VRAM](docs/INSTALL.md#step-1) |
| Understand SASH, attention kernels and two-GPU execution | [Architecture and implementation](docs/ARCHITECTURE.md) |
| Tune modes, context and startup options | [Configuration](docs/CONFIGURATION.md) · [Command-line arguments](docs/CONFIGURATION.md#command-line) |
| Integrate your own client | [API requests, action parsing and session rules](docs/API.md) |
| Verify GPU kernels, warmup and regression tests | [Developer checks](docs/INSTALL.md#step-5) |
Use [Lumine2 Client](../client/README.md) for game interaction. For a custom integration, send the system prompt and current frame to `POST /v1/chat/completions`; Server maintains history and KV cache.
## 4. Source Map
Expand directories and module responsibilities
```text
server/
├── install.sh Environment and dependency setup
├── start.sh Model loading and server startup
├── sash/
│ ├── server.py HTTP endpoints and sessions
│ ├── engine.py Inference engine and model execution
│ ├── config.py Settings and defaults
│ ├── check_install.py Dependency, kernel and warmup checks
│ ├── assets/ Prompts and MTP draft vocabularies
│ ├── protocol/ Action protocol and episodic history
│ ├── kernels/ GPU kernels and two-GPU parallelism
│ └── diagnostics/ Inference diagnostics
├── tests/ Unit, GPU and server tests
└── docs/ Installation, configuration, architecture and API
```
See the full [source map](docs/ARCHITECTURE.md#source-map) and [execution stack](docs/ARCHITECTURE.md#execution) for module responsibilities and execution details.
## 5. Acknowledgments
Thanks to [FlashInfer](https://github.com/flashinfer-ai/flashinfer) and [NVIDIA CUTLASS / CuTeDSL](https://github.com/NVIDIA/cutlass) for the SM120 FP8 TMA FMHA implementation used here. Vendored locations and attribution are included at the end of [LICENSE](LICENSE).
## 6. License
Original Lumine 2 code and documentation are licensed under the [Apache License 2.0](../LICENSE).