ShiZhi: A Chinese Lightweight Large Language Model for Court View Generation
Paper
•
2510.09297
•
Published
中文 | 🤗huggingface | 🤖 modelscope | 📄 Arxiv | 💻 GitHub
ShiZhi (释之) is a lightweight large language model designed for Criminal Court View Generation (CVG) in Chinese. Its name comes from the historical figure Zhang Shizhi (张释之), and in Chinese, “释之” also conveys the meaning of “explaining” or “interpreting,” which is particularly suitable for generating the court view section in legal case documents.
This model is fine-tuned based on Qwen2-0.5B-Instruct, using a dataset of Chinese judicial documents from 1985 to 2021 that has been rigorously cleaned.
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
from swift.llm import (
PtEngine, RequestConfig, safe_snapshot_download, get_model_tokenizer, get_template, InferRequest
)
from swift.tuners import Swift
# 请调整下面几行
model = 'Qwen/Qwen2-0.5B-Instruct'
lora_checkpoint = safe_snapshot_download('TIM0927/ShiZhi') # 修改成checkpoint_dir
template_type = None # None: 使用对应模型默认的template_type
default_system = "你是一个法官,你需要根据裁判文书的事实部分,完成裁判文书的法院推理部分。" # None: 使用对应模型默认的default_system
fact = "经审理查明,..."
# 加载模型和对话模板
model, tokenizer = get_model_tokenizer(model)
model = Swift.from_pretrained(model, lora_checkpoint)
template_type = template_type or model.model_meta.template
template = get_template(template_type, tokenizer, default_system=default_system)
engine = PtEngine.from_model_template(model, template, max_batch_size=2)
request_config = RequestConfig(max_tokens=512, temperature=0)
infer_requests = [
InferRequest(messages=[{'role': 'user', 'content': f"事实描述:\n{fact}\n法院推理:\n"}]),
]
resp_list = engine.infer(infer_requests, request_config)
query0 = infer_requests[0].messages[0]['content']
print(f'response: {resp_list[0].choices[0].message.content}')
The training data is a dataset of Chinese judicial documents from 1985 to 2021 that has been rigorously cleaned, CCVG.
If you find this project helpful, please consider citing our paper:
@misc{hou2025shizhichineselightweightlarge,
title={ShiZhi: A Chinese Lightweight Large Language Model for Court View Generation},
author={Zhitian Hou and Kun Zeng},
year={2025},
eprint={2510.09297},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2510.09297},
}