summerMC commited on
Commit
a1bbbc9
·
verified ·
1 Parent(s): 4280761

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +205 -35
README.md CHANGED
@@ -1,43 +1,213 @@
1
- ```markdown
2
  # summerMC/TRM-text-v4
3
 
4
- ## モデル概要
5
- `TRM-text-v4`は、日本語における高度な論理的推論能力(Reasoning)とコンテキストウィンドウの拡張を目的とした実験的言語モデルです。
6
- 特に、Assistantが回答の前に `<think>` タグを用いて思考プロセスを日本語で展開するように微調整されています。
7
-
8
- ## 主な特徴
9
- - **日本語思考プロセス(CoT)**: `<think>` タグを利用したステップバイステップの論理構成を学習。
10
- - **コンテキスト拡張**: RoPE (Rotary Positional Embedding) のダイナミックスケーリングを導入し、標準的な制限を超えた長い入力への対応を試行。
11
- - **効率的な学習**: BitsAndBytesによる4-bit量子化(NF4)とLoRA(Low-Rank Adaptation)を組み合わせ、メモリ効率の高いトレーニングを実現。
12
-
13
- ## 技術仕様
14
- - **ベースモデル**: summerMC/TRM-text-v4 (MoE Architecture)
15
- - **学習設定**:
16
- - LoRA Rank (r): 16
17
- - LoRA Alpha: 32
18
- - Target Modules: All Linear layers
19
- - Learning Rate: 3e-4
20
- - Precision: FP16 with 4-bit quantization
21
- - **コンテキスト設定**:
22
- - RoPE Scaling Factor: 2.0 (Dynamic)
23
- - Max Position Embeddings: 2048 (Targeted extension for 5M in architectural planning)
24
-
25
- ## 使用データセット
26
- - **Databricks Dolly-15k-ja**: 日本語の指示追従能力向上のため。
27
- - **Reasoning Dataset (Planned/Subset)**: Magpie/Sakura Reasoningデータセットを参考に、日本語での推論テンプレートを適用。
28
-
29
- ## 推論方法
30
- 以下のプロンプトテンプレートを使用することで、モデルの思考能力を最大限に引き出すことができます。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  ```text
33
- User: [質問内容]
34
  Assistant: <think>
35
- [ここに思考プロセスが展開される]
36
  </think>
37
- [最終的な回答]
38
  ```
39
 
40
- ## 現在の課題とステータス
41
- - **言語の一貫性**: 推論プロセスにおいて一部英語の技術用語が混ざる傾向があり、さらなるデータセットの調整が必要。
42
- - **コンテキストの限界**: 理論上の拡張(5Mトークン等)に対し、実際のハードウェア(VRAM)制約と数値的安定性のバランスを最適化中。
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.