Text Generation
Transformers
Safetensors
Chinese
qwen3
traditional-chinese-medicine
lingdan-v2
r1
conversational
text-generation-inference
Instructions to use TCMLLM/Lingdan-4B-R1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TCMLLM/Lingdan-4B-R1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TCMLLM/Lingdan-4B-R1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TCMLLM/Lingdan-4B-R1") model = AutoModelForCausalLM.from_pretrained("TCMLLM/Lingdan-4B-R1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TCMLLM/Lingdan-4B-R1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TCMLLM/Lingdan-4B-R1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TCMLLM/Lingdan-4B-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TCMLLM/Lingdan-4B-R1
- SGLang
How to use TCMLLM/Lingdan-4B-R1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TCMLLM/Lingdan-4B-R1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TCMLLM/Lingdan-4B-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "TCMLLM/Lingdan-4B-R1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TCMLLM/Lingdan-4B-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TCMLLM/Lingdan-4B-R1 with Docker Model Runner:
docker model run hf.co/TCMLLM/Lingdan-4B-R1
Document cumulative CPT, SFT and RL training stages
Browse files
README.md
CHANGED
|
@@ -39,17 +39,27 @@ tags:
|
|
| 39 |
|
| 40 |
## Model Details
|
| 41 |
|
| 42 |
-
**Lingdan-4B-R1** is a Qwen3-based TCM model in the [Lingdan-V2 family](https://github.com/TCMAI-BJTU/Lingdan-V2).
|
| 43 |
|
| 44 |
| Field | Value |
|
| 45 |
| --- | --- |
|
| 46 |
| Parameter scale | 4B |
|
| 47 |
| Architecture family | Qwen3 causal language model |
|
| 48 |
-
| Training stage |
|
| 49 |
| Starting checkpoint / backbone | Lingdan-4B-SFT |
|
| 50 |
| Intended use | Structured TCM clinical reasoning and prescription-generation research |
|
| 51 |
| Platform model ID | `TCMLLM/Lingdan-4B-R1` |
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
## Checkpoint Evaluation
|
| 54 |
|
| 55 |
Paper-reported results for **Lingdan-4B-R1**. Full: LingLan (25,620 items); Hard: LingLan-Hard (5,200 items). Overall Score averages 16 primary metrics, excluding dose MAE. All scores use a 0–100 scale except MAE (lower is better). The paper uses zero-shot Chinese prompts, temperature 0.6, and at most 8,192 generated tokens; reproduction also requires the same data and scoring pipeline.
|
|
|
|
| 39 |
|
| 40 |
## Model Details
|
| 41 |
|
| 42 |
+
**Lingdan-4B-R1** is a Qwen3-based TCM model in the [Lingdan-V2 family](https://github.com/TCMAI-BJTU/Lingdan-V2).
|
| 43 |
|
| 44 |
| Field | Value |
|
| 45 |
| --- | --- |
|
| 46 |
| Parameter scale | 4B |
|
| 47 |
| Architecture family | Qwen3 causal language model |
|
| 48 |
+
| Training stage | Reinforcement learning (RL; prescription-centered GRPO) |
|
| 49 |
| Starting checkpoint / backbone | Lingdan-4B-SFT |
|
| 50 |
| Intended use | Structured TCM clinical reasoning and prescription-generation research |
|
| 51 |
| Platform model ID | `TCMLLM/Lingdan-4B-R1` |
|
| 52 |
|
| 53 |
+
### Training History
|
| 54 |
+
|
| 55 |
+
This checkpoint includes the following training stages, in order:
|
| 56 |
+
|
| 57 |
+
| Stage | Objective | Training data |
|
| 58 |
+
| --- | --- | --- |
|
| 59 |
+
| CPT — continued pretraining | TCM-domain knowledge acquisition | 16.62B tokens |
|
| 60 |
+
| SFT — supervised fine-tuning | Reasoning-oriented instruction following | 7,729,982 samples / 2.08B tokens |
|
| 61 |
+
| RL — prescription-centered GRPO | Prescription composition alignment | 24,212 samples |
|
| 62 |
+
|
| 63 |
## Checkpoint Evaluation
|
| 64 |
|
| 65 |
Paper-reported results for **Lingdan-4B-R1**. Full: LingLan (25,620 items); Hard: LingLan-Hard (5,200 items). Overall Score averages 16 primary metrics, excluding dose MAE. All scores use a 0–100 scale except MAE (lower is better). The paper uses zero-shot Chinese prompts, temperature 0.6, and at most 8,192 generated tokens; reproduction also requires the same data and scoring pipeline.
|