Safetensors
English
Japanese
llama
File size: 16,524 Bytes
46084ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fc72c49
 
 
46084ef
 
 
 
 
 
 
 
 
 
 
 
 
fc72c49
 
e803c2d
46084ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fc72c49
 
 
 
 
 
 
 
 
 
46084ef
 
 
fc72c49
 
 
 
 
 
 
 
dd39620
fc72c49
46084ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fc72c49
46084ef
fc72c49
46084ef
fc72c49
 
46084ef
fc72c49
46084ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
---
license: 
- llama3.1
- gemma
datasets:
- tokyotech-llm/swallow-code
- tokyotech-llm/swallow-math
language:
- en
- ja
base_model:
- meta-llama/Llama-3.1-8B-Instruct
model_type: llama
---

# Llama 3.1 Swallow v0.5 - Built with Llama

Llama 3.1 Swallow v0.5 is a large language model (8B) that was built by continual pre-training on the [Meta Llama 3.1](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) model.
Llama 3.1 Swallow v0.5 enhanced the Japanese language and reasoning(code & math) capabilities of the original Llama 3.1 while retaining the English language capabilities.
We use approximately 210 billion tokens that were sampled from a large Japanese web corpus (Swallow Corpus Version 2), Japanese and English Wikipedia articles, and mathematical and
coding contents, etc (see the Training Datasets section of the base model) for continual pre-training.
The instruction-tuned models (Instruct) were built by supervised fine-tuning (SFT) on the synthetic data specially built for Japanese.
See the Swallow Model Index section to find other model variants.

# Release History
- **Jun 25, 2025**: Released [Llama-3.1-Swallow-8B-Instruct-v0.5](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.5) and [Llama-3.1-Swallow-8B-v0.5](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-v0.5).
- **March 10, 2025**: Released [Llama-3.3-Swallow-70B-Instruct-v0.4](https://huggingface.co/tokyotech-llm/Llama-3.3-Swallow-70B-Instruct-v0.4) and [Llama-3.3-Swallow-70B-v0.4](https://huggingface.co/tokyotech-llm/Llama-3.3-Swallow-70B-v0.4).
- **December 30, 2024**: Released [Llama-3.1-Swallow-70B-Instruct-v0.3](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-70B-Instruct-v0.3).
- **December 23, 2024**: Released [Llama-3.1-Swallow-8B-Instruct-v0.3](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.3).
- **November 11, 2024**: Released [Llama-3.1-Swallow-8B-v0.2](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-v0.2) and [Llama-3.1-Swallow-8B-Instruct-v0.2](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.2).
- **October 08, 2024**: Released [Llama-3.1-Swallow-8B-v0.1](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-v0.1), [Llama-3.1-Swallow-8B-Instruct-v0.1](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.1), [Llama-3.1-Swallow-70B-v0.1](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-70B-v0.1), and [Llama-3.1-Swallow-70B-Instruct-v0.1](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-70B-Instruct-v0.1).

## Swallow Model Index
|Model| Llama-3.1-Swallow-Instruct v0.5 |Llama-3.1-Swallow-Instruct v0.1|Llama-3.1-Swallow v0.2|Llama-3.1-Swallow-Instruct v0.2|Llama-3.1-Swallow-Instruct v0.3|Llama-3.3-Swallow v0.4|Llama-3.3-Swallow-Instruct v0.4|
|---|---|---|---|---|---|---|---|
|8B| [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.5) | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-v0.1) | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.1) | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-v0.2) | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.2) |  [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-8B-Instruct-v0.3) | | |
|70B| TBD | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-70B-Instruct-v0.1) |  |  | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.1-Swallow-70B-Instruct-v0.3) | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.3-Swallow-70B-v0.4) | [🤗 HuggingFace](https://huggingface.co/tokyotech-llm/Llama-3.3-Swallow-70B-Instruct-v0.4) |

![logo](./logo.png)

The website [https://swallow-llm.github.io/](https://swallow-llm.github.io/index.en.html) provides large language models developed by the Swallow team.

## Model Details

* **Model type**: Please refer to [Llama 3.1 MODEL_CARD](https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md) for details on the model architecture.
* **Language(s)**: Japanese English
* **Library**: [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) 
* **Tokenizer**: Please refer to [Llama 3.1 blog](https://ai.meta.com/blog/meta-llama-3-1) for details on the tokenizer.
* **Contact**: swallow[at]nlp.c.titech.ac.jp 

## Model Performance

### Japanese tasks

| Model                     | JCom.     | JEMHopQA | NIILC     | JSQuAD    | XL-Sum    | MGSM      | WMT20-en-ja | WMT20-ja-en | JMMLU     | JHumanEval | Ja Avg    |
|---------------------------|-----------|----------|-----------|-----------|-----------|-----------|-------------|-------------|-----------|------------|-----------|
|                           | 4-shot    | 4-shot   | 4-shot    | 4-shot    | 1-shot    | 4-shot    | 4-shot      | 4-shot      | 5-shot    | 0-shot     |           |
|                           | EM acc    | Char-F1  | Char-F1   | Char-F1   | ROUGE-2   | EM acc    | BLEU        | BLEU        | EM acc    | pass@1     |           |
| Qwen2.5-7B                | 0.924     | 0.459    | 0.426     | 0.907     | 0.216     | 0.616     | 0.229       | 0.199       | 0.634     | 0.507      | 0.512     |
| Llama 3.1 8B              | 0.845     | 0.461    | 0.405     | 0.895     | 0.179     | 0.356     | 0.221       | 0.210       | 0.479     | 0.320      | 0.437     |
| Qwen3-8B-Base             | 0.927     | **0.537** | 0.475     | 0.912     | 0.207     | **0.716** | 0.241       | 0.215       | **0.689** | **0.595**  | **0.551** |
| Llama 3.1 Swallow 8B v0.2 | 0.911     | 0.510    | 0.627     | 0.892     | 0.198     | 0.464     | **0.296**   | **0.233**   | 0.525     | 0.336      | 0.499     |
| **Llama 3.1 Swallow 8B v0.5** | **0.952** | 0.513    | **0.657** | **0.910** | **0.217** | 0.572     | 0.294       | 0.232       | 0.590     | 0.491      | 0.543     |
 

### English tasks

| Model                     | OpenBookQA | TriviaQA | HellaSWAG | SQuAD2.0 | XWINO   | MMLU    | GSM8K   | MATH    | BBH     | HumanEval | En Avg  |
|---------------------------|------------|----------|-----------|----------|---------|---------|---------|---------|---------|-----------|---------|
|                           | 4-shot     | 4-shot   | 4-shot    | 4-shot   | 4-shot  | 5-shot  | 4-shot  | 4-shot  | 3-shot  | 0-shot    |         |
|                           | Acc        | EM acc   | Acc       | EM acc   | Acc     | Acc     | EM acc  | CoT EM Acc | CoT EM Acc | pass@1 |         |
| Qwen2.5-7B                | **0.392**  | 0.601    | 0.600     | **0.618** | 0.888   | 0.742   | 0.832   | 0.510   | 0.562   | 0.554     | 0.630   |
| Qwen3-8B-Base             | 0.382      | 0.618    | 0.594     | 0.602    | 0.903   | **0.765** | **0.855** | **0.622** | **0.655** | **0.669** | **0.667** |
| Llama 3.1 8B              | 0.380      | **0.702** | **0.609** | 0.503    | **0.907** | 0.651   | 0.507   | 0.214   | 0.616   | 0.364     | 0.545   |
| Llama 3.1 Swallow 8B v0.2 | 0.382      | 0.651    | 0.596     | 0.513    | 0.904   | 0.622   | 0.521   | 0.228   | 0.605   | 0.366     | 0.539   |
| **Llama 3.1 Swallow 8B v0.5** | 0.372      | 0.665    | 0.597     | 0.536    | 0.900   | 0.666   | 0.699   | 0.390   | 0.589   | 0.557     | 0.597   |


## Evaluation Benchmarks
The evaluation script can be found at [swallow-llm/swallow-evaluation](https://github.com/swallow-llm/swallow-evaluation), tagged as `v202411`.

### Japanese evaluation benchmarks

We used llm-jp-eval(v1.3.0), JP Language Model Evaluation Harness(commit #9b42d41) and Code Generation LM Evaluation Harness(commit #0261c52). The details are as follows:

- Multiple-choice question answering (JCommonsenseQA [Kurihara et al., 2022])
- Open-ended question answering (JEMHopQA [Ishii et al., 2024])
- Open-ended question answering (NIILC [関根, 2003])
- Machine reading comprehension (JSQuAD [Kurihara et al., 2022])
- Automatic summarization (XL-Sum [Hasan et al., 2021])
- Machine translation (WMT2020 ja-en [Barrault et al., 2020])
- Machine translation (WMT2020 en-ja [Barrault et al., 2020])
- Mathematical reasoning (MGSM [Shi et al., 2023])
- Academic exams (JMMLU [尹ら, 2024])
- Code generation (JHumanEval [佐藤ら, 2024])

### English evaluation benchmarks

We used the Language Model Evaluation Harness(v.0.4.2) and Code Generation LM Evaluation Harness(commit #0261c52). The details are as follows:

- Multiple-choice question answering (OpenBookQA [Mihaylov et al., 2018])
- Open-ended question answering (TriviaQA [Joshi et al., 2017])
- Machine reading comprehension (SQuAD2 [Rajpurkar et al., 2018])
- Commonsense reasoning (XWINO [Tikhonov and Ryabinin, 2021])
- Natural language inference (HellaSwag [Zellers et al., 2019])
- Mathematical reasoning (GSM8K [Cobbe et al., 2021])
- Mathematical reasoning (MATH [Hendrycks et al., 2022][Lightman et al., 2024])
- Reasoning (BBH (BIG-Bench-Hard) [Suzgun et al., 2023])
- Academic exams (MMLU [Hendrycks et al., 2021])
- Code generation (HumanEval [Chen et al., 2021])

## Training Datasets

### Continual Pre-Training
The following datasets were used for continual pre-training.

- [Cosmopedia](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia)
- [Dclm-baseline-1.0](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0)
- [English Wikipedia](https://dumps.wikimedia.org/other/cirrussearch)
- [Japanese Wikipedia](https://dumps.wikimedia.org/other/cirrussearch)
- [Laboro ParaCorpus](https://github.com/laboroai/Laboro-ParaCorpus)
- [Swallow Corpus Version 2](https://arxiv.org/abs/2404.17733) (filtered using [Swallow Education Classifier(Wiki-based)](https://huggingface.co/tokyotech-llm/edu-classifier))
- [Swallow Corpus Version 2](https://arxiv.org/abs/2404.17733) (filtered using [Swallow Education Classifier](https://huggingface.co/tokyotech-llm/edu-classifier))
- [Swallow Corpus Version 2](https://arxiv.org/abs/2404.17733) (synthetic QA-format using Gemma-2-27b-it)
- [Swallow Code Version 1](https://huggingface.co/datasets/tokyotech-llm/swallow-code)
- [Swallow Math Version 1](https://huggingface.co/datasets/tokyotech-llm/swallow-math)
 
### Swallow Corpus Version 2

We built the Swallow Corpus by extracting high-quality Japanese texts from Common Crawl. In Version 2, we expanded the scope of the Common Crawl collection and modified the pipeline sequence to enable more flexible quality filtering. 
For Llama 3.1 Swallow v0.2, we further refined our quality filtering and data sampling strategies, resulting in an even higher-quality selection of Japanese texts for pre-training.
For Llama 3.3 Swallow 70B v0.4, we generated synthetic QA-format text by using Gemma 2 27B IT to paraphrase educational web documents from our corpus.

### Swallow Code & Swallow Math

Swallow Code and Swallow Math are high-quality, open-source datasets developed and publicly released by our team at the Institute of Science Tokyo, in collaboration with the Artificial Intelligence Research Center, AIST, Japan.
These datasets are specifically designed to enhance the code and mathematical reasoning capabilities of large language models, with a focus on improving performance in Japanese and English tasks.

As demonstrated in our paper, ["Rewriting Pre-Training Data Boosts LLM Performance in Math and Code"](https://arxiv.org/abs/2505.02881), Swallow Code and Swallow Math outperform other datasets such as [Stack-Edu](https://huggingface.co/datasets/HuggingFaceTB/stack-edu) and [finemath-4+](https://huggingface.co/datasets/HuggingFaceTB/finemath) in terms of quality and effectiveness.


## Risks and Limitations

The models released here are still in the early stages of our research and development and have not been tuned to ensure outputs align with human intent and safety considerations.

## Acknowledgements

We thank Meta Research for releasing Llama 3.1 under a generous open license.

We would like to thank Amazon Web Services (AWS) for providing access to [SageMaker HyperPod](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod.html), which enabled the training of the Llama 3.1 Swallow project.

We received various supports including:

+ AIST project: "Research and Development of Foundation Models for Generative AI in the Physical Domain"
+ NEDO project: "Development of Artificial Intelligence Application Technology to Support Judgment in Design Risk Assessment Work Based on the Perspective of Skilled Persons" (JPNP18002) of "Development of Integration Technology as the Core of Next Generation Artificial Intelligence and Robotics"
+ MEXT project: "Formation of R&D center to ensure transparency and reliability of generative AI models"
+ AIST program: [Large Generative AI Development Support Program](https://abci.ai/en/link/lfm_support_program.html)

## License

[META LLAMA 3.1 COMMUNITY LICENSE](https://www.llama.com/llama3_1/license/) and [Gemma Terms of Use](https://ai.google.dev/gemma/terms)

## Authors

Here are the team members:
- From [Institute of Science Tokyo Okazaki Laboratory](https://www.nlp.c.titech.ac.jp/index.en.html), the following members:
  - [Naoaki Okazaki](https://www.chokkan.org/index.ja.html)
  - [Sakae Mizuki](https://s-mizuki-nlp.github.io/)
  - [Youmi Ma](https://www.nlp.c.titech.ac.jp/member/youmi.en.html)
  - [Koki Maeda](https://sites.google.com/view/silviase)
  - [Kakeru Hattori](https://aya-se.vercel.app/)
  - [Masanari Ohi](https://sites.google.com/view/masanariohi)
  - [Hinari Shimada](https://hinarishimada.github.io/portfolio)
  - [Taihei Shiotani](https://github.com/inatoihs)
  - [Koshiro Saito](https://sites.google.com/view/koshiro-saito)
- From [Institute of Science Tokyo YOKOTA Laboratory](https://www.rio.gsic.titech.ac.jp/en/index.html), the following members:
  - [Rio Yokota](https://twitter.com/rioyokota)
  - [Kazuki Fujii](https://twitter.com/okoge_kaz)
  - [Taishi Nakamura](https://twitter.com/Setuna7777_2)
  - [Takumi Okamoto](https://www.linkedin.com/in/takumi-okamoto)
  - [Ishida Shigeki](https://www.wantedly.com/id/reborn27)
  - [Yukito Tajima](https://www.linkedin.com/in/yukito-tajima-51bbb2299)
  - [Masaki Kawamura](https://x.com/Masakichi333210)
- From [Artificial Intelligence Research Center, AIST, Japan](https://www.airc.aist.go.jp/en/teams/), the following members:
  - [Hiroya Takamura](https://sites.google.com/view/hjtakamura)

## How to cite

If you find our work helpful, please feel free to cite these papers.

```
@inproceedings{Fujii:COLM2024,
   title={Continual Pre-Training for Cross-Lingual LLM Adaptation:
Enhancing Japanese Language Capabilities},
   author={Kazuki Fujii and Taishi Nakamura and Mengsay Loem and Hiroki
Iida and Masanari Ohi and Kakeru Hattori and Hirai Shota and Sakae
Mizuki and Rio Yokota and Naoaki Okazaki},
   booktitle="Proceedings of the First Conference on Language Modeling",
   series={COLM},
   pages="(to appear)",
   year="2024",
   month=oct,
   address={University of Pennsylvania, USA},
}
@inproceedings{Okazaki:COLM2024,
   title={Building a Large Japanese Web Corpus for Large Language Models},
   author={Naoaki Okazaki and Kakeru Hattori and Hirai Shota and Hiroki
Iida and Masanari Ohi and Kazuki Fujii and Taishi Nakamura and Mengsay
Loem and Rio Yokota and Sakae Mizuki},
   booktitle="Proceedings of the First Conference on Language Modeling",
   series={COLM},
   pages="(to appear)",
   year="2024",
   month=oct,
   address={University of Pennsylvania, USA},
}
@misc{fujii2025rewritingpretrainingdataboosts,
      title={Rewriting Pre-Training Data Boosts LLM Performance in Math and Code}, 
      author={Kazuki Fujii and Yukito Tajima and Sakae Mizuki and Hinari Shimada and Taihei Shiotani and Koshiro Saito and Masanari Ohi and Masaki Kawamura and Taishi Nakamura and Takumi Okamoto and Shigeki Ishida and Kakeru Hattori and Youmi Ma and Hiroya Takamura and Rio Yokota and Naoaki Okazaki},
      year={2025},
      eprint={2505.02881},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2505.02881}, 
}
```

### References

```tex
@misc{dubey2024llama3herdmodels,
      title={The Llama 3 Herd of Models}, 
      author={Abhimanyu Dubey and Abhinav Jauhri and Abhinav Pandey and Abhishek Kadian and Ahmad Al-Dahle and Aiesha Letman and Akhil Mathur and Alan Schelten and Amy Yang and Angela Fan et al.},
      year={2024},
      eprint={2407.21783},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2407.21783}, 
}
```