Text Generation
Transformers
Safetensors
code
English
anveshai_coderlm
causal-lm
anveshai
coderlm
anvarc
mingru
differential-attention
multi-language
fim
2k-context
edge
on-device
mobile
custom_code
Instructions to use AnveshAI/AnveshAI-CoderLM-0.1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AnveshAI/AnveshAI-CoderLM-0.1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AnveshAI/AnveshAI-CoderLM-0.1B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("AnveshAI/AnveshAI-CoderLM-0.1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AnveshAI/AnveshAI-CoderLM-0.1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AnveshAI/AnveshAI-CoderLM-0.1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AnveshAI/AnveshAI-CoderLM-0.1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AnveshAI/AnveshAI-CoderLM-0.1B
- SGLang
How to use AnveshAI/AnveshAI-CoderLM-0.1B 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 "AnveshAI/AnveshAI-CoderLM-0.1B" \ --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": "AnveshAI/AnveshAI-CoderLM-0.1B", "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 "AnveshAI/AnveshAI-CoderLM-0.1B" \ --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": "AnveshAI/AnveshAI-CoderLM-0.1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AnveshAI/AnveshAI-CoderLM-0.1B with Docker Model Runner:
docker model run hf.co/AnveshAI/AnveshAI-CoderLM-0.1B
File size: 13,299 Bytes
bcf1f81 288d563 bcf1f81 288d563 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | ---
license: apache-2.0
language:
- code
- en
library_name: transformers
pipeline_tag: text-generation
tags:
- code
- causal-lm
- anveshai
- coderlm
- anvarc
- mingru
- differential-attention
- multi-language
- fim
- 2k-context
- edge
- on-device
- mobile
model-index:
- name: AnveshAI-CoderLM-0.1B
results: []
---
<div align="center">
<picture>
<img src="logo.png" width="50%" alt="AnveshAI CoderLM 0.1B">
</picture>
</div>
<hr>
<div align="center" style="line-height: 1;">
<a href="https://huggingface.co/AnveshAI" target="_blank"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-AnveshAI-ffc107?color=ffc107&logoColor=white"/></a>
<a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue?logoColor=white"/></a>
</div>
<div align="center" style="line-height: 1;">
<a href="#"><img src="https://img.shields.io/badge/Parameters-100.2M-blue" alt="Parameters"></a>
<img src="https://img.shields.io/badge/Architecture-AnvArc-green" alt="Architecture">
<img src="https://img.shields.io/badge/Languages-13_Languages-orange" alt="Languages">
<img src="https://img.shields.io/badge/Context-2048_tokens-purple" alt="Context Length">
<img src="https://img.shields.io/badge/Precision-FP16-red" alt="Precision">
<img src="https://img.shields.io/badge/Research%20Paper-Coming%20Soon-white">
</div>
**CoderLM** is a compact 100.2M-parameter language model purpose-built for multi-language code generation across **13 programming and markup languages** β Python, Java, JavaScript, C++, C, Rust, TypeScript, Go, HTML, CSS, Shell, SQL, and Markdown. Built on the custom **AnvArc** (AnveshAI Architecture) β a 15-layer hybrid architecture combining **10Γ ParallelMinGRU** linear recurrence and **5Γ Differential Grouped-Query Attention (DifferentialGQA)** β CoderLM delivers high-efficiency code generation and fill-in-the-middle infilling with an expanded **2,048-token context window**.
**Small enough to run on any device β including edge devices like smartphones, tablets, Raspberry Pi, and other embedded hardware.** At just ~191MB (FP16), CoderLM brings multi-language code generation to devices where larger models simply can't run. No high-end GPU required β it runs comfortably on CPU or mobile accelerators.
---
## Highlights
- **100.2M parameters** (87.6M non-embedding) β ultra-compact model with tied input/output embeddings
- **~191MB model size** (FP16 `model.safetensors`) β fits easily in RAM on edge devices and consumer hardware
- **AnvArc Hybrid Architecture** β 10Γ ParallelMinGRU linear recurrent blocks + 5Γ DifferentialGQA with RoPE
- **4Γ Extended Context (2,048 tokens)** β trained on full 2K sequences with stable perplexity scaling across all lengths
- **13 languages supported** β Python, Java, JavaScript, C++, C, Rust, TypeScript, Go, HTML, CSS, Shell, SQL, Markdown
- **18.7% Loss Reduction over 10K Baseline** β weighted multi-language loss improved from 1.1637 down to **0.9463** (Perplexity: **2.58**)
- **Isolated-newline 16K BPE tokenizer** β strict indentation and newline preservation (`Split(Regex(r"\n"), behavior="isolated")`)
- **Task & language-oriented special tokens** β routing with `<|lang:xyz|>` tokens and Fill-in-the-Middle (`<|fim_prefix|>`, `<|fim_middle|>`, `<|fim_suffix|>`)
---
## Model Details
| Property | Value |
|----------|-------|
| **Model Name** | AnveshAI CoderLM 0.1B (2K Context) |
| **Parameters** | 100,176,325 (100.2M) |
| **Architecture** | **AnvArc** (15-Layer Hybrid: 10Γ ParallelMinGRU + 5Γ DifferentialGQA) |
| **Hidden Size ($d_{model}$)** | 768 |
| **Intermediate Size ($d_{ff}$)** | 1808 (SwiGLU) |
| **Layers** | 15 (10 MinGRU + 5 DifferentialGQA) |
| **Attention Heads** | 8 Query Heads ($d_{head}=64$) |
| **KV Heads** | 2 (Grouped Query Attention, 4:1 ratio) |
| **Vocab Size** | 16,384 (Isolated-Newline BPE) |
| **Max Context** | **2,048 tokens** |
| **Precision** | FP16 (`model.safetensors`) & FP32 |
| **Activation** | SwiGLU (SiLU) |
| **Tied Embeddings** | Yes (`lm_head.weight == tok_emb.weight`) |
| **Training Steps** | 15,000 (WSD Schedule) |
| **2K Val Loss** | **1.1459** (Perplexity: **3.15**) |
| **Top-1 / Top-5 Accuracy** | **76.84%** / **88.35%** |
| **Weighted 13-Lang Loss** | **0.9463** (Perplexity: **2.58**) |
| **Model Size on Disk** | ~191 MB (`model.safetensors`) |
---
## Comparison: New (2K Context, Step 15,000) vs Old (512 Context, Step 10,000)
The table below compares the new **Step 15,000 (2K Context)** release against the previous **Step 10,000 (512 Context)** model across all canonical benchmarks:
### 1. Overall Model Comparison
| Dimension | Old Model (Step 10,000) | New Model (Step 15,000) β
| Improvement / Delta |
| :--- | :---: | :---: | :---: |
| **Context Window** | 512 tokens | **2,048 tokens** | **4Γ Context Expansion** |
| **Training Steps** | 10,000 steps | **15,000 steps** | +5,000 steps (WSD Decay) |
| **Architecture** | Hybrid MinGRU+DiffGQA | **AnvArc** (Optimized Boundary Reset) | Architecture refinement |
| **Weighted 13-Lang Loss** | 1.1637 | **0.9463** | **-0.2174 (-18.7% Loss)** β‘ |
| **Weighted 13-Lang PPL** | 3.20 | **2.58** | **-0.62 (-19.4% PPL)** β‘ |
| **2K Context Loss** | *N/A (OOM / truncated)* | **1.1459** | Full 2K sequence support |
| **2K Context Perplexity** | *N/A* | **3.15** | Stable long-range modeling |
| **Top-1 Next-Token Accuracy** | 75.54% | **76.84%** | **+1.30% Accuracy** |
| **Logit Scale Factor** | 1.1080 | **1.2861** | Sharper output distribution |
| **Model Size on Disk** | 191.09 MB | **191.09 MB** | Zero parameter overhead |
---
### 2. Per-Language Breakdown Comparison (13 Languages)
| Language | Dataset Weight | Old Step 10K Loss | New Step 15K Loss β
| Delta (New vs Old) | New Step 15K Top-1 Acc |
| :--- | :---: | :---: | :---: | :---: | :---: |
| **HTML** | 4.0% | 0.9901 | **0.0669** | **-0.9232 (-93.2%)** β‘ | **98.14%** |
| **C** | 8.0% | 0.7320 | **0.1386** | **-0.5934 (-81.1%)** β‘ | **97.07%** |
| **JavaScript** | 10.0% | 1.3318 | **0.2738** | **-1.0580 (-79.4%)** β‘ | **92.97%** |
| **C++** | 10.0% | 0.9534 | **0.6324** | **-0.3210 (-33.7%)** β‘ | **84.47%** |
| **Java** | 12.0% | 1.0126 | **0.9413** | **-0.0713 (-7.0%)** | **80.57%** |
| **Python** | 28.0% | 1.3031 | **1.0950** | **-0.2081 (-16.0%)** β‘ | **73.24%** |
| **SQL** | 2.0% | 1.5765 | **1.1801** | **-0.3964 (-25.1%)** β‘ | **78.03%** |
| **Rust** | 8.0% | 0.9482 | **1.1610** | +0.2128 | **75.10%** |
| **CSS** | 3.0% | 1.6704 | **1.4037** | **-0.2667 (-16.0%)** | **62.11%** |
| **Go** | 5.0% | 1.3273 | **1.5968** | +0.2695 | **65.43%** |
| **TypeScript** | 6.0% | 0.8214 | **1.6186** | +0.7972 | **66.70%** |
| **Markdown** | 2.0% | 2.5326 | **1.8514** | **-0.6812 (-26.9%)** β‘ | **63.57%** |
| **Shell** | 2.0% | 1.3395 | **2.4868** | +1.1473 | **53.71%** |
| **Weighted Overall** | **100.0%** | **1.1637** | **0.9463** | **-0.2174 (-18.7%)** β‘ | **76.84%** |
---
### 3. Context Length Scaling Curve (New 2K Model)
The new **AnvArc** architecture demonstrates stable perplexity across sequence lengths up to the full 2,048-token context window:
| Sequence Length | Validation Loss | Validation Perplexity | Relative Stability |
| :---: | :---: | :---: | :--- |
| **256 tokens** | **0.9724** | **2.64** | Baseline prompt evaluation |
| **512 tokens** | **1.1139** | **3.05** | Standard function body completion |
| **1,024 tokens** | **1.0211** | **2.78** | Multi-function module completion |
| **2,048 tokens** | **1.0746** | **2.93** | Full long-range context preservation |
---
## Quick Start
### Installation
```bash
pip install transformers torch safetensors
```
### Basic Usage
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "AnveshAI/AnveshAI-CoderLM-0.1B"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_name,
trust_remote_code=True,
dtype=torch.float16,
device_map="auto",
)
model.eval()
# Prompt with language prefix
prompt = "<|lang:python|>def is_even(n: int) -> bool:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(
**inputs,
max_new_tokens=64,
do_sample=False,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
generated = output[0][inputs["input_ids"].shape[1]:]
print(tokenizer.decode(generated, skip_special_tokens=False))
```
### Fill-in-the-Middle (FIM) Usage
```python
# Format: <|fim_prefix|> prefix <|fim_suffix|> suffix <|fim_middle|>
fim_prompt = (
"<|fim_prefix|>def compute_mean(values):\n"
" if not values:\n"
" return 0.0\n"
"<|fim_suffix|>\n"
" return total / len(values)\n"
"<|fim_middle|>"
)
inputs = tokenizer(fim_prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=32, do_sample=False)
print(tokenizer.decode(output[0]))
```
---
## Special Tokens
CoderLM uses structured special tokens for sequence control, language conditioning, and code infilling:
| Token | Purpose | Description |
|-------|---------|-------------|
| `<\|endoftext\|>` | End / Start of sequence | Delimiter and AnvArc recurrent state reset |
| `<\|pad\|>` | Padding | Padding token |
| `<\|fim_prefix\|>` | FIM Prefix | Precedes the context prefix in infilling tasks |
| `<\|fim_middle\|>` | FIM Middle | Signals the model to generate the middle fill |
| `<\|fim_suffix\|>` | FIM Suffix | Precedes the context suffix in infilling tasks |
| `<\|lang:python\|>` | Language routing | Directs generation to Python syntax |
| `<\|lang:java\|>` | Language routing | Directs generation to Java syntax |
| `<\|lang:javascript\|>` | Language routing | Directs generation to JavaScript syntax |
| `<\|lang:cpp\|>` | Language routing | Directs generation to C++ syntax |
| `<\|lang:c\|>` | Language routing | Directs generation to C syntax |
| `<\|lang:rust\|>` | Language routing | Directs generation to Rust syntax |
| `<\|lang:typescript\|>` | Language routing | Directs generation to TypeScript syntax |
| `<\|lang:go\|>` | Language routing | Directs generation to Go syntax |
| `<\|lang:html\|>` | Language routing | Directs generation to HTML markup |
| `<\|lang:css\|>` | Language routing | Directs generation to CSS stylesheets |
| `<\|lang:shell\|>` | Language routing | Directs generation to Shell / Bash scripts |
| `<\|lang:sql\|>` | Language routing | Directs generation to SQL queries |
| `<\|lang:markdown\|>` | Language routing | Directs generation to Markdown documents |
### Prompt Formats
**Standard Generation:**
```
<|lang:python|>def fibonacci(n):
```
**Fill-in-the-Middle (FIM):**
```
<|fim_prefix|>prefix_code<|fim_suffix|>suffix_code<|fim_middle|>
```
---
## Tips for Best Results
1. **Prefix with `<|lang:xyz|>`** β always supply the appropriate language token to activate language-specific representations in AnvArc
2. **Utilize Long Prompts up to 2,048 Tokens** β unlike the 512 baseline, multi-function context and long file headers are fully supported
3. **Use greedy decoding (`do_sample=False`) for algorithms** β produces clean, syntax-valid completions
4. **Isolated-newline whitespace** β indentation is tokenized into isolated newlines followed by 4-space indent tokens
5. **Direct function signature prompts work best** β e.g., `<|lang:c|>void reverse_string(char *s) {\n`
---
## Limitations
- **100M scale** β this is a lightweight edge model; complex multi-file architectural reasoning is beyond its capacity
- **2,048 token context window** β designed for single files, functions, and FIM completions rather than massive codebases
- **Base code model** β trained for code completion and FIM, not multi-turn conversational chat
- **Syntax sensitivity** β relies on language routing tokens for optimal formatting
---
## Architecture & Training Details
- **Base Architecture**: **AnvArc** (15-Layer Hybrid: 10Γ ParallelMinGRU + 5Γ DifferentialGQA)
- **Attention Mechanism**: Differential GQA with RoPE ($\theta=10000$) and learnable Value-residual ($V_{res}$)
- **Recurrent Blocks**: ParallelMinGRU with 1-token shift mixing and EOS/language document boundary reset
- **Feed-Forward**: SwiGLU with $d_{ff} = 1808$
- **Tokenizer**: 16,384 vocabulary Byte-Pair Encoding with isolated newline regex
- **Optimizer**: AdamW + Muon with Warmup-Stable-Decay (WSD) learning rate schedule
- **Precision**: FP16 mixed precision
- **Best Checkpoint**: Step 15,000 (selected by lowest 2K validation loss: 1.1459)
- **Hardware**: Kaggle GPU environment
---
## Citation
```bibtex
@misc{anveshai-coderlm-2026,
title={AnveshAI CoderLM 0.1B},
author={AnveshAI},
year={2026},
url={https://huggingface.co/AnveshAI/AnveshAI-CoderLM-0.1B}
}
```
---
## License
This model is released under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
---
<p align="center">
<b>Built by <a href="https://huggingface.co/AnveshAI">AnveshAI</a></b><br>
<i>AnvArc: 15-Layer Hybrid MinGRU + Differential Attention Code Engine</i>
</p>
|