| --- |
| license: apache-2.0 |
| language: |
| - en |
| base_model: |
| - tomg-group-umd/DynaGuard-4B |
| base_model_relation: quantized |
| quantized_by: Atomic-Germ |
| pipeline_tag: text-generation |
| tags: |
| - guardrail |
| - safety |
| - moderation |
| - dynaguard |
| - umd |
| - qwen3 |
| - llm |
| - fastflowlm |
| - q4nx |
| - npu2 |
| --- |
| # *IF YOU USE COMMUNITY QWEN MODELS DO NOT UPGRADE TO FLM v1.0.2+* |
|
|
| # DynaGuard-4B - Q4NX for FastFlowLM (AMD Ryzen AI XDNA2) |
|
|
| A safety-focused Qwen3-4B fine-tune, converted to Q4NX for FastFlowLM. |
|
|
| ## What is Q4NX? |
|
|
| Q4NX is FastFlowLM's native packed-quantization format - a rearranged Q4_1 |
| layout tuned for the NPU matrix engine's tile sizes and memory access |
| patterns. It is **not** a GGUF file and it does not run on llama.cpp or |
| Ollama; it is meant exclusively for the [FastFlowLM](https://fastflowlm.com) |
| engine on AMD Ryzen AI NPUs. |
| |
| ## Requirements |
| |
| - FastFlowLM >= 0.9.45 (`flm` CLI) |
| - AMD Ryzen AI processor with **XDNA2 (NPU2)** - Strix Point / Ryzen AI 300 |
| series or later |
| - Linux with the XRT NPU stack installed |
| - ~16 GB of unified system memory (Q4NX weights + activations + KV cache) |
| |
| ## FLM Bench |
| |
| Tested on an AMD Ryzen AI 340 Framework 13 laptop. |
| |
| | Context Length | TTFT (s) (mean ± std) | Prefill Speed (tok/s) (mean ± std) | Decoding Speed (tok/s) (mean ± std) | |
| |---:|---:|---:|---:| |
| | 1k | 2.681 ± 0.080 | 364.63 ± 10.92 | 13.20 ± 0.01 | |
| | 2k | 4.435 ± 0.124 | 438.85 ± 12.27 | 12.11 ± 0.38 | |
| | 4k | 8.306 ± 0.082 | 467.13 ± 4.65 | 11.27 ± 0.22 | |
| | 8k | 17.121 ± 0.001| 452.58 ± 0.02 | 9.83 ± 0.00 | |
| | 16k | 41.227 ± 0.001| 375.64 ± 0.00 | 7.58 ± 0.00 | |
| | 32k | 115.272 ± 0.024| 268.61 ± 0.06 | 5.22 ± 0.00 | |
| --- |
| |
| |
| ## Files |
| |
| | File | Purpose | |
| |---|---| |
| | model.q4nx | Quantized Q4NX weights | |
| | config.json | FastFlowLM model configuration | |
| | tokenizer.json | Tokenizer | |
| | tokenizer_config.json | Special tokens and chat template | |
| | chat_template.jinja | Chat template (optional) | |
| | flm-add.py | Installer script - registers this model with FastFlowLM | |
| |
| |
| ## Install and run |
| |
| This repository works with `flm-add`, a small installer that copies the model |
| into the FastFlowLM user directory and registers the tag. It never |
| modifies the system FastFlowLM install. |
| |
| `pip install flm-add` or `uv tool install flm-add` |
| |
| ```bash |
| uv tool install flm-add |
| flm-add Atomic-Germ/DynaGuard-4B-NPU2 --tag dynaguard:4b --family qwen3 |
| FLM_CONFIG_PATH="$HOME/.config/flm/model_list.json" FLM_XCLBIN_PATH="$HOME/.config/flm" flm run dynaguard:4b |
| ``` |
| |
| |
| ## Kernels |
| |
| FastFlowLM's NPU kernels (xclbins) are closed source and are not shipped in |
| this repository. `flm-add` links the kernels of the official **`qwen3:4b`** |
| model (`Qwen3-9B-NPU2`), because this model shares the same engine family |
| (`qwen3`) and architecture. |
| |
| ## Model |
| |
| - Registry tag: `dynaguard:4b` |
| - Engine family: `qwen3` |
| - Kernel source: Qwen3-4B-NPU2 |
| - Context length: 262,144 tokens (from config) |
| - `model.q4nx` size: 3.3 GB |
| - Base model: [Qwen/Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) |
| - License: apache-2.0 |
| |
| |
| |
| ## Original model card |
| |
| See the upstream model card for training details, benchmarks, and upstream |
| usage. This repository only contains the Q4NX conversion for FastFlowLM. |
| - Upstream card: [tomg-group-umd/DynaGuard-4B(https://huggingface.co/tomg-group-umd/DynaGuard-4B) |