add README.md
Browse files- .gitattributes +1 -0
- README.md +184 -3
- pathumma-thaillm-300.png +3 -0
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
pathumma-thaillm-300.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,184 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+

|
| 6 |
+
|
| 7 |
+
# Pathumma-ThaiLLM-Think-3.0.0
|
| 8 |
+
|
| 9 |
+
Post-trained Thai Large Language Model built upon the foundation model from the Thai national initiative [**ThaiLLM**](https://www.thaillm.or.th).
|
| 10 |
+
|
| 11 |
+
This release applies multi-stage Supervised Fine-Tuning (SFT) to enhance:
|
| 12 |
+
|
| 13 |
+
- Instruction following
|
| 14 |
+
- Structured tool / function calling
|
| 15 |
+
- Mathematical and coding competence
|
| 16 |
+
- Multi-step analytical capability
|
| 17 |
+
- Thai–English bilingual robustness
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## Training Strategy
|
| 22 |
+
|
| 23 |
+
Post-training is organized into **two stages**:
|
| 24 |
+
|
| 25 |
+
- **Stage 1:** Instruction & Tool-Calling Alignment
|
| 26 |
+
- **Stage 2:** Reasoning Specialization
|
| 27 |
+
|
| 28 |
+
For selected corpora, only curated subsets were used to maintain domain balance.
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## Stage 1: Instruction & Tool-Calling Alignment
|
| 33 |
+
|
| 34 |
+
Focus areas:
|
| 35 |
+
|
| 36 |
+
- Instruction compliance
|
| 37 |
+
- Structured tool-call formatting
|
| 38 |
+
- General Thai task robustness
|
| 39 |
+
- STEM-oriented instruction alignment
|
| 40 |
+
|
| 41 |
+
### Datasets
|
| 42 |
+
|
| 43 |
+
| Dataset | Training Subset Size | Full Dataset Size | Domain | License |
|
| 44 |
+
|----------|---------------------|------------------|----------|----------|
|
| 45 |
+
| beyoru/ToolCall_synthetic_qwen3 | 60,000 | 60,000 | Tool | Apache-2.0 |
|
| 46 |
+
| airesearch/WangchanX-FLAN-v6 | 2,000,000 | 13,619,450 | General | Mixed |
|
| 47 |
+
| nvidia/OpenMathInstruct-2 | 1,000,000 | 14,000,000 | STEM | CC-BY-4.0 |
|
| 48 |
+
| jdaddyalbs/playwright-mcp-toolcalling | 1,750 | 1,750 | Tool | MIT |
|
| 49 |
+
| BitAgent/tool_calling | 551,000 | 551,000 | Tool | MIT |
|
| 50 |
+
|
| 51 |
+
<br>
|
| 52 |
+
|
| 53 |
+
## Stage 2: Reasoning Specialization
|
| 54 |
+
|
| 55 |
+
Focus areas:
|
| 56 |
+
|
| 57 |
+
- Multi-step mathematical analysis
|
| 58 |
+
- Code understanding and synthesis
|
| 59 |
+
- Structured analytical responses
|
| 60 |
+
- Tool-calling with explicit reasoning traces
|
| 61 |
+
- Thai reasoning distillation
|
| 62 |
+
|
| 63 |
+
### Datasets
|
| 64 |
+
|
| 65 |
+
| Dataset | Training Subset Size | Full Dataset Size | Domain | License |
|
| 66 |
+
|----------|---------------------|------------------|----------|----------|
|
| 67 |
+
| nvidia/OpenMathReasoning | 500,000 | 4,920,000 | STEM | CC-BY-4.0 |
|
| 68 |
+
| nvidia/OpenCodeReasoning | 585,000 | 585,000 | Coding | CC-BY-4.0 |
|
| 69 |
+
| natolambert/GeneralThought-430K-filtered | 337,579 | 337,579 | General | MIT |
|
| 70 |
+
| Jofthomas/hermes-function-calling-thinking-V1 | 3,570 | 3,570 | Tool | MIT |
|
| 71 |
+
| open-thoughts/OpenThoughts3-1.2M | 1,200,000 | 1,200,000 | STEM | Apache-2.0 |
|
| 72 |
+
| scb10x/typhoon-r1-sft-data | 23,851 | 23,851 | General | Custom |
|
| 73 |
+
| iapp/Thai-R1-Distill-SFT | 10,000 | 10,000 | General | Custom |
|
| 74 |
+
| nvidia/Nemotron-Post-Training-Dataset-v1 | 310,000 | 310,000 | Tool | CC-BY-4.0 |
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
> **Note:** For selected datasets, curated subsets were employed to ensure balanced domain representation.
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
## Methodology
|
| 83 |
+
|
| 84 |
+
- Base model: ThaiLLM foundation model
|
| 85 |
+
- Training objective: Supervised Fine-Tuning (SFT)
|
| 86 |
+
- Two-stage curriculum design
|
| 87 |
+
- Domain-balanced optimization
|
| 88 |
+
- Tool-call schema alignment
|
| 89 |
+
- Thai reasoning distillation
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## Compute Infrastructure
|
| 94 |
+
|
| 95 |
+
Training was conducted on the LANTA high-performance computing cluster, utilizing 16 nodes (64×A100 40GB GPUs) for distributed large-scale post-training.
|
| 96 |
+
## Capabilities
|
| 97 |
+
|
| 98 |
+
- Thai instruction compliance
|
| 99 |
+
- Structured JSON tool invocation
|
| 100 |
+
- Mathematical problem solving
|
| 101 |
+
- Code generation and analysis
|
| 102 |
+
- Multi-step analytical tasks
|
| 103 |
+
- Thai–English bilingual support
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## Limitations
|
| 108 |
+
|
| 109 |
+
- May hallucinate if tool schema is incomplete
|
| 110 |
+
- Performance on long analytical chains may degrade without retrieval
|
| 111 |
+
- Domain coverage depends on included corpora
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
<br>
|
| 115 |
+
|
| 116 |
+
# Quickstart
|
| 117 |
+
The code of Qwen3 has been in the latest Hugging Face `transformers` and we advise you to use the latest version of `transformers`.
|
| 118 |
+
With `transformers<4.51.0`, you will encounter the following error:
|
| 119 |
+
```
|
| 120 |
+
KeyError: 'qwen3'
|
| 121 |
+
```
|
| 122 |
+
The following contains a code snippet illustrating how to use the model generate content based on given inputs.
|
| 123 |
+
```python
|
| 124 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 125 |
+
model_name = "nectec/pathumma-thaillm-8b-think-3.0.0"
|
| 126 |
+
# load the tokenizer and the model
|
| 127 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 128 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 129 |
+
model_name,
|
| 130 |
+
torch_dtype="auto",
|
| 131 |
+
device_map="auto"
|
| 132 |
+
)
|
| 133 |
+
# prepare the model input
|
| 134 |
+
prompt = "ทำไมวงกลมถึงมี 360 องศา"
|
| 135 |
+
messages = [
|
| 136 |
+
{"role": "user", "content": prompt}
|
| 137 |
+
]
|
| 138 |
+
text = tokenizer.apply_chat_template(
|
| 139 |
+
messages,
|
| 140 |
+
tokenize=False,
|
| 141 |
+
add_generation_prompt=True,
|
| 142 |
+
)
|
| 143 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 144 |
+
# conduct text completion
|
| 145 |
+
generated_ids = model.generate(
|
| 146 |
+
**model_inputs,
|
| 147 |
+
max_new_tokens=32768
|
| 148 |
+
)
|
| 149 |
+
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 150 |
+
# parsing thinking content
|
| 151 |
+
try:
|
| 152 |
+
# rindex finding 151668 (</think>)
|
| 153 |
+
index = len(output_ids) - output_ids[::-1].index(151668)
|
| 154 |
+
except ValueError:
|
| 155 |
+
index = 0
|
| 156 |
+
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
|
| 157 |
+
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
|
| 158 |
+
print("thinking content:", thinking_content) # no opening <think> tag
|
| 159 |
+
print("content:", content)
|
| 160 |
+
```
|
| 161 |
+
For deployment, you can use `vllm>=0.8.5` to create an OpenAI-compatible API endpoint:
|
| 162 |
+
|
| 163 |
+
```shell
|
| 164 |
+
vllm serve nectec/pathumma-thaillm-8b-think-3.0.0 \
|
| 165 |
+
--enforce-eager \
|
| 166 |
+
--no-enable-chunked-prefill \
|
| 167 |
+
--tool-call-parser hermes
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
For local use, applications such as Ollama, LMStudio, and llama.cpp have also supported.
|
| 171 |
+
|
| 172 |
+
## About the Project
|
| 173 |
+
|
| 174 |
+
Pathumma-ThaiLLM-Think-3.0.0 is part of ongoing research toward sovereign Thai large language models optimized for analytical and tool-augmented intelligence.
|
| 175 |
+
|
| 176 |
+
# Contributor Contract
|
| 177 |
+
**LLM Team**
|
| 178 |
+
<br>
|
| 179 |
+
Piyawat Chuangkrud (piyawat@it.kmitl.ac.th)<br>
|
| 180 |
+
Chanon Utupon (s6401001620165@email.kmutnb.ac.th)<br>
|
| 181 |
+
Jessada Pranee (jessada.pran@kmutt.ac.th)<br>
|
| 182 |
+
Arnon Saeoung (anon.saeoueng@gmail.com)<br>
|
| 183 |
+
Chaianun Damrongrat (chaianun.damrongrat@nectec.or.th)<br>
|
| 184 |
+
Sarawoot Kongyoung (sarawoot.kongyoung@nectec.or.th)
|
pathumma-thaillm-300.png
ADDED
|
Git LFS Details
|