Instructions to use Ayaka157/RetNet-0.5B-v21.1-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ayaka157/RetNet-0.5B-v21.1-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ayaka157/RetNet-0.5B-v21.1-chat")# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Ayaka157/RetNet-0.5B-v21.1-chat", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Ayaka157/RetNet-0.5B-v21.1-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ayaka157/RetNet-0.5B-v21.1-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ayaka157/RetNet-0.5B-v21.1-chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ayaka157/RetNet-0.5B-v21.1-chat
- SGLang
How to use Ayaka157/RetNet-0.5B-v21.1-chat with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Ayaka157/RetNet-0.5B-v21.1-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ayaka157/RetNet-0.5B-v21.1-chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Ayaka157/RetNet-0.5B-v21.1-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ayaka157/RetNet-0.5B-v21.1-chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ayaka157/RetNet-0.5B-v21.1-chat with Docker Model Runner:
docker model run hf.co/Ayaka157/RetNet-0.5B-v21.1-chat
RetNet-0.5B v21.1-chat β served chat model
Status: usable with caveats β chat-val 2.2573, held-out 2.5898.
Repository (code, analysis, report): https://github.com/Ayaka157/RetNet
Technical report (2026-10-29): https://github.com/Ayaka157/RetNet/blob/main/docs/latex/en/RetNet-0.5B-Technical-Report.pdf
Model
| Parameters | 504,179,896 |
| Architecture | RetNet (retention), 20 layers, width 1408, 22 heads, value/FFN dim 2816 |
| Vocabulary / context | 20,000 ByteLevel BPE / 2048 training context |
| Decay | per-head learned $\gamma$; GLA branch implemented but gla_rank=0 |
| Precision | stored as fp32 safetensors (1.92 GB); load with orch_dtype=torch.bfloat16 for inference |
Files
config.json, model.safetensors, modeling_retnet.py, retention_fast.py,
fused_ce.py, tokenizer files. The modeling files come from the published RetNet codebase and are
provided so the checkpoint can be loaded with trust_remote_code=True.
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("Ayaka157/RetNet-0.5B-v21.1-chat", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Ayaka157/RetNet-0.5B-v21.1-chat", trust_remote_code=True,
torch_dtype="bfloat16")
For serving/prefill use the parallel form, training uses chunkwise, decoding uses recurrent
(RETNET_FAST_CHUNKWISE=1 for batched chunkwise). The demo: https://retnet.ayaka157.icu/play/
Evidence and limitations
This is the model behind the play page. It is trained with only 0.328 B chat tokens (0.593 epoch), and the chat data is dominated by long continuations and unclosed <think> blocks. It needs an explicit concise system prompt; without one it often hits the generation cap. Local arithmetic is 0/4 and factual knowledge is weak; use it as a demo, not as a knowledge worker.
Links
- Code, data tooling, evaluation scripts, and the full analysis: https://github.com/Ayaka157/RetNet
- 2026-10-29 technical report (English / Chinese PDFs) in the headline repository.
- Downloads last month
- 122