模型简介
模型特点
模型能力
使用案例
🚀 智写作-dsr1-14b
智写作-dsr1-14b是基于DeepSeek-R1-Distill-Qwen-14B微调的模型,专门针对创意写作能力进行了优化。通过多项基准测试评估,该模型在创意写作方面的表现有显著提升。
🚀 快速开始
本地运行方法
智写作-dsr1-14b可以部署在多种硬件配置上,包括80GB内存的GPU、单张H20/A800/H800或两张RTX 4090。此外,INT4量化版本智写作-dsr1-14b-gptq-int4可以部署在单张RTX 4090上。
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig
MODEL_NAME = "Zhihu-ai/Zhi-writing-dsr1-14b"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
# use bf16
# model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto", trust_remote_code=True, bf16=True).eval()
# use fp16
# model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto", trust_remote_code=True, fp16=True).eval()
# use cpu only
# model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="cpu", trust_remote_code=True).eval()
# use auto mode, automatically select precision based on the device.
model = AutoModelForCausalLM.from_pretrained(
MODEL_NAME,
device_map="auto",
trust_remote_code=True
).eval()
# Specify hyperparameters for generation. But if you use transformers>=4.32.0, there is no need to do this.
# model.generation_config = GenerationConfig.from_pretrained(MODEL_NAME, trust_remote_code=True)
generate_configs = {
"temperature": 0.6,
"do_sample": True,
"top_p": 0.95,
"max_new_tokens": 4096
}
prompt = "请你以鲁迅的口吻,写一篇介绍西湖醋鱼的文章"
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
**generate_configs
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
ZhiLight
你可以使用 ZhiLight 轻松启动服务。
docker run -it --net=host --gpus='"device=0"' -v /path/to/model:/mnt/models --entrypoints="" ghcr.io/zhihu/zhilight/zhilight:0.4.17-cu124 python -m zhilight.server.openai.entrypoints.api_server --model-path /mnt/models --port 8000 --enable-reasoning --reasoning-parser deepseek-r1 --served-model-name Zhi-writing-dsr1-14b
curl http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Zhi-writing-dsr1-14b",
"prompt": "请你以鲁迅的口吻,写一篇介绍西湖醋鱼的文章",
"max_tokens": 4096,
"temperature": 0.6,
"top_p": 0.95
}'
vllm
例如,你可以使用 vLLM 轻松启动服务。
# install vllm
pip install vllm>=0.6.4.post1
# huggingface model id
vllm serve Zhihu-ai/Zhi-writing-dsr1-14b --served-model-name Zhi-writing-dsr1-14b --port 8000
# local path
vllm serve /path/to/model --served-model-name Zhi-writing-dsr1-14b --port 8000
curl http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Zhi-writing-dsr1-14b",
"prompt": "请你以鲁迅的口吻,写一篇介绍西湖醋鱼的文章",
"max_tokens": 4096,
"temperature": 0.6,
"top_p": 0.95
}'
SGLang
你也可以使用 SGLang 轻松启动服务。
# install SGLang
pip install "sglang[all]>=0.4.5" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python
# huggingface model id
python -m sglang.launch_server --model-path Zhihu-ai/Zhi-writing-dsr1-14b --served-model-name Zhi-writing-dsr1-14b --port 8000
# local path
python -m sglang.launch_server --model-path /path/to/model --served-model-name Zhi-writing-dsr1-14b --port 8000
# send request
curl http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Zhi-writing-dsr1-14b",
"prompt": "请你以鲁迅的口吻,写一篇介绍西湖醋鱼的文章",
"max_tokens": 4096,
"temperature": 0.6,
"top_p": 0.95
}'
ollama
你可以通过 此链接 下载ollama。
- 量化:Q4_K_M
ollama run zhihu/zhi-writing-dsr1-14b
- bf16
ollama run zhihu/zhi-writing-dsr1-14b:bf16
✨ 主要特性
智写作-dsr1-14b是基于DeepSeek-R1-Distill-Qwen-14B进行微调的模型,专门针对创意写作能力进行了优化。在多个基准测试中,该模型的创意写作性能有显著提升:
- 在 大语言模型创意故事写作基准测试 中,该模型取得了 8.33 分的成绩,而其基础模型的得分仅为 7.8 分。
- 在 写作基准测试 评估框架中,该模型获得了 8.46 分,相比DeepSeek-R1-Distill-Qwen-14B的 7.93 分有所提高。
- 在AlpacaEval数据集上使用GPT-4o进行评估时,与基础模型相比,该模型的胜率达到了 82.6%。
在通用能力方面,评估显示该模型在知识和推理任务(CMMLU、MMLU-Pro)中有 2% - 5% 的适度提升,在数学推理方面也有令人鼓舞的进展,如在 AIME-2024、AIME-2025和GSM8K 等基准测试中表现良好。结果表明,与DeepSeek-R1-Distill-Qwen-14B相比,该模型在创意写作、知识/推理和数学任务方面保持了平衡的性能,这些特点使其可能适用于一系列通用应用。
🔧 技术细节
训练数据
该模型的训练语料主要包含三个来源:经过严格筛选的开源数据集、思维链推理语料库以及从知乎精心整理的问答对。为了实现最佳的领域覆盖,我们精心平衡了各种数据集的分布,包括 Dolphin-r1、Congliu/中文-DeepSeek-R1-蒸馏数据-110k、OpenThoughts-114k、Light-R1-SFTData 和 Light-R1-DPOData,以及来自知乎的高质量内容。所有数据集都通过我们的奖励模型(RM)过滤管道进行了全面的质量保证。
训练方法
- 监督微调(SFT):我们采用课程学习策略进行监督微调。这种系统的方法在纳入不同领域数据的同时,系统地增强了创意写作能力,以保持核心竞争力并减轻灾难性遗忘。
- 直接偏好优化(DPO):对于编辑距离较小的场景,我们使用Step-DPO(arxiv:2406.18629)有选择地惩罚错误的标记,同时在损失函数中纳入DPOP(arXiv:2402.13228)提出的正约束。
💡 使用建议
在使用智写作-dsr1-14b时,包括进行基准测试,我们建议遵循以下配置以获得预期的性能:
- 将温度设置在0.5 - 0.7的范围内(建议设置为0.6),以防止出现无休止的重复或输出不连贯的情况。
- 评估模型性能时,建议进行多次测试并取结果的平均值。(数学任务使用
n = 16
和max_tokens = 32768
,其他任务使用n = 2
) - 为了确保模型像DeepSeek-R1系列模型一样进行深入推理,建议在每次输出开始时强制模型以 "<think>\n" 开头。
📄 许可证
本项目采用Apache-2.0许可证。
📚 详细文档
引用方式
@misc{Zhi-writing-dsr1-14b,
title={Zhi-writing-dsr1-14b: Curriculum Reinforcement and Direct Preference Optimization for Robust Creative Writing in LLMs},
author={Jiewu Wang, Xu Chen, Wenyuan Su, Chao Huang, Hongkui Gao, Lin Feng, Shan Wang, Lu Xu, Penghe Liu, Zebin Ou},
year={2025},
eprint={},
archivePrefix={},
url={https://huggingface.co/Zhihu-ai/Zhi-writing-dsr1-14b},
}
联系我们
如果您有任何问题,请提出问题或通过 ai@zhihu.com 联系我们。
📦 模型信息
属性 | 详情 |
---|---|
模型类型 | 基于DeepSeek-R1-Distill-Qwen-14B微调的模型 |
训练数据 | Congliu/中文-DeepSeek-R1-蒸馏数据-110k、cognitivecomputations/dolphin-r1、open-thoughts/OpenThoughts-114k、qihoo360/Light-R1-SFTData、qihoo360/Light-R1-DPOData |
基础模型 | Zhihu-ai/Zhi-writing-dsr1-14b |
标签 | qwen2 |
库名称 | transformers |



