Text Generation
Transformers
Safetensors
PyTorch
English
recursive_language_model
transformer
recursive-language-model
mixture-of-recursion
adaptive-computation
perplexity-routing
self-supervised-perplexity-guided-adaptive-compute
custom_code
Instructions to use Girinath11/recursive-language-model-198m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Girinath11/recursive-language-model-198m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Girinath11/recursive-language-model-198m", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Girinath11/recursive-language-model-198m", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Girinath11/recursive-language-model-198m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Girinath11/recursive-language-model-198m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Girinath11/recursive-language-model-198m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Girinath11/recursive-language-model-198m
- SGLang
How to use Girinath11/recursive-language-model-198m 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 "Girinath11/recursive-language-model-198m" \ --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": "Girinath11/recursive-language-model-198m", "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 "Girinath11/recursive-language-model-198m" \ --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": "Girinath11/recursive-language-model-198m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Girinath11/recursive-language-model-198m with Docker Model Runner:
docker model run hf.co/Girinath11/recursive-language-model-198m
Update README.md
Browse files
README.md
CHANGED
|
@@ -27,7 +27,7 @@ pipeline_tag: text-generation
|
|
| 27 |
|
| 28 |
---
|
| 29 |
|
| 30 |
-
##
|
| 31 |
|
| 32 |
Traditional transformers apply the same depth to every input β simple and complex sentences both
|
| 33 |
go through all N layers. This wastes compute on easy inputs and under-processes hard ones.
|
|
@@ -101,16 +101,16 @@ GPT-2 Medium evaluated on identical samples for fair comparison:
|
|
| 101 |
### What the Results Actually Show
|
| 102 |
|
| 103 |
```
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
```
|
| 110 |
|
| 111 |
---
|
| 112 |
|
| 113 |
-
##
|
| 114 |
|
| 115 |
```bash
|
| 116 |
pip install transformers torch
|
|
@@ -166,7 +166,7 @@ print(chat("Explain neural networks simply"))
|
|
| 166 |
|
| 167 |
---
|
| 168 |
|
| 169 |
-
##
|
| 170 |
|
| 171 |
### Dataset β 150K Conversational Samples
|
| 172 |
|
|
@@ -203,7 +203,7 @@ Loss:
|
|
| 203 |
|
| 204 |
---
|
| 205 |
|
| 206 |
-
##
|
| 207 |
|
| 208 |
### Self-Supervised Perplexity Routing
|
| 209 |
|
|
@@ -230,21 +230,21 @@ This model is my **first from-scratch LLM** β I learned a lot:
|
|
| 230 |
|
| 231 |
```
|
| 232 |
What worked:
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
|
| 238 |
What needs improvement:
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
```
|
| 244 |
|
| 245 |
---
|
| 246 |
|
| 247 |
-
##
|
| 248 |
|
| 249 |
- **Context window**: 512 tokens max
|
| 250 |
- **English only**: Not suitable for other languages
|
|
@@ -255,20 +255,20 @@ What needs improvement:
|
|
| 255 |
|
| 256 |
---
|
| 257 |
|
| 258 |
-
##
|
| 259 |
|
| 260 |
| Use case | Suitable? |
|
| 261 |
|---|---|
|
| 262 |
-
| Research on adaptive computation |
|
| 263 |
-
| Learning how LLMs are built from scratch |
|
| 264 |
-
| Prototyping conversational AI |
|
| 265 |
-
| Production chatbots |
|
| 266 |
-
| Medical / legal / financial advice |
|
| 267 |
-
| Factual question answering |
|
| 268 |
|
| 269 |
---
|
| 270 |
|
| 271 |
-
##
|
| 272 |
|
| 273 |
```bibtex
|
| 274 |
@misc{girinath2026mor,
|
|
@@ -285,7 +285,7 @@ What needs improvement:
|
|
| 285 |
|
| 286 |
---
|
| 287 |
|
| 288 |
-
##
|
| 289 |
|
| 290 |
- Anthropic β HH-RLHF dataset
|
| 291 |
- Tsinghua University β UltraChat dataset
|
|
@@ -295,6 +295,6 @@ What needs improvement:
|
|
| 295 |
|
| 296 |
---
|
| 297 |
|
| 298 |
-
**Model status** :
|
| 299 |
**Last updated** : March 2026
|
| 300 |
**License** : MIT
|
|
|
|
| 27 |
|
| 28 |
---
|
| 29 |
|
| 30 |
+
## Novel Architecture: Mixture of Recursion (MoR)
|
| 31 |
|
| 32 |
Traditional transformers apply the same depth to every input β simple and complex sentences both
|
| 33 |
go through all N layers. This wastes compute on easy inputs and under-processes hard ones.
|
|
|
|
| 101 |
### What the Results Actually Show
|
| 102 |
|
| 103 |
```
|
| 104 |
+
Architecture works β training is stable, loss decreases
|
| 105 |
+
Router works β 0 NaN batches, routing signals valid
|
| 106 |
+
Novel contribution β perplexity-based self-supervised routing
|
| 107 |
+
Generalization gap β val PPL 15.37 vs test PPL 43.21
|
| 108 |
+
More data needed β 150K samples is small for this model size
|
| 109 |
```
|
| 110 |
|
| 111 |
---
|
| 112 |
|
| 113 |
+
## Quick Start
|
| 114 |
|
| 115 |
```bash
|
| 116 |
pip install transformers torch
|
|
|
|
| 166 |
|
| 167 |
---
|
| 168 |
|
| 169 |
+
## Training Details
|
| 170 |
|
| 171 |
### Dataset β 150K Conversational Samples
|
| 172 |
|
|
|
|
| 203 |
|
| 204 |
---
|
| 205 |
|
| 206 |
+
## Technical Innovation
|
| 207 |
|
| 208 |
### Self-Supervised Perplexity Routing
|
| 209 |
|
|
|
|
| 230 |
|
| 231 |
```
|
| 232 |
What worked:
|
| 233 |
+
NaN-safe attention masking (-1e4)
|
| 234 |
+
Self-supervised routing signal
|
| 235 |
+
Stable FP16 training (0 NaN batches)
|
| 236 |
+
Perplexity drops meaningfully across epochs
|
| 237 |
|
| 238 |
What needs improvement:
|
| 239 |
+
More diverse training data (150K is small)
|
| 240 |
+
Longer training (2 epochs not enough)
|
| 241 |
+
Stronger regularization to prevent overfitting
|
| 242 |
+
Better evaluation on neutral benchmarks from day 1
|
| 243 |
```
|
| 244 |
|
| 245 |
---
|
| 246 |
|
| 247 |
+
## Limitations
|
| 248 |
|
| 249 |
- **Context window**: 512 tokens max
|
| 250 |
- **English only**: Not suitable for other languages
|
|
|
|
| 255 |
|
| 256 |
---
|
| 257 |
|
| 258 |
+
## Intended Use
|
| 259 |
|
| 260 |
| Use case | Suitable? |
|
| 261 |
|---|---|
|
| 262 |
+
| Research on adaptive computation | Yes |
|
| 263 |
+
| Learning how LLMs are built from scratch | Yes |
|
| 264 |
+
| Prototyping conversational AI | With caveats |
|
| 265 |
+
| Production chatbots | No |
|
| 266 |
+
| Medical / legal / financial advice | No |
|
| 267 |
+
| Factual question answering | No |
|
| 268 |
|
| 269 |
---
|
| 270 |
|
| 271 |
+
## Citation
|
| 272 |
|
| 273 |
```bibtex
|
| 274 |
@misc{girinath2026mor,
|
|
|
|
| 285 |
|
| 286 |
---
|
| 287 |
|
| 288 |
+
## Acknowledgments
|
| 289 |
|
| 290 |
- Anthropic β HH-RLHF dataset
|
| 291 |
- Tsinghua University β UltraChat dataset
|
|
|
|
| 295 |
|
| 296 |
---
|
| 297 |
|
| 298 |
+
**Model status** : Research / Educational use
|
| 299 |
**Last updated** : March 2026
|
| 300 |
**License** : MIT
|