Domux (Domux-Gemma-4-E2B-it) 是基于 Gemma-4-E2B-it 微调的语言模型。它将自然语言智能家居指令转换为结构化的竖线分隔槽位。训练结合了监督微调(SFT)与基于组相对策略优化(GRPO)的强化学习和自定义奖励函数。
📦 代码、训练脚本、评测套件、完整技术报告与数据集 均在 GitHub 仓库:github.com/iflytek/domux。
✨ 核心特性
- 快速响应 — 针对边缘设备和服务器的低延迟推理进行优化。
- 结构化槽位输出 — 将自由格式指令解析为固定的 7 字段竖线分隔格式。
- 高准确率 — 98.37% 结果准确率,100% 格式合规性,超越体量大得多的模型。
- 轻量级基座 — 构建于紧凑的 Gemma-4-E2B-it 之上,适合设备端和边缘部署。
- 多动作支持 — 处理映射到多个槽位行的复合指令。
- 跨设备泛化 — 处理每个类别下的任意设备名,而非固定白名单。
🎬 输出格式
模型输出包含 7 个字段的竖线分隔槽位。使用 * 表示未指定或无关字段。
action|device|attribute|value|unit|room|floor
基础示例
| 输入 | 输出 |
|---|---|
| Turn on the living room light(打开客厅的灯) | turnOn|Light|*|*|*|Living Room|* |
| Set bedroom AC to 22 degrees(将卧室空调设为 22 度) | set|AC|temperature|22|Celsius|Bedroom|* |
| Close the curtains 20 percent(关闭窗帘 20%) | adjustDown|Curtain|openness|20|Percent|*|* |
复杂多属性指令
输入:
Turn on the Master Light in the Master Bedroom on the Second Floor,
set brightness to 80%, color temperature to 4000K, color to Blue, and mode to Reading.
(打开二楼主卧的主灯,将亮度设为 80%,色温设为 4000K,颜色设为蓝色,模式设为阅读)
输出:
turnOn|Light|*|*|*|Master Bedroom|Second Floor
set|Light|brightness|80|Percent|Master Bedroom|Second Floor
set|Light|colorTemperature|4000|Kelvin|Master Bedroom|Second Floor
set|Light|color|Blue|*|Master Bedroom|Second Floor
set|Light|mode|Reading|*|Master Bedroom|Second Floor
完整规范见:输出格式文档。
🏠 支持的控制能力
Domux 不依赖固定的设备白名单 —— 模型通过语义理解处理各类设备名称。
| 设备类型 | 命名示例 | 可控属性 | 取值范围 |
|---|---|---|---|
灯具 Light |
Light、Strip Light、Spot Light、Desk Lamp | brightness 亮度 / color 颜色 / colorTemperature 色温 / mode 模式 |
0–100% / Blue、Red、Green… / 3000–6500 K / Reading、Romance、Soft… |
空调 AC |
AC、AC 1 | temperature 温度 / mode 模式 / windSpeed 风速 |
16–30 °C / Cool、Heat、Dry、Fan、Auto / Low、Medium、High |
窗饰 Curtain / Blind |
Curtain、Blind、Sheer Curtain | position 开合位置 |
0–100% |
| 场景模式 | Romantic Mode、Party Mode、Sleeping Mode | — | — |
控制动作:turnOn、turnOff、set、adjustUp、adjustDown、activate、deactivate、pause。
空间定位:房间(Living Room、Bedroom、Kitchen、Majlis、Prayer Room 等)与楼层(Ground Floor、Upstairs、Downstairs 等),支持编号变体。
📊 Benchmark
在涵盖 4 个维度(单意图、多意图、属性省略、非标准命名)的 4,057 个样本的综合测试集上进行评估,与 11 个主流模型进行基准对比,包括 Qwen3.5 系列(2B-27B)、Gemma 4 系列以及领先的闭源 API(DeepSeek-V4、Claude Haiku 4.5、Gemini 3.5 Flash)。
结果准确率达到 98.37%,格式合规性 100%。
📄 完整技术报告与 Benchmark 图表:GitHub 仓库。
测试集与评测脚本已在 eval/ 开源,方便你复现结果或评估自己的模型。
🚀 快速开始
硬件
模型以 BF16 精度运行,单卡部署需要 20GB 及以上显存。
下载
# 方式 1:ModelScope(推荐)
pip install modelscope
python -c "from modelscope import snapshot_download; snapshot_download('iflytek/domux', cache_dir='./models')"
# 方式 2:Hugging Face
git lfs install
git clone https://huggingface.co/iFlytekOpenSource/Domux
使用 vLLM 推理
pip install "vllm==0.22.0"
from vllm import LLM, SamplingParams
# 指向你下载的模型目录
llm = LLM(model="models/iflytek/domux", dtype="bfloat16")
sampling = SamplingParams(temperature=0.0, max_tokens=256)
prompt = "Turn on the Master Light in the Master Bedroom on the Second Floor, set brightness to 80%, color temperature to 4000K, color to Blue, and mode to Reading."
output = llm.chat([{"role": "user", "content": prompt}], sampling)
print(output[0].outputs[0].text)
# 输出:
# turnOn|Light|*|*|*|Master Bedroom|Second Floor
# set|Light|brightness|80|Percent|Master Bedroom|Second Floor
# set|Light|colorTemperature|4000|Kelvin|Master Bedroom|Second Floor
# set|Light|color|Blue|*|Master Bedroom|Second Floor
# set|Light|mode|Reading|*|Master Bedroom|Second Floor
部署为 OpenAI 兼容 API
# vLLM
python -m vllm.entrypoints.openai.api_server \
--model models/iflytek/domux \
--served-model-name domux \
--host 0.0.0.0 --port 8000 \
--dtype bfloat16 --max-model-len 2048 --gpu-memory-utilization 0.9
# SGLang
pip install "sglang[all]==0.5.12"
python -m sglang.launch_server \
--model-path models/iflytek/domux \
--host 0.0.0.0 --port 8000 \
--dtype bfloat16 --context-length 2048
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="domux",
messages=[{"role": "user", "content": "Turn on the bedroom light and set brightness to 60%"}],
temperature=0.0,
)
print(response.choices[0].message.content)
📄 许可证
模型权重是 Google Gemma 的衍生产物,其使用受 Gemma Terms of Use 和 Gemma Prohibited Use Policy 约束。"Gemma" 是 Google LLC 的商标。
仓库内随附的源代码(训练脚本、奖励插件、评测工具)以 Apache-2.0 协议授权,详见 GitHub 仓库。
🙏 致谢
- 基座模型:Gemma
- 训练框架:ModelScope-Swift
- 实验跟踪:SwanLab
引用
@misc{domux2026,
title = {Domux: A Lightweight Low-Latency Command Understanding Model for Smart-Home Control},
author = {iFLYTEK CO., LTD.},
year = {2026},
url = {https://github.com/iflytek/domux}
}