SWA-RetNet-v2-0.5B-Tide (汐 / Tide)
Bilingual ZH+EN chat and controllable-thinking checkpoint (SFT v3) trained from scratch on top of Ayaka157/SWA-RetNet-v2-0.5B-Base.
| Spec | Value |
|---|---|
| Parameters | 513,081,852 (tied embeddings) |
| Architecture | 24 layers = 19 Multi-Scale Gated Delta-Retention + 5 Local SWA GQA ([4, 9, 14, 19, 23], W=512) |
| Width | d_model=1280, 10 heads (head_dim=128, kv_heads=2), SwiGLU 3200, depthwise conv k=4 |
| Vocabulary / Context | 32,768 bilingual BPE (tokenizer_32k.json) / 4,096 context |
| Inference memory | O(1) recurrent state + W=512 ring buffer (no global KV cache) |
| Precision | model.safetensors stored in fp32; load in bf16 for inference |
SHA256 (model.safetensors) | a87f34ce85fb6dc1087cfa0f817e7268a7db22ea27ced9ee659e78f7febd9a5d |
Training summary
- Base:
SWA-RetNet-v2-0.5B-Base(5.45Bunique bilingual tokens, 4k val CE2.6035). - SFT v3 corpus:
132,919clean bilingual conversations (97.10Msupervised tokens), including16,370open-domain bilingual CoT rows mapped to reserved special tokens8:<|think|>/9:<|/think|>,5,000short-turn predicate-switch anti-echo dialogues,11,681long-context update/correction trajectories with filler turns masked out (code=2), and12,0004k pretrain replay rows. - Schedule:
5,600steps (64 seq/step, 2×RTX PRO 6000 DDP, BF16, cosine3e-5 -> 2.5e-6). - Held-out SFT v3 validation (
step 0 -> 5,600):weighted 2.6619 -> 1.6366,dialogue 2.3847 -> 1.7677,tide 2.6582 -> 1.7376,memory 3.5924 -> 0.0168,lm 2.6101 -> 2.6420. - 4k beyond-SWA two-arm context gain (
512vs4096on final 256 tokens): ENΔ_marginal = +0.0565(95% CI[+0.0236, +0.1025]), ZHΔ_marginal = +0.0254([+0.0112, +0.0445]).
Chat format and 5-mode thinking
Special token IDs in tokenizer_32k.json: 1:<|bos|>, 2:<|eos|>, 3:<|im_start|>, 4:<|im_end|>, 5:<|system|>, 6:<|user|>, 7:<|assistant|>, 8:<|think|>, 9:<|/think|>.
Append one control tag to the system prompt to select thinking depth:
[思考:关闭]/[Thinking: off]— direct answer (mask token8during decoding)[思考:自动]/[Thinking: auto]— direct on casual chat, concise<|think|>on reasoning/updates[思考:轻]/[Thinking: low]— brief reasoning (≤160tok)[思考:中]/[Thinking: medium]— multi-step reasoning (≤420tok)[思考:深]/[Thinking: high]— thorough derivation (≤1024tok)
Usage
Load with modeling_retnet_v2.py (included in this repo and at github.com/Ayaka157/RetNet):
import torch
from tokenizers import Tokenizer
from modeling_retnet_v2 import RetNetV2ForCausalLM
tok = Tokenizer.from_file("tokenizer_32k.json")
model = RetNetV2ForCausalLM.from_pretrained(".", use_fla=False, use_liger=False, use_flex_swa=False)
model = model.to("cuda", dtype=torch.bfloat16).eval()
For full streaming chat and 5-mode thinking guardrails, see serve/v2_runtime.py in the GitHub repository.
Limitations
- This is a 0.5B model trained from scratch on ~5.45B pretraining tokens; complex arithmetic, multi-hop factual recall, and rigorous technical derivations remain error-prone.
- Raw synthetic exact-digit needle extraction beyond
W=512stays low; semantic multi-turn fact updates and role corrections across 1k–2.5k tokens work reliably.
Technical Reports
- English (EN-US): SWA-RetNet-v2-Tide-Technical-Report-EN-US.pdf (16 pages)
- 中文 (ZH-CN): SWA-RetNet-v2-Tide-Technical-Report-ZH-CN.pdf (15 pages)