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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
```text
|
| 33 |
-
User: [
|
| 34 |
Assistant: <think>
|
| 35 |
-
[
|
| 36 |
</think>
|
| 37 |
-
[
|
| 38 |
```
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# summerMC/TRM-text-v4
|
| 2 |
|
| 3 |
+
<div align="center">
|
| 4 |
+
|
| 5 |
+
# TRM-text-v4
|
| 6 |
+
|
| 7 |
+
Experimental Japanese Reasoning Language Model
|
| 8 |
+
|
| 9 |
+
</div>
|
| 10 |
+
|
| 11 |
+
## Overview
|
| 12 |
+
|
| 13 |
+
**TRM-text-v4** is an experimental Japanese language model developed to explore improved reasoning capabilities and extended context handling.
|
| 14 |
+
|
| 15 |
+
The model is designed to generate intermediate reasoning traces using `<think>` tags before producing final answers. It combines efficient fine-tuning techniques with experimental approaches to context extension.
|
| 16 |
+
|
| 17 |
+
> **Status:** Research Preview / Experimental Release
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## Features
|
| 22 |
+
|
| 23 |
+
### Japanese Chain-of-Thought Reasoning
|
| 24 |
+
|
| 25 |
+
TRM-text-v4 is fine-tuned to produce structured reasoning steps in Japanese using `<think>` tags.
|
| 26 |
+
|
| 27 |
+
Example:
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
User: 富士山の標高は?
|
| 31 |
+
Assistant: <think>
|
| 32 |
+
質問は富士山の標高についてである。
|
| 33 |
+
一般的に知られている標高を確認する。
|
| 34 |
+
富士山の標高は3776メートルである。
|
| 35 |
+
</think>
|
| 36 |
+
富士山の標高は3,776メートルです。
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
### Extended Context Experiments
|
| 42 |
+
|
| 43 |
+
The model incorporates experimental RoPE scaling techniques to investigate longer-context capabilities beyond the original configuration.
|
| 44 |
+
|
| 45 |
+
Current implementation focuses on practical extensions while evaluating numerical stability and hardware constraints.
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
### Efficient Fine-Tuning
|
| 50 |
+
|
| 51 |
+
TRM-text-v4 was trained using parameter-efficient fine-tuning methods:
|
| 52 |
+
|
| 53 |
+
* 4-bit NF4 quantization via BitsAndBytes
|
| 54 |
+
* LoRA adaptation
|
| 55 |
+
* Memory-efficient optimization for consumer GPUs
|
| 56 |
+
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
## Model Details
|
| 60 |
+
|
| 61 |
+
| Item | Value |
|
| 62 |
+
| -------------- | -------------------------------------- |
|
| 63 |
+
| Model Name | TRM-text-v4 |
|
| 64 |
+
| Architecture | MoE-based Causal Language Model |
|
| 65 |
+
| Language | Japanese |
|
| 66 |
+
| License | Apache-2.0 (or specify actual license) |
|
| 67 |
+
| Intended Use | Research and experimentation |
|
| 68 |
+
| Release Status | Experimental |
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Training Configuration
|
| 73 |
+
|
| 74 |
+
### Fine-Tuning
|
| 75 |
+
|
| 76 |
+
* LoRA Rank (`r`): **16**
|
| 77 |
+
* LoRA Alpha: **32**
|
| 78 |
+
* Target Modules: **All Linear Layers**
|
| 79 |
+
* Learning Rate: **3e-4**
|
| 80 |
+
* Precision: **FP16**
|
| 81 |
+
* Quantization: **4-bit NF4**
|
| 82 |
+
|
| 83 |
+
### Context Configuration
|
| 84 |
+
|
| 85 |
+
* RoPE Scaling: **Dynamic**
|
| 86 |
+
* RoPE Scaling Factor: **2.0**
|
| 87 |
+
* Maximum Position Embeddings: **2048**
|
| 88 |
+
|
| 89 |
+
> Long-context support beyond this configuration remains under investigation and should be considered experimental.
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## Datasets
|
| 94 |
+
|
| 95 |
+
### Instruction Tuning
|
| 96 |
+
|
| 97 |
+
* **Databricks Dolly-15k-ja**
|
| 98 |
+
|
| 99 |
+
* Used to improve Japanese instruction-following ability.
|
| 100 |
+
|
| 101 |
+
### Reasoning Data
|
| 102 |
+
|
| 103 |
+
* Reasoning templates inspired by datasets such as:
|
| 104 |
+
|
| 105 |
+
* Magpie
|
| 106 |
+
* Sakura Reasoning
|
| 107 |
+
|
| 108 |
+
> Portions of the reasoning pipeline are experimental and may evolve in future releases.
|
| 109 |
+
|
| 110 |
+
---
|
| 111 |
+
|
| 112 |
+
## Usage
|
| 113 |
+
|
| 114 |
+
```python
|
| 115 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 116 |
+
|
| 117 |
+
model_id = "summerMC/TRM-text-v4"
|
| 118 |
+
|
| 119 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 120 |
+
model_id,
|
| 121 |
+
trust_remote_code=True,
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 125 |
+
model_id,
|
| 126 |
+
trust_remote_code=True,
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
prompt = """User: 人工知能とは?
|
| 130 |
+
Assistant: <think>
|
| 131 |
+
"""
|
| 132 |
+
|
| 133 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 134 |
+
|
| 135 |
+
outputs = model.generate(
|
| 136 |
+
**inputs,
|
| 137 |
+
max_new_tokens=256,
|
| 138 |
+
do_sample=True,
|
| 139 |
+
temperature=0.7,
|
| 140 |
+
top_p=0.9,
|
| 141 |
+
)
|
| 142 |
+
|
| 143 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
## Prompt Format
|
| 149 |
+
|
| 150 |
+
Recommended prompt template:
|
| 151 |
|
| 152 |
```text
|
| 153 |
+
User: [Question]
|
| 154 |
Assistant: <think>
|
| 155 |
+
[Reasoning Process]
|
| 156 |
</think>
|
| 157 |
+
[Final Answer]
|
| 158 |
```
|
| 159 |
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
## Limitations
|
| 163 |
+
|
| 164 |
+
* Reasoning traces may occasionally contain mixed Japanese and English terminology.
|
| 165 |
+
* Generated reasoning processes are not guaranteed to reflect the model's actual internal computation.
|
| 166 |
+
* Long-context behavior beyond validated ranges may exhibit instability.
|
| 167 |
+
* The model may generate incorrect or fabricated information and should not be used in high-risk domains without human verification.
|
| 168 |
+
|
| 169 |
+
---
|
| 170 |
+
|
| 171 |
+
## Intended Use
|
| 172 |
+
|
| 173 |
+
Recommended uses:
|
| 174 |
+
|
| 175 |
+
* Research on Japanese reasoning language models
|
| 176 |
+
* Prompt engineering experiments
|
| 177 |
+
* Educational demonstrations
|
| 178 |
+
* Evaluation of Chain-of-Thought prompting strategies
|
| 179 |
+
|
| 180 |
+
Not recommended for:
|
| 181 |
+
|
| 182 |
+
* Medical decision-making
|
| 183 |
+
* Legal advice
|
| 184 |
+
* Financial advice
|
| 185 |
+
* Safety-critical applications
|
| 186 |
+
|
| 187 |
+
---
|
| 188 |
+
|
| 189 |
+
## Citation
|
| 190 |
+
|
| 191 |
+
```bibtex
|
| 192 |
+
@misc{summermc_trm_text_v4,
|
| 193 |
+
title = {TRM-text-v4: Experimental Japanese Reasoning Language Model},
|
| 194 |
+
author = {summerMC},
|
| 195 |
+
year = {2026},
|
| 196 |
+
publisher = {Hugging Face},
|
| 197 |
+
howpublished = {\url{https://huggingface.co/summerMC/TRM-text-v4}}
|
| 198 |
+
}
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
|
| 203 |
+
## Acknowledgements
|
| 204 |
+
|
| 205 |
+
TRM-text-v4 builds upon the open-source ecosystem, including:
|
| 206 |
+
|
| 207 |
+
* Hugging Face Transformers
|
| 208 |
+
* PEFT
|
| 209 |
+
* BitsAndBytes
|
| 210 |
+
* Databricks Dolly
|
| 211 |
+
* The broader open-source LLM community
|
| 212 |
+
|
| 213 |
+
Special thanks to all researchers and contributors advancing efficient Japanese language modeling.
|