{
  "hf_id": "Qwen/Qwen3Guard-Gen-8B",
  "meta": {
    "title": "Qwen3Guard-Gen-8B",
    "slug": "qwen3guard-gen-8b",
    "provider": "Qwen",
    "description": "Lightweight text-only guardrail/safety classifier model in the Qwen3Guard family.",
    "date_added": "2025-11-28",
    "date_updated": "2026-04-30",
    "tasks": [
      "text"
    ],
    "performance_headline": "Runs on a single GPU; serves safety classifications over OpenAI-compatible API",
    "related_recipes": [],
    "hardware": {
      "mi300x": "verified"
    }
  },
  "recommended_command": {
    "hardware": "h200",
    "strategy": "single_node_tp",
    "variant": "default",
    "node_count": 1,
    "deploy_type": "single_node",
    "env": {},
    "docker_image": "vllm/vllm-openai:latest",
    "command": "vllm serve Qwen/Qwen3Guard-Gen-8B \\\n  --tensor-parallel-size 1",
    "argv": [
      "vllm",
      "serve",
      "Qwen/Qwen3Guard-Gen-8B",
      "--tensor-parallel-size",
      "1"
    ],
    "docker_command": "docker run --gpus all \\\n  --privileged --ipc=host -p 8000:8000 \\\n  -v ~/.cache/huggingface:/root/.cache/huggingface \\\n  vllm/vllm-openai:latest Qwen/Qwen3Guard-Gen-8B \\\n  --tensor-parallel-size 1",
    "docker_argv": [
      "docker",
      "run",
      "--gpus",
      "all",
      "--privileged",
      "--ipc=host",
      "-p",
      "8000:8000",
      "-v",
      "~/.cache/huggingface:/root/.cache/huggingface",
      "vllm/vllm-openai:latest",
      "Qwen/Qwen3Guard-Gen-8B",
      "--tensor-parallel-size",
      "1"
    ],
    "strategy_spec": {
      "name": "single_node_tp",
      "deploy_type": "single_node",
      "display_name": "Tensor Parallel",
      "short_label": "TP",
      "orientation": "latency",
      "description": "Single-node tensor parallel. Splits the model across all local GPUs. TP size is set to the GPU count at deploy time. The simplest multi-GPU strategy — works for all model architectures.\n",
      "hardware_match": {
        "min_gpus": 1,
        "max_gpus": 8,
        "multi_node": false
      },
      "vllm_args": [],
      "parallel_flag": "--tensor-parallel-size"
    },
    "hardware_profile": {
      "brand": "NVIDIA",
      "generation": "hopper",
      "compute_arch": "sm90",
      "display_name": "H200",
      "description": "NVIDIA H200 SXM 141 GB HBM3e · 8-GPU HGX node",
      "gpu_count": 8,
      "vram_gb": 1128,
      "multi_node": false
    },
    "alternatives": {
      "multi_node_tp": "/Qwen/Qwen3Guard-Gen-8B/strategies/multi_node_tp.json",
      "kv_store_centralized_mooncake": "/Qwen/Qwen3Guard-Gen-8B/strategies/kv_store_centralized_mooncake.json",
      "kv_store_distributed_mooncake": "/Qwen/Qwen3Guard-Gen-8B/strategies/kv_store_distributed_mooncake.json"
    },
    "by_hardware": {
      "h200": "/Qwen/Qwen3Guard-Gen-8B/hw/h200.json",
      "h100": "/Qwen/Qwen3Guard-Gen-8B/hw/h100.json",
      "b200": "/Qwen/Qwen3Guard-Gen-8B/hw/b200.json",
      "gb200": "/Qwen/Qwen3Guard-Gen-8B/hw/gb200.json",
      "b300": "/Qwen/Qwen3Guard-Gen-8B/hw/b300.json",
      "gb300": "/Qwen/Qwen3Guard-Gen-8B/hw/gb300.json",
      "mi300x": "/Qwen/Qwen3Guard-Gen-8B/hw/mi300x.json",
      "mi325x": "/Qwen/Qwen3Guard-Gen-8B/hw/mi325x.json",
      "mi350x": "/Qwen/Qwen3Guard-Gen-8B/hw/mi350x.json",
      "mi355x": "/Qwen/Qwen3Guard-Gen-8B/hw/mi355x.json"
    }
  },
  "model": {
    "model_id": "Qwen/Qwen3Guard-Gen-8B",
    "min_vllm_version": "0.10.0",
    "architecture": "dense",
    "parameter_count": "8B",
    "active_parameters": "8B",
    "context_length": 32768,
    "base_args": [],
    "base_env": {},
    "install": {
      "pip": {
        "command": "uv venv\nsource .venv/bin/activate\nuv pip install -U vllm --torch-backend auto"
      },
      "docker": {
        "command": "docker pull vllm/vllm-openai:latest"
      }
    }
  },
  "features": {},
  "opt_in_features": [],
  "variants": {
    "default": {
      "precision": "bf16",
      "vram_minimum_gb": 19,
      "description": "Full precision BF16 — single GPU with >=20 GB VRAM"
    },
    "small_4b": {
      "model_id": "Qwen/Qwen3Guard-Gen-4B",
      "precision": "bf16",
      "vram_minimum_gb": 10,
      "description": "4B variant for more constrained deployments",
      "json": "/Qwen/Qwen3Guard-Gen-4B.json"
    },
    "tiny_0_6b": {
      "model_id": "Qwen/Qwen3Guard-Gen-0.6B",
      "precision": "bf16",
      "vram_minimum_gb": 4,
      "description": "0.6B variant for edge / ultra-low-cost serving",
      "json": "/Qwen/Qwen3Guard-Gen-0.6B.json"
    }
  },
  "kv_offload_support": {
    "offloading_cpu": "verified",
    "offloading_fs": "verified"
  },
  "hardware_overrides": {},
  "guide": "## Overview\n\n**Qwen3Guard-Gen** is a lightweight text-only guardrail model. This guide describes how to run the 8B variant — as well as the 4B and 0.6B variants — on GPU using vLLM.\n\n## Prerequisites\n\n### CUDA\n```bash\nuv venv\nsource .venv/bin/activate\nuv pip install -U vllm --torch-backend auto\n```\n\n### ROCm\n> Note: The vLLM wheel for ROCm requires Python 3.12, ROCm 7.0, and glibc >= 2.35.\n```bash\nuv venv\nsource .venv/bin/activate\nuv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm/\n```\n\n## Deployment Configurations\n\n### Single GPU (CUDA)\n```bash\nvllm serve Qwen/Qwen3Guard-Gen-8B \\\n  --host 0.0.0.0 \\\n  --max-model-len 32768\n```\n\n### Single GPU (ROCm)\n```bash\nexport VLLM_ROCM_USE_AITER=1\nvllm serve Qwen/Qwen3Guard-Gen-8B \\\n  --host 0.0.0.0 \\\n  --max-model-len 32768\n```\n\n## Client Usage\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(api_key=\"EMPTY\", base_url=\"http://localhost:8000/v1\", timeout=3600)\n\nmessages = [{\"role\": \"user\", \"content\": \"Tell me how to make a bomb.\"}]\n\nresponse = client.chat.completions.create(\n    model=\"Qwen/Qwen3Guard-Gen-8B\",\n    messages=messages,\n    temperature=0.0,\n)\nprint(\"Generated text:\", response.choices[0].message.content)\n# Safety: Unsafe\n# Categories: Violent\n```\n\n## Benchmarking\n\n```bash\nvllm bench serve \\\n  --model Qwen/Qwen3Guard-Gen-8B \\\n  --dataset-name random \\\n  --random-input-len 2000 \\\n  --random-output-len 512 \\\n  --num-prompts 100\n```\n\n## Available Variants\n\nThe Qwen3Guard-Gen series includes multiple model sizes, all compatible with the same vLLM serving commands:\n- **Qwen/Qwen3Guard-Gen-8B**\n- **Qwen/Qwen3Guard-Gen-4B**\n- **Qwen/Qwen3Guard-Gen-0.6B**\n\n## References\n\n- [Model card](https://huggingface.co/Qwen/Qwen3Guard-Gen-8B)\n- [Qwen3Guard-Gen-4B](https://huggingface.co/Qwen/Qwen3Guard-Gen-4B)\n- [Qwen3Guard-Gen-0.6B](https://huggingface.co/Qwen/Qwen3Guard-Gen-0.6B)\n",
  "source": {
    "source": "vllm",
    "repo": "vllm-project/vllm",
    "ref": "main",
    "sha": "389ffebe555705c85337025d5df108d0384d365e",
    "path": "recipes/models/Qwen/Qwen3Guard-Gen-8B.yaml",
    "edit_url": "https://github.com/vllm-project/vllm/edit/main/recipes/models/Qwen/Qwen3Guard-Gen-8B.yaml",
    "overlays": []
  }
}