Instructions to use AnveshAI/AnveshAI-Ritchie-0.1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AnveshAI/AnveshAI-Ritchie-0.1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AnveshAI/AnveshAI-Ritchie-0.1B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AnveshAI/AnveshAI-Ritchie-0.1B") model = AutoModelForCausalLM.from_pretrained("AnveshAI/AnveshAI-Ritchie-0.1B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AnveshAI/AnveshAI-Ritchie-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-Ritchie-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-Ritchie-0.1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AnveshAI/AnveshAI-Ritchie-0.1B
- SGLang
How to use AnveshAI/AnveshAI-Ritchie-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-Ritchie-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-Ritchie-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-Ritchie-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-Ritchie-0.1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AnveshAI/AnveshAI-Ritchie-0.1B with Docker Model Runner:
docker model run hf.co/AnveshAI/AnveshAI-Ritchie-0.1B
Ritchie is a compact 100.7M-parameter language model purpose-built for C programming β named after Dennis Ritchie, the creator of the C language. Built on the LLaMA architecture, Ritchie is designed to generate C code from natural language task descriptions.
Small enough to run on any device β including edge devices like smartphones, tablets, Raspberry Pi, and other embedded hardware. At just ~200MB (FP16), Ritchie brings C code generation to devices where larger models simply can't run. No GPU required β it runs comfortably on CPU.
Highlights
- 100.7M parameters β one of the smallest dedicated C code generation models available
- ~200MB model size (FP16) β fits in memory on virtually any device
- Runs on CPU β no GPU required, works on laptops, phones, edge devices, and embedded systems
- LLaMA architecture β well-supported by HuggingFace Transformers, llama.cpp, ONNX, and other runtimes
- Task-oriented special tokens β structured prompting with
<|task|>,<|code|>,<|plan|>,<|bug|>,<|fix|>tokens - 2048 token context window
Model Details
| Property | Value |
|---|---|
| Model Name | AnveshAI Ritchie 0.1B |
| Parameters | 100.7M |
| Architecture | LlamaForCausalLM |
| Hidden Size | 768 |
| Intermediate Size | 2048 |
| Layers | 12 |
| Attention Heads | 12 |
| KV Heads | 4 (Grouped Query Attention) |
| Vocab Size | 32,768 |
| Max Context | 2,048 tokens |
| Precision | FP16 |
| Activation | SiLU |
| Position Encoding | RoPE (ΞΈ=10000) |
| Tied Embeddings | Yes |
| Training Step | 3,200 |
| Eval Loss | 1.383 |
| Model Size on Disk | ~192 MB |
Quick Start
Installation
pip install transformers torch
Basic Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "AnveshAI/AnveshAI-Ritchie-0.1B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto",
)
model.eval()
prompt = "<|task|>Write a C function to compute the nth Fibonacci number<|code|>"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(
**inputs,
max_new_tokens=256,
do_sample=True,
temperature=0.4,
top_p=0.95,
repetition_penalty=1.15,
pad_token_id=tokenizer.pad_token_id,
)
generated = output[0][inputs["input_ids"].shape[1]:]
print(tokenizer.decode(generated, skip_special_tokens=True))
Special Tokens
Ritchie uses structured special tokens for different stages of the code generation pipeline:
| Token | Purpose | Description |
|---|---|---|
<|bos|> |
Beginning of sequence | Start of input |
<|end|> |
End of turn | End of generation |
<|eos|> |
End of sequence | End of full sequence |
<|pad|> |
Padding | Padding token |
<|task|> |
Task description | Precedes the natural language instruction |
<|code|> |
Code generation | Signals the model to start generating code |
<|plan|> |
Planning | For step-by-step planning before coding |
<|run|> |
Execution | Marks expected execution output |
<|bug|> |
Bug identification | Marks compiler errors or bugs |
<|fix|> |
Bug fix | Signals corrected code |
Prompt Format
<|task|>Your natural language description here<|code|>
Tips for Best Results
- Use
repetition_penalty=1.15β helps prevent repetitive output patterns - Keep
max_new_tokensat 256 β the model works best with shorter outputs - Use
temperature=0.4β lower temperature produces more focused code - Use the
<|task|>...<|code|>format β this is the prompt format the model was trained on - Simple, direct prompts work best β e.g., "Write a C function to swap two integers using pointers"
Limitations
- 100M scale β this is a small model; expect imperfect outputs on complex tasks
- C language only β not trained for other programming languages
- May produce repetitive output β use
repetition_penaltyto mitigate - Not instruction-tuned β this is a base code generation model, not a chatbot
- May not always follow the task β task adherence is limited at this model scale
Training Details
- Base Architecture: LLaMA (custom configuration)
- Training Data: C language source code corpus
- Optimizer: AdamW
- Precision: FP16 mixed precision
- Best Checkpoint: Step 3,200 (selected by lowest eval loss)
- Hardware: Kaggle GPU environment
Citation
@misc{anveshai-ritchie-2026,
title={AnveshAI Ritchie 0.1B},
author={AnveshAI},
year={2026},
url={https://huggingface.co/AnveshAI/Ritchie-0.1B}
}
License
This model is released under the Apache 2.0 License.
Built by AnveshAI
Named after Dennis Ritchie β the father of C
- Downloads last month
- -