SwaFlow-3B-EMA-Instruct
SwaFlow-3B-EMA-Instruct is SwaFlow-3B-EMA, the weight average of the final 3B hyperspherical (Riemannian) flow language model of the SwaFlow suite, after one epoch of instruction tuning on Dolci-Instruct-SFT.
- Code: https://github.com/swallow-llm/swaflow-suite
- Training states of the base run: SwaFlow-3B
The repository holds config.json and model.safetensors (fp32).
Prompt format
The model was tuned on plain text without special tokens. Each user (or system) turn is written as User: <text> followed by a blank line, and each assistant turn as Assistant: <text>; the response ends with <|endoftext|> (id 0):
User: What is the capital of France?
Assistant: The capital of France is Paris.<|endoftext|>
Each part (User: <text> with its blank line, Assistant:, and the response with its leading space) was tokenized on its own and the pieces were joined; tokenizing the joined string can split differently at the boundaries. Build the prompt the same way, with the tokenizers library as in training, and end it with Assistant:.
Usage
Install the SwaFlow code. The model generates by integrating a flow on the sphere from noise; prefix_tokens are held clean as the condition.
import torch
from tokenizers import Tokenizer
from torchtitan.models.swaflow.hf import from_pretrained
from torchtitan.models.swaflow.sampling import SamplerConfig, generate
tokenizer = Tokenizer.from_pretrained("HuggingFaceTB/SmolLM2-135M")
model = from_pretrained("tokyotech-llm/SwaFlow-3B-EMA-Instruct", device="cuda").eval()
# encode each part on its own, as in instruction tuning
ids = tokenizer.encode("User: What is the capital of France?\n\n").ids + tokenizer.encode("Assistant:").ids
prefix = torch.tensor([ids], device="cuda")
with torch.no_grad():
out = generate(model, num_samples=1, seq_len=prefix.shape[1] + 256,
config=SamplerConfig(steps=64), prefix_tokens=prefix,
prefix_lengths=torch.tensor([prefix.shape[1]], device="cuda"))
tokens = out[0, prefix.shape[1]:].tolist()
if 0 in tokens: # <|endoftext|> ends the text
tokens = tokens[: tokens.index(0)]
print(tokenizer.decode(tokens))
SamplerConfig sets the number of function evaluations (steps), the temperature and the decoding rule; see torchtitan/models/swaflow/sampling.py.
Instruction tuning
One epoch of Dolci-Instruct-SFT: 1,107 steps of 512 × 2,048 tokens (1.16B tokens), AdamW with LR 3e-5, a 55-step warmup and a linear decay to zero over the last 90% of the steps, examples packed by concatenating and chunking. The prompt is kept clean (α = 1) and is not scored; the response is noised at the sequence's α, as in clean-prefix mid-training. Examples with tool calls are left out.
Model details
| Parameters | 3.74B (width 3072, 28 layers, 24 heads, FFN 8192) |
| Vocabulary | 49,152 (SmolLM2 tokenizer) |
| Context length | 2,048 tokens |
| Time convention | α = 1 is clean data, α = 0 is pure noise; training window α ∈ [0, 0.10] |
| Pretraining | 4T tokens of Dolma 3 Mix, 4,096 × 2,048 tokens per step, AdamW, LR 3e-4 constant after warmup |
| Hardware | 32 nodes × 8 NVIDIA H200 |
Training data
Pretraining: Dolma 3 Mix by the Allen Institute for AI, licensed under ODC-By 1.0, with its mixture weights unchanged. Instruction tuning: Dolci-Instruct-SFT by the Allen Institute for AI, licensed under ODC-By 1.0 and intended for research and educational use under Ai2's Responsible Use Guidelines. Some of its responses were generated by other models.
Scope and limitations
SwaFlow is built to make Riemannian flow language models open to study across training and scale: several sizes trained under one recipe, their full states along training, a data order shared by all runs, and autoregressive twins trained on the same data. It is not meant to provide models for applications. Flow language models are still at an early stage, and the twins show how far: on multiple-choice tasks every autoregressive twin, the 150M one included, scores higher on average than the final 3B flow model. Text generated by the flow models, the instruction-tuned ones included, is often incoherent, and none of the models is tuned to avoid harmful content.
Acknowledgements
This model was built by AIST and Institute of Science Tokyo under FRONTia, a Japanese national program led by the Ministry of Economy, Trade and Industry of Japan (METI) and the New Energy and Industrial Technology Development Organization (NEDO), aimed at developing a domestic multimodal foundation model for AI robots and physical AI.
License
The weights are released under the Apache License 2.0. The tokenizer is that of SmolLM2 (Apache License 2.0). The pretraining and instruction-tuning data are licensed under ODC-By 1.0.
Citation
@misc{swaflow2026,
title = {SwaFlow: A Fully Open Suite for Studying Riemannian Flow Language Models Across Training and Scale},
author = {Oba, Daisuke and Mizuki, Sakae and Takamura, Hiroya and Okazaki, Naoaki},
year = {2026},
note = {coming soon}
}
- Downloads last month
- 33
Model tree for tokyotech-llm/SwaFlow-3B-EMA-Instruct
Base model
tokyotech-llm/SwaFlow-3B-EMA