Text Generation
Transformers
Safetensors
English
moeloop
looptitan
mixture-of-experts
Mixture of Experts
looped-moe
looped-transformer
looped-language-model
recurrent-depth
weight-sharing
custom_code
adamw
conversational
Eval Results (legacy)
Instructions to use NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW
- SGLang
How to use NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW 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 "NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW with Docker Model Runner:
docker model run hf.co/NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW
Update the model card
Browse files- README.md +18 -16
- assets/standing-dark-narrow.svg +2 -2
- assets/standing-dark.svg +2 -2
- assets/standing-light-narrow.svg +2 -2
- assets/standing-light.svg +2 -2
README.md
CHANGED
|
@@ -11,7 +11,7 @@ tags:
|
|
| 11 |
datasets:
|
| 12 |
- "mlfoundations/dclm-baseline-1.0-parquet"
|
| 13 |
model-index:
|
| 14 |
-
- name: "
|
| 15 |
results:
|
| 16 |
- task:
|
| 17 |
type: text-generation
|
|
@@ -30,14 +30,16 @@ model-index:
|
|
| 30 |
<div class="hidden md:block"><p align="center"><img class="not-prose dark:hidden" src="assets/banner-light.svg" width="720" alt="12 layers stored, 18 run"><img class="not-prose hidden dark:block" src="assets/banner-dark.svg" width="720" alt="12 layers stored, 18 run"></p></div>
|
| 31 |
<div class="md:hidden"><p align="center"><img class="not-prose dark:hidden" src="assets/banner-light-narrow.svg" width="360" alt="12 layers stored, 18 run"><img class="not-prose hidden dark:block" src="assets/banner-dark-narrow.svg" width="360" alt="12 layers stored, 18 run"></p></div>
|
| 32 |
|
| 33 |
-
<p align="center" class="not-prose dark:hidden" style="margin:1.5em 0"><img class="not-prose inline-block" src="assets/capsule-homepage-light.svg" height="32" alt="Homepage"><a href="https://github.com/datamllab/LoopTitan"><img class="not-prose inline-block" src="assets/capsule-code-light.svg" height="32" alt="Code"></a><a href="https://github.com/datamllab/LoopTitan/tree/main/docs"><img class="not-prose inline-block" src="assets/capsule-docs-light.svg" height="32" alt="Documentation"></a><img class="not-prose inline-block" src="assets/capsule-models-light.svg" height="32" alt="Models"><img class="not-prose inline-block" src="assets/capsule-paper-light.svg" height="32" alt="Paper"><a href="https://github.com/datamllab/LoopTitan/blob/main/docs/results/phase1.md"><img class="not-prose inline-block" src="assets/capsule-results-light.svg" height="32" alt="Results"></a></p>
|
| 34 |
-
<p align="center" class="not-prose hidden dark:block" style="margin:1.5em 0"><img class="not-prose inline-block" src="assets/capsule-homepage-dark.svg" height="32" alt="Homepage"><a href="https://github.com/datamllab/LoopTitan"><img class="not-prose inline-block" src="assets/capsule-code-dark.svg" height="32" alt="Code"></a><a href="https://github.com/datamllab/LoopTitan/tree/main/docs"><img class="not-prose inline-block" src="assets/capsule-docs-dark.svg" height="32" alt="Documentation"></a><img class="not-prose inline-block" src="assets/capsule-models-dark.svg" height="32" alt="Models"><img class="not-prose inline-block" src="assets/capsule-paper-dark.svg" height="32" alt="Paper"><a href="https://github.com/datamllab/LoopTitan/blob/main/docs/results/phase1.md"><img class="not-prose inline-block" src="assets/capsule-results-dark.svg" height="32" alt="Results"></a></p>
|
| 35 |
|
| 36 |
-
# Looped
|
| 37 |
|
| 38 |
**AdamW** 路 LoopTitan Phase 1 路 design 6 of 8, each trained with AdamW and with Muon
|
| 39 |
|
| 40 |
-
Chain-end loop: 12 layers at width 1056, 88 experts per layer, expert hidden size 384; the middle 6 looped twice, residual 脳0.5; every part shared across visits. A base language model trained from scratch, not instruction tuned.
|
|
|
|
|
|
|
| 41 |
|
| 42 |
## Results
|
| 43 |
|
|
@@ -45,8 +47,8 @@ Chain-end loop: 12 layers at width 1056, 88 experts per layer, expert hidden siz
|
|
| 45 |
|---:|---:|---:|
|
| 46 |
| 0.990544 | 0.992211 | -8.99 mBPB |
|
| 47 |
|
| 48 |
-
<div class="hidden md:block"><p align="center"><img class="not-prose dark:hidden" src="assets/standing-light.svg" width="720" alt="Test mBPB of the 8 designs of this release against the standard MoE, by optimizer: Standard MoE: AdamW +0.0, Muon +0.0; Finer experts: AdamW -4.2, Muon -0.9; Deeper, narrower: AdamW -6.9, Muon -4.2; Expert layout: AdamW -5.9, Muon -3.4;
|
| 49 |
-
<div class="md:hidden"><p align="center"><img class="not-prose dark:hidden" src="assets/standing-light-narrow.svg" width="360" alt="Test mBPB of the 8 designs of this release against the standard MoE, by optimizer: Standard MoE: AdamW +0.0, Muon +0.0; Finer experts: AdamW -4.2, Muon -0.9; Deeper, narrower: AdamW -6.9, Muon -4.2; Expert layout: AdamW -5.9, Muon -3.4;
|
| 50 |
|
| 51 |
Bits per byte on the complete held-out test and validation splits after the last update; lower is better. The standard MoE is [`recipes/phase1/m0-adamw.json`](https://github.com/datamllab/LoopTitan/blob/main/recipes/phase1/m0-adamw.json); 1 mBPB is 0.001 BPB.
|
| 52 |
|
|
@@ -67,7 +69,7 @@ Matched budgets: all three within 5% of the standard MoE (AdamW).
|
|
| 67 |
import torch
|
| 68 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 69 |
|
| 70 |
-
repo = "NaturalScale/
|
| 71 |
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
|
| 72 |
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True).eval()
|
| 73 |
ids = torch.tensor([[tokenizer.bos_token_id] + tokenizer.encode("The model", add_special_tokens=False)])
|
|
@@ -83,14 +85,14 @@ The model runs Python code from this repository: read it first, or pin `revision
|
|
| 83 |
|
| 84 |
| Design | AdamW | Muon |
|
| 85 |
|:---|---:|---:|
|
| 86 |
-
| Standard MoE, 12 layers | [0.9995](https://huggingface.co/NaturalScale/
|
| 87 |
-
| Standard MoE with finer experts | [0.9953](https://huggingface.co/NaturalScale/
|
| 88 |
-
| Standard MoE, deeper and narrower, 18 layers | [0.9926](https://huggingface.co/NaturalScale/
|
| 89 |
-
| Standard MoE, 18 layers, fewer experts in the middle | [0.9936](https://huggingface.co/NaturalScale/
|
| 90 |
-
|
|
| 91 |
-
| Looped MoE: the middle 6 layers run twice | **0.9905** | [0.9707](https://huggingface.co/NaturalScale/
|
| 92 |
-
| Standard MoE with one more visit, outside matched budgets | [0.9847](https://huggingface.co/NaturalScale/
|
| 93 |
-
| Standard MoE with twice the experts, outside matched budgets | [0.9852](https://huggingface.co/NaturalScale/
|
| 94 |
|
| 95 |
## Citation
|
| 96 |
|
|
|
|
| 11 |
datasets:
|
| 12 |
- "mlfoundations/dclm-baseline-1.0-parquet"
|
| 13 |
model-index:
|
| 14 |
+
- name: "LoopTitan-Looped-1.3B-A0.2B-AdamW"
|
| 15 |
results:
|
| 16 |
- task:
|
| 17 |
type: text-generation
|
|
|
|
| 30 |
<div class="hidden md:block"><p align="center"><img class="not-prose dark:hidden" src="assets/banner-light.svg" width="720" alt="12 layers stored, 18 run"><img class="not-prose hidden dark:block" src="assets/banner-dark.svg" width="720" alt="12 layers stored, 18 run"></p></div>
|
| 31 |
<div class="md:hidden"><p align="center"><img class="not-prose dark:hidden" src="assets/banner-light-narrow.svg" width="360" alt="12 layers stored, 18 run"><img class="not-prose hidden dark:block" src="assets/banner-dark-narrow.svg" width="360" alt="12 layers stored, 18 run"></p></div>
|
| 32 |
|
| 33 |
+
<p align="center" class="not-prose dark:hidden" style="margin:1.5em 0"><a href="https://datamllab.github.io/LoopTitan/"><img class="not-prose inline-block" src="assets/capsule-homepage-light.svg" height="32" alt="Homepage"></a><a href="https://github.com/datamllab/LoopTitan"><img class="not-prose inline-block" src="assets/capsule-code-light.svg" height="32" alt="Code"></a><a href="https://github.com/datamllab/LoopTitan/tree/main/docs"><img class="not-prose inline-block" src="assets/capsule-docs-light.svg" height="32" alt="Documentation"></a><img class="not-prose inline-block" src="assets/capsule-models-light.svg" height="32" alt="Models"><img class="not-prose inline-block" src="assets/capsule-paper-light.svg" height="32" alt="Paper"><a href="https://github.com/datamllab/LoopTitan/blob/main/docs/results/phase1.md"><img class="not-prose inline-block" src="assets/capsule-results-light.svg" height="32" alt="Results"></a></p>
|
| 34 |
+
<p align="center" class="not-prose hidden dark:block" style="margin:1.5em 0"><a href="https://datamllab.github.io/LoopTitan/"><img class="not-prose inline-block" src="assets/capsule-homepage-dark.svg" height="32" alt="Homepage"></a><a href="https://github.com/datamllab/LoopTitan"><img class="not-prose inline-block" src="assets/capsule-code-dark.svg" height="32" alt="Code"></a><a href="https://github.com/datamllab/LoopTitan/tree/main/docs"><img class="not-prose inline-block" src="assets/capsule-docs-dark.svg" height="32" alt="Documentation"></a><img class="not-prose inline-block" src="assets/capsule-models-dark.svg" height="32" alt="Models"><img class="not-prose inline-block" src="assets/capsule-paper-dark.svg" height="32" alt="Paper"><a href="https://github.com/datamllab/LoopTitan/blob/main/docs/results/phase1.md"><img class="not-prose inline-block" src="assets/capsule-results-dark.svg" height="32" alt="Results"></a></p>
|
| 35 |
|
| 36 |
+
# LoopTitan-Looped-1.3B-A0.2B-AdamW
|
| 37 |
|
| 38 |
**AdamW** 路 LoopTitan Phase 1 路 design 6 of 8, each trained with AdamW and with Muon
|
| 39 |
|
| 40 |
+
Chain-end loop: 12 layers at width 1056, 88 experts per layer, expert hidden size 384; the middle 6 looped twice, residual 脳0.5; every part shared across visits. A base language model trained from scratch, not instruction tuned. In the paper: looped MoE.
|
| 41 |
+
|
| 42 |
+
1.31B parameters stored without embeddings, 1.64B with the input embedding and output head (the count Hugging Face shows), 0.22B active per token, each visit of the looped layers counted.
|
| 43 |
|
| 44 |
## Results
|
| 45 |
|
|
|
|
| 47 |
|---:|---:|---:|
|
| 48 |
| 0.990544 | 0.992211 | -8.99 mBPB |
|
| 49 |
|
| 50 |
+
<div class="hidden md:block"><p align="center"><img class="not-prose dark:hidden" src="assets/standing-light.svg" width="720" alt="Test mBPB of the 8 designs of this release against the standard MoE, by optimizer: Standard MoE: AdamW +0.0, Muon +0.0; Finer experts: AdamW -4.2, Muon -0.9; Deeper, narrower: AdamW -6.9, Muon -4.2; Expert layout: AdamW -5.9, Muon -3.4; Unrolled: AdamW -8.9, Muon -3.3; The loop: AdamW -9.0, Muon -3.7; One more visit: AdamW -14.8, Muon -12.2; Twice the experts: AdamW -14.3, Muon -9.9."><img class="not-prose hidden dark:block" src="assets/standing-dark.svg" width="720" alt="Test mBPB of the 8 designs of this release against the standard MoE, by optimizer: Standard MoE: AdamW +0.0, Muon +0.0; Finer experts: AdamW -4.2, Muon -0.9; Deeper, narrower: AdamW -6.9, Muon -4.2; Expert layout: AdamW -5.9, Muon -3.4; Unrolled: AdamW -8.9, Muon -3.3; The loop: AdamW -9.0, Muon -3.7; One more visit: AdamW -14.8, Muon -12.2; Twice the experts: AdamW -14.3, Muon -9.9."></p></div>
|
| 51 |
+
<div class="md:hidden"><p align="center"><img class="not-prose dark:hidden" src="assets/standing-light-narrow.svg" width="360" alt="Test mBPB of the 8 designs of this release against the standard MoE, by optimizer: Standard MoE: AdamW +0.0, Muon +0.0; Finer experts: AdamW -4.2, Muon -0.9; Deeper, narrower: AdamW -6.9, Muon -4.2; Expert layout: AdamW -5.9, Muon -3.4; Unrolled: AdamW -8.9, Muon -3.3; The loop: AdamW -9.0, Muon -3.7; One more visit: AdamW -14.8, Muon -12.2; Twice the experts: AdamW -14.3, Muon -9.9."><img class="not-prose hidden dark:block" src="assets/standing-dark-narrow.svg" width="360" alt="Test mBPB of the 8 designs of this release against the standard MoE, by optimizer: Standard MoE: AdamW +0.0, Muon +0.0; Finer experts: AdamW -4.2, Muon -0.9; Deeper, narrower: AdamW -6.9, Muon -4.2; Expert layout: AdamW -5.9, Muon -3.4; Unrolled: AdamW -8.9, Muon -3.3; The loop: AdamW -9.0, Muon -3.7; One more visit: AdamW -14.8, Muon -12.2; Twice the experts: AdamW -14.3, Muon -9.9."></p></div>
|
| 52 |
|
| 53 |
Bits per byte on the complete held-out test and validation splits after the last update; lower is better. The standard MoE is [`recipes/phase1/m0-adamw.json`](https://github.com/datamllab/LoopTitan/blob/main/recipes/phase1/m0-adamw.json); 1 mBPB is 0.001 BPB.
|
| 54 |
|
|
|
|
| 69 |
import torch
|
| 70 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 71 |
|
| 72 |
+
repo = "NaturalScale/LoopTitan-Looped-1.3B-A0.2B-AdamW"
|
| 73 |
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
|
| 74 |
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True).eval()
|
| 75 |
ids = torch.tensor([[tokenizer.bos_token_id] + tokenizer.encode("The model", add_special_tokens=False)])
|
|
|
|
| 85 |
|
| 86 |
| Design | AdamW | Muon |
|
| 87 |
|:---|---:|---:|
|
| 88 |
+
| Standard MoE, 12 layers | [0.9995](https://huggingface.co/NaturalScale/LoopTitan-MoE12-1.3B-A0.2B-AdamW) | [0.9744](https://huggingface.co/NaturalScale/LoopTitan-MoE12-1.3B-A0.2B-Muon) |
|
| 89 |
+
| Standard MoE with finer experts | [0.9953](https://huggingface.co/NaturalScale/LoopTitan-MoE12-FineExperts-1.3B-A0.2B-AdamW) | [0.9735](https://huggingface.co/NaturalScale/LoopTitan-MoE12-FineExperts-1.3B-A0.2B-Muon) |
|
| 90 |
+
| Standard MoE, deeper and narrower, 18 layers | [0.9926](https://huggingface.co/NaturalScale/LoopTitan-MoE18-1.3B-A0.2B-AdamW) | [0.9702](https://huggingface.co/NaturalScale/LoopTitan-Base-1.3B-A0.2B) |
|
| 91 |
+
| Standard MoE, 18 layers, fewer experts in the middle | [0.9936](https://huggingface.co/NaturalScale/LoopTitan-MoE18-Layout-1.3B-A0.2B-AdamW) | [0.9710](https://huggingface.co/NaturalScale/LoopTitan-MoE18-Layout-1.3B-A0.2B-Muon) |
|
| 92 |
+
| The looped MoE unrolled: 18 layers, no weights shared | [0.9906](https://huggingface.co/NaturalScale/LoopTitan-Unrolled-1.3B-A0.2B-AdamW) | [0.9710](https://huggingface.co/NaturalScale/LoopTitan-Unrolled-1.3B-A0.2B-Muon) |
|
| 93 |
+
| Looped MoE: the middle 6 layers run twice | **0.9905** | [0.9707](https://huggingface.co/NaturalScale/LoopTitan-Looped-1.3B-A0.2B-Muon) |
|
| 94 |
+
| Standard MoE with one more visit, outside matched budgets | [0.9847](https://huggingface.co/NaturalScale/LoopTitan-MoE12-Revisit-1.3B-A0.3B-AdamW) | [0.9621](https://huggingface.co/NaturalScale/LoopTitan-MoE12-Revisit-1.3B-A0.3B-Muon) |
|
| 95 |
+
| Standard MoE with twice the experts, outside matched budgets | [0.9852](https://huggingface.co/NaturalScale/LoopTitan-MoE12-2xExperts-2.6B-A0.2B-AdamW) | [0.9645](https://huggingface.co/NaturalScale/LoopTitan-MoE12-2xExperts-2.6B-A0.2B-Muon) |
|
| 96 |
|
| 97 |
## Citation
|
| 98 |
|
assets/standing-dark-narrow.svg
CHANGED
|
|
|
|
assets/standing-dark.svg
CHANGED
|
|
|
|
assets/standing-light-narrow.svg
CHANGED
|
|
|
|
assets/standing-light.svg
CHANGED
|
|
|
|