Model Card for NanoSakura-2.3-0.2B (Ja -> Zh)
Warning: This model isn't superior to telecomadm1145/NanoSakura-2.2-0.2B.
This model is a highly efficient, custom-built Hybrid Sequence-to-Sequence (Seq2Seq) model designed for Japanese to Chinese translation. It combines the deep understanding capabilities of a Transformer Encoder with the blazing-fast, memory-efficient generation of a Mamba2 (State Space Model) Decoder.
Model Details
Model Description
Traditional Seq2Seq models (like T5 or BART) rely entirely on Transformers. While powerful, the self-attention mechanism in the decoder leads to an $O(N^2)$ computational bottleneck and high KV-cache memory usage during text generation.
This model solves that by introducing a Hybrid Architecture:
- Encoder (Transformer): Uses Self-Attention + RoPE + SwiGLU to fully capture the global context of the source Japanese text in parallel.
- Decoder (Mamba2 + Cross-Attention): Replaces self-attention with Mamba2's State Space Model (SSM). This allows for $O(1)$ state-updating generation (no growing KV cache), while retaining Cross-Attention to accurately "look back" at the encoder's features to prevent hallucination.
With only ~188 Million parameters, it achieves excellent translation quality while maintaining an extremely low hardware footprint, making it ideal for edge deployment or high-throughput API services.
- Developed by: telecomadm1145
- Model type: Hybrid Transformer-Mamba2 Seq2Seq
- Language(s) (NLP): Japanese (ja), Chinese (zh)
- License: MIT
- Parameters: ~188M
How to Get Started with the Model
Because this model uses a custom architecture, you must use trust_remote_code=True when loading it with the transformers library. The custom modeling_mamba2_s2s.py will handle the $O(1)$ Mamba2 cache generation automatically.
Use the code below to get started:
1import torch
2from transformers import AutoModelForSeq2SeqLM, PreTrainedTokenizerFast
3
4repo_id = "telecomadm1145/NanoSakura-2.3-0.2B"
5device = "cuda" if torch.cuda.is_available() else "cpu"
6tokenizer = PreTrainedTokenizerFast.from_pretrained(repo_id)
7model = AutoModelForSeq2SeqLM.from_pretrained(
8 repo_id,
9 trust_remote_code=True,
10 dtype=torch.float32
11)
12model.to(device)
13
14text = "おはようございます、今日の天気はいいですね!"
15input_ids = tokenizer.encode(text + "<eos>")
16input_tensor = torch.tensor([input_ids]).to(device)
17
18output_ids = model.generate(
19 input_tensor,
20 max_new_tokens=256,
21)
22result = tokenizer.decode(output_ids[0], skip_special_tokens=True)
23print(f"Translation: {result}")
24# Output: 早安,今天的天气真好呢!
Evaluation
We evaluated the model on the FLORES-200 benchmark (Japanese to Chinese, ja-zh) and a testset(shard_00134). To provide a comprehensive assessment, we report both lexical-overlap metrics (SacreBLEU) and semantic-similarity neural metrics (COMET).
Metrics
| Metric | opus-mt-ja-zh(~73M) | NanoSakura-2-0.2B | NanoSakura-2.2-0.2B | NanoSakura-2.3-0.2B | NanoSakura-0.3B | nllb-200-1.3B | Qwen3-0.6B(fp16) | Qwen3-0.6B(fp16,thinking) | Qwen3-1.7B(fp16) | Qwen3-1.7B(fp16,thinking) |
|---|
| FLORES-200 BLEU | 25.67 | 23.27 | 26.55 | 28.67 | 22.36 | 20.87 | 12.58 | 21.13 | 27.12 | 27.56 |
| FLORES-200 COMET | 0.8371 | 0.8380 | 0.8494 | 0.8563 | 0.8307 | 0.7805 | 0.8020 | 0.8220 | 0.8561 | 0.8571 |
| shard_00134 BLEU | 8.07 | 58.13 | 57.55 | 49.32 | 58.71 | 5.73 | 6.89 | 14.57 | 23.37 | 24.60 |
| shard_00134 COMET | 0.4493 | 0.8615 | 0.8608 | 0.8558 | 0.8654 | 0.5181 | 0.6930 | 0.7414 | 0.8158 | 0.8182 |
All evaluated using greedy decoding.