# Models

> Import models from Hugging Face, choose a deployment, and see supported model families.

Source: https://pie-project.org/docs/serve/models  

Pie runs each model from a single `.zt` file that packs the converted weights, tokenizer, and metadata. `pie model import` builds that file once from a Hugging Face checkpoint.

> **Figure.** pie model import turns a Hugging Face checkpoint into one .zt file that the engine maps onto the device. Import once. The .zt file is checksummed and laid out so the engine can map it straight into memory.

## Import a model

```bash
pie model import Qwen/Qwen3.5-0.8B
```

As shown above, Pie downloads the checkpoint, converts its weights for your hardware backend, and writes the `.zt` file under `$PIE_HOME`. To serve that model, set `source = "Qwen/Qwen3.5-0.8B"` under `[model]` in `config.toml`.

| Command                              | Effect                                                         |
| ------------------------------------ | -------------------------------------------------------------- |
| `pie model list`                     | List imported models and their local deployments.              |
| `pie model info <name>`              | Print details and available deployments for one model.         |
| `pie model import <hf-id> --dry-run` | Show what would be imported without downloading or converting. |
| `pie model remove <name>`            | Delete an imported `.zt` file.                                 |
| `pie cache list` / `pie cache clear` | List or delete cached Hugging Face downloads.                  |

By default, `pie model import` keeps the downloaded Hugging Face shards in the cache. Pass `--consume-source` to delete each shard as soon as it is converted, which reduces peak disk usage when importing large models.

## Deployments

A **deployment** fixes three choices for a model: weight dtype, KV cache dtype, and how many GPUs the model is sharded across. Each model definition lists its supported deployments, and `pie model import` picks the first one that fits your device. To choose a deployment explicitly, pass `--deployment`:

```bash
pie model import Qwen/Qwen3.5-0.8B --deployment qwen35-d0.8b-u4g64-kv-bf16
```

Deployment names follow the pattern `{model}-{weights}-kv-{kv}`, plus `-tp{n}` when the model is sharded across `n` GPUs. Weight dtypes include `bf16`, `FP8`, `NVFP4`, and 4-bit integer groups (`u4g64` above). Pass `--deployment '?'` to list all deployments for a model.

## Speculative drafters

Some models provide a small draft head (such as an MTP head) that speeds up decoding. Attach it at import time with `--drafter <name>`. [Speculative decoding](https://pie-project.org/docs/invent/speculative-decoding) explains how draft verification works.

## Supported models

Every model is defined by a `.poem` file in the repository's [`models/`](https://github.com/pie-project/pie/tree/main/models) directory.

| Kind             | Families                                                                                                                                                                                                     |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Language         | DeepSeek V4 · Dots3 NOTE · Gemma 4 · GLM 4.5–4.7, GLM 5 · gpt-oss · Hy4 · Inkling · Kimi K3 · Llama 3.1, 3.3 · MiMo V2.6 · MiniMax M2.5, M2.7, M3 · Muse Glimmer, Spark · Nemotron 3 · Qwen 3, 3.5, 3.6, 3.8 |
| Vision input     | Gemma 4 · GLM 5.3 Flash · Qwen 3.5 and later                                                                                                                                                                 |
| Image generation | FLUX.2 \[klein] · HunyuanImage 3 · Z-Image Turbo                                                                                                                                                             |
| Video generation | Wan 2.2 · LTX 2.5 · MiniMax H3                                                                                                                                                                               |

{/* TODO: generate this table from models/*.poem at build time so it can't drift. */}

> **Go deeper:** [Models are programs too](https://pie-project.org/docs/invent/poem). Each model is a short Poem file. Edit one or add your own, and Pie serves it without recompiling the engine.
