File size: 5,723 Bytes
018f7f7
 
9b4140f
 
 
 
 
 
 
 
 
 
 
 
018f7f7
 
9b4140f
b7ec8e5
9b4140f
018f7f7
9b4140f
018f7f7
9b4140f
018f7f7
9b4140f
018f7f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9b4140f
 
 
 
018f7f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b7ec8e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
018f7f7
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
base_model: Qwen2-0.5B-Instruct
library_name: transformers
license: apache-2.0
pipeline_tag: text-generation
language: zh
datasets:
  - TIM0927/CCVG
tags:
  - peft
  - lora
  - chinese
  - legal
  - court-view-generation
---

# ShiZhi: A Chinese Lightweight Large Language Model for Court View Generation

This repository contains **ShiZhi (\u91ca\u4e4b)**, a lightweight large language model designed for Criminal Court View Generation (CVG) in Chinese, as presented in the paper [ShiZhi: A Chinese Lightweight Large Language Model for Court View Generation](https://huggingface.co/papers/2510.09297).

Code: [https://github.com/ZhitianHou/ShiZhi](https://github.com/ZhitianHou/ShiZhi)

[中文](README_zh.md) | 🤖[modelscope](https://modelscope.cn/models/freshman8888/LegalReasoningModel)

Its name comes from the historical figure Zhang Shizhi (\u5f20\u91ca\u4e4b), and in Chinese, \u201c\u91ca\u4e4b\u201d also conveys the meaning of \u201cexplaining\u201d or \u201cinterpreting,\u201d which is particularly suitable for generating the court view section in legal case documents.

## Model Details

### Model Description

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.

- **Language(s) (NLP):** Chinese/zh
- **Finetuned from model:** Qwen2-0.5B-Instruct

## How to Get Started with the Model

```python
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"事实描述:
{fact}
法院推理:
"}]),
]
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}')
```

## Training Details

### Training Data

The training data is a dataset of Chinese judicial documents from 1985 to 2021 that has been rigorously cleaned, [CCVG](https://huggingface.co/datasets/TIM0927/CCVG).

### Framework versions

- PEFT 0.12.0

## Citation

If you find this project helpful, please consider citing our paper:
```bibtet
@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}, 
}
```

## Model Disclaimer

1. **Usage Restriction**: This model is developed and provided **exclusively for academic research purposes** , aiming to offer tool support for academic exploration, technical verification, and theoretical research in relevant fields. The use of this model for any commercial purposes (including but not limited to product development, commercial services, profit - making activities, etc.), illegal activities, or scenarios that violate laws, regulations, public order, and good customs is strictly prohibited.
2. **Statement on Result Validity**: All content generated by this model (including texts, data, conclusions, etc.) has not undergone systematic manual verification and accuracy review. It may contain issues such as factual deviations, logical omissions, outdated information, or ambiguous expressions. The model cannot make any guarantees regarding the authenticity, completeness, reliability, or applicability of the generated content.
3. **Explanation on Preference Adaptation**: The training data and optimization objectives of this model are not specifically designed to "conform to universal human preferences" or "meet the subjective needs of specific groups". The generated content may differ from the values, aesthetic preferences, and cognitive habits of different users. The model does not guarantee that the generated results will meet the subjective expectations of any individual or group.
4. **Liability Definition**: For any subsequent actions (including academic citation, decision - making reference, content dissemination, etc.) based on the content generated by this model, the risks and responsibilities shall be borne solely by the person who carries out the actions. The model developer shall not be liable for any direct or indirect losses (including but not limited to academic errors, decision - making deviations, reputation damage, etc.) caused by the use of the content of this model.
5. **Usage Recommendation**: It is recommended that users, when using the content generated by this model, conduct cross - verification with their own professional knowledge and reliable information sources, make independent judgments on the rationality and accuracy of the content, and avoid directly using the model output as the sole basis.