AnveshAI Ritchie 0.1B

Hugging Face License
Parameters Architecture Language Context Length Precision

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

  1. Use repetition_penalty=1.15 β€” helps prevent repetitive output patterns
  2. Keep max_new_tokens at 256 β€” the model works best with shorter outputs
  3. Use temperature=0.4 β€” lower temperature produces more focused code
  4. Use the <|task|>...<|code|> format β€” this is the prompt format the model was trained on
  5. 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_penalty to 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
-
Safetensors
Model size
0.1B params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support