> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m-star.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Qwen3.5 and Qwen3.8

> Choose a dense Qwen3.5 or Qwen3.8 checkpoint and send an image question.

The dense Qwen3.5 and Qwen3.8 checkpoints return text from text, images or video. For a first chat request on one GPU, use `qwen3_5_0.8b`. For a larger model, the 27B defaults shard over four GPUs.

## Install and start

The default configs warm the vision path before accepting requests. If you send video, install FFmpeg’s shared libraries so TorchCodec can decode it.

### `qwen3_5_0.8b`

Text, image, video → text. The default `qwen3_5_0.8b.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3.5-0.8B) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[bagel]"
mstar serve qwen3_5_0.8b
```

[Send the request](#describe-image).

### `qwen3_5_2b`

Text, image, video → text. The default `qwen3_5_2b.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3.5-2B) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[bagel]"
mstar serve qwen3_5_2b
```

[Send the request](#describe-image).

### `qwen3_5_4b`

Text, image, video → text. The default `qwen3_5_4b.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3.5-4B) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[bagel]"
mstar serve qwen3_5_4b
```

[Send the request](#describe-image).

### `qwen3_5_9b`

Text, image, video → text. The default `qwen3_5_9b.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3.5-9B) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[bagel]"
mstar serve qwen3_5_9b
```

[Send the request](#describe-image).

### `qwen3_5_27b`

Text, image, video → text. The default `qwen3_5_27b_tp4.yaml` uses 4 GPUs. The [weights](https://huggingface.co/Qwen/Qwen3.5-27B) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[bagel]"
mstar serve qwen3_5_27b
```

[Send the request](#describe-image).

### `qwen3_8_27b`

Text, image, video → text. The default `qwen3_8_27b_tp4.yaml` uses 4 GPUs. The [weights](https://huggingface.co/Qwen/Qwen3.8-27B) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[bagel]"
mstar serve qwen3_8_27b
```

[Send the request](#describe-image).

## Send a request

Run either client example in a second terminal after `/health` returns 200.

### Ask about an image

Save an image as `scene.png`. The same request works with each checkpoint above.

**Python SDK**

```python theme={null}
from mstar import MStarClient

client = MStarClient("http://localhost:8000")
print(client.generate(
    text='Describe this image in one sentence.',
    images='scene.png',
    input_modalities=('image', 'text'),
    output_modalities=('text',),
    enable_thinking=False,
    max_output_tokens=128,
).text)
```

**curl**

```bash theme={null}
curl -fsS http://localhost:8000/generate \
  --form-string 'text=Describe this image in one sentence.' \
  -F files=@scene.png \
  --form-string input_modalities=image,text \
  --form-string output_modalities=text \
  --form-string streaming=false \
  --form-string 'model_kwargs={"enable_thinking":false,"max_output_tokens":128}' \
  | python3 -c '
import base64, json, sys

outputs = json.load(sys.stdin)["outputs"]
text = b"".join(base64.b64decode(chunk["data"]) for chunk in outputs["text"])
print(text.decode())
'
```

## Deployment configs

| File | GPUs | Parallelism | When to use |
| - | - | - | - |
| `configs/qwen3_5_0.8b.yaml`, `_2b`, `_4b`, `_9b` | 1 | none | The default for each size. |
| `configs/qwen3_5_9b_dp2.yaml` | 2 | a replica per GPU | Video traffic on two GPUs. Each replica runs its own vision encoder. |
| `configs/qwen3_5_9b_tp2.yaml` | 2 | TP2 | One replica across two GPUs. The vision encoder runs on one rank while the other waits for it. |
| `configs/qwen3_5_27b_tp4.yaml` | 4 | TP4 | The default for `qwen3_5_27b`, which has no one-GPU config. |
| `configs/qwen3_8_27b_tp4.yaml` | 4 | TP4 | The default for `qwen3_8_27b`. |

All of them set `max_seq_len: 32768`. Under DP2 the conductor sends each request to the cheaper replica, judged by live requests and the prompt's predicted prefix hit.

To use an alternative, pass `--config configs/<file>` after the launcher name. From a wheel installation, [copy the shipped YAML](https://docs.m-star.org/serving.md#custom-configs) and pass its local path.

## Settings and defaults

Request knobs go in `model_kwargs` on `/generate` and in `extra_body` on the OpenAI route. `temperature`, `top_p`, `max_tokens` and `seed` are the standard OpenAI fields.

| Knob | Default | Effect |
| - | - | - |
| `enable_thinking` | `true` | `false` writes an empty, closed `<think>` block, which turns reasoning off. `chat_template_kwargs.enable_thinking` works too. |
| `top_k`, `min_p` | the checkpoint's | A `min_p` above 0 is refused unless the checkpoint's `generation_config.json` sets one. |
| `repetition_penalty`, `penalize_prompt` | the checkpoint's, `true` | With `penalize_prompt: false` the penalty counts generated tokens only. |
| `max_output_tokens` | 2048 | At most the checkpoint's `max_position_embeddings`. |
| `return_token_ids` | `false` | Adds each text chunk's sampled ids to its `metadata` on `/generate`, stop tokens included. |
| `return_logprobs` | `false` | Adds each token's log-prob to its chunk's `metadata`. Needs `resources: sampler: enable_logprobs: true` in the config. |
| `logprobs_mode` | `raw` | `processed` scores the token under the distribution it was drawn from. Needs `enable_processed_logprobs: true` as well. |

Sampling defaults come from the checkpoint's `generation_config.json`, under whatever the request sets.

Deployment keys in the YAML:

| Key | Default | Effect |
| - | - | - |
| `resources.kv_cache.max_num_pages` | 2048 | KV pool size in 128-token pages. Raise it for many concurrent long videos: a 1 to 3 minute video is a prefill of about 11k to 12k tokens. |
| `resources.gdn_state.max_slots` | 256; 129 in the shipped configs | DeltaNet state slots: the concurrency you serve plus one for the sink. |
| `resources.gdn_state.state_dtype` | the checkpoint's `mamba_ssm_dtype` | `bfloat16` halves state traffic at some precision and needs FlashInfer's bf16 decode kernel. |
| `resources.gdn_state.prefix_slots` | 0; 128 in the one-GPU and DP2 configs | DeltaNet state snapshots kept for the prefix cache, at one rank only. |
| `prefill_token_buckets` | | The captured prefill ladder per walk ([Config reference](https://docs.m-star.org/reference/config.md#prefill-token-buckets)). Each bucket adds captures and startup time. |
| `resources.lora` | | Per-request LoRA adapters; see [LoRA](https://docs.m-star.org/models/lora.md). |

`MSTAR_MAX_VIDEO_PIXELS` caps the pixels a request's videos decode to. Decoding runs in the API server before the request is queued, and a video over the cap is a 400.

## Limits

* Qwen3.5 MoE checkpoints are not supported.
* A video request without torchcodec and FFmpeg's shared libraries is a 400; there is no fallback decoder.
* The MTP head is not loaded.
* Qwen3.8-27B's chat template options `reasoning_effort` and `preserve_thinking` are not forwarded. Every request gets the template's defaults, and one that sends either is logged as ignoring it.
* Prefix caching is off when the LLM spans more than one rank, as in the TP2 and TP4 configs.
* The chat route returns one choice of plain text. It refuses tool calls, `n` above 1, stop sequences, OpenAI `logprobs`, `logit_bias`, presence and frequency penalties, and a `response_format` other than text.
* An encoder step past the vision encoder's largest captured bucket (16384 patches, such as a long video at ordinary resolution) runs without the graph. The request still succeeds, with more launch overhead.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.