Instructions to use udgamlabs/Udgam-384M-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use udgamlabs/Udgam-384M-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="udgamlabs/Udgam-384M-Base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("udgamlabs/Udgam-384M-Base") model = AutoModelForCausalLM.from_pretrained("udgamlabs/Udgam-384M-Base", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use udgamlabs/Udgam-384M-Base with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf udgamlabs/Udgam-384M-Base:Q8_0 # Run inference directly in the terminal: llama cli -hf udgamlabs/Udgam-384M-Base:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf udgamlabs/Udgam-384M-Base:Q8_0 # Run inference directly in the terminal: llama cli -hf udgamlabs/Udgam-384M-Base:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf udgamlabs/Udgam-384M-Base:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf udgamlabs/Udgam-384M-Base:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf udgamlabs/Udgam-384M-Base:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf udgamlabs/Udgam-384M-Base:Q8_0
Use Docker
docker model run hf.co/udgamlabs/Udgam-384M-Base:Q8_0
- LM Studio
- Jan
- vLLM
How to use udgamlabs/Udgam-384M-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "udgamlabs/Udgam-384M-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "udgamlabs/Udgam-384M-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/udgamlabs/Udgam-384M-Base:Q8_0
- SGLang
How to use udgamlabs/Udgam-384M-Base 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 "udgamlabs/Udgam-384M-Base" \ --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": "udgamlabs/Udgam-384M-Base", "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 "udgamlabs/Udgam-384M-Base" \ --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": "udgamlabs/Udgam-384M-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use udgamlabs/Udgam-384M-Base with Ollama:
ollama run hf.co/udgamlabs/Udgam-384M-Base:Q8_0
- Unsloth Desktop
- Pi
How to use udgamlabs/Udgam-384M-Base with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf udgamlabs/Udgam-384M-Base:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "udgamlabs/Udgam-384M-Base:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use udgamlabs/Udgam-384M-Base with Docker Model Runner:
docker model run hf.co/udgamlabs/Udgam-384M-Base:Q8_0
- Lemonade
How to use udgamlabs/Udgam-384M-Base with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull udgamlabs/Udgam-384M-Base:Q8_0
Run and chat with the model
lemonade run user.Udgam-384M-Base-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use udgamlabs/Udgam-384M-Base with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf udgamlabs/Udgam-384M-Base:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default udgamlabs/Udgam-384M-Base:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use udgamlabs/Udgam-384M-Base with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf udgamlabs/Udgam-384M-Base:Q8_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "udgamlabs/Udgam-384M-Base:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
UDGAM LABS · Base model · 384M parameters
Udgam-384M-Base
A 384M-parameter English base model trained from scratch by Udgam Labs. It is a decoder-only transformer compatible with the Gemma 4 architecture (Gemma4ForCausalLM), so it runs unmodified in transformers, llama.cpp / Ollama / LM Studio (GGUF) and MLX. It is the foundation of the on-device tool-calling model Udgam-384M-Chat. For a 4,096-token context use Udgam-384M-Base-4K.
This is a base (pretrained) model: it continues text. It is not instruction-tuned and not safety-tuned, and it has no chat behaviour of its own. For chat and tool calling use Udgam-384M-Chat.
Model family: Udgam-384M-Base (2,048 context) · Udgam-384M-Base-4K · Udgam-384M-Chat · GGUF · MLX · MLX 4-bit · Technical report
| Developer | Udgam Labs |
| Parameters | 384.4M total (317.3M in the 20 transformer layers; untied 32,768 × 1,024 input and output embeddings) |
| Architecture | decoder-only transformer compatible with Gemma 4 (Gemma4ForCausalLM): 20 layers × 1,024, 16 query / 4 KV heads, sliding-window (512) and global attention in a 3 : 1 pattern, GeGLU MLP, logit soft-cap |
| Vocabulary | 32,768 tokens, with the Gemma 4 chat-template special tokens |
| Context | 2,048 tokens (max_position_embeddings 2048; GGUF context_length 2048) |
| Language | English |
| Training | pretrained from scratch on roughly 8B tokens of licensed public and synthetic text |
| Licence | Apache-2.0 |
How to use
from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("udgamlabs/Udgam-384M-Base")
model = AutoModelForCausalLM.from_pretrained("udgamlabs/Udgam-384M-Base")
ids = tok("<bos>The capital of France is", return_tensors="pt", add_special_tokens=False).input_ids # add <bos> yourself
print(tok.decode(model.generate(ids, max_new_tokens=30, do_sample=False)[0]))
The model was trained with exactly one <bos> at the start of every document. Since 12 October 2026 the tokenizer
adds it: tokenizer(text) returns <bos> + text. If you write <bos> yourself, as above, pass
add_special_tokens=False, or you get two. The chat template already starts with <bos>.
GGUF (in gguf/: f16 and Q8_0) with llama.cpp:
llama-cli -m Udgam-384M-Base-Q8_0.gguf -c 2048 -p "The capital of France is" -n 40. Ollama (raw completion):
FROM ./Udgam-384M-Base-Q8_0.gguf
TEMPLATE """{{ .Prompt }}"""
PARAMETER temperature 0.7
PARAMETER top_p 0.9
PARAMETER repeat_penalty 1.15
PARAMETER num_ctx 2048
MLX: mlx_lm.generate --model udgamlabs/Udgam-384M-Base --ignore-chat-template --prompt "The capital of France is"
(mlx-lm reads the safetensors directly, and the tokenizer adds the one <bos> the model needs; do not type a literal
<bos> as well). Without --ignore-chat-template the prompt is wrapped in the chat template and the base model rambles.
Export parity was checked: transformers fp32, llama.cpp GGUF and MLX give the same greedy tokens, and Ollama's greedy output matches transformers.
Evaluation
Held-out bits per byte at 2,048 tokens (lower is better): 0.668 on mixed validation text, 0.865 on web text, 0.408 on tool-call / JSON / chat-style text.
Probes (greedy, raw prompts in the Gemma 4 format): a set_timer tool prompt gives a correct call <|tool_call>call:set_timer{label:<|"|>pasta<|"|>,minutes:15}<tool_call|>; a shell prompt gives find /var/log -type f -size +10M; "The chemical symbol of gold is" → " Au." Typical base-model weaknesses: repetition ("The capital of France is Paris, and the capital of Belgium is Brussels. The capital of France is …"), date-reasoning errors, buggy code. The pretraining text included structured and conversational material, so the base already knows the Gemma 4 tool-call format: prompted with the chat template, the 4K base scores BFCL v3 simple 66% / multiple 75% but irrelevance only 11% (it calls a tool almost always). We did not run knowledge benchmarks (HellaSwag, ARC, MMLU); at 384M parameters and ~8B tokens expect scores in line with other sub-500M models trained on similar budgets, far below larger models.
Where it falls short
- Small model, small token budget: limited world knowledge, frequent factual errors, repetition, date-reasoning errors and buggy code.
- English only. Context 2,048 tokens (use Udgam-384M-Base-4K for longer inputs).
- Not instruction-tuned or safety-tuned: it will continue any text, including harmful text. Do not deploy it directly to end users.
- Prompted as a chatbot without fine-tuning, it tends to ramble in a "thinking aloud" style ("Okay, let me…", "Wait, …"). Fine-tuning (as in Udgam-384M-Chat) removes this.
- Parts of the training text were machine-generated; their styles and errors can carry over.
Training
Pretrained from scratch on roughly 8B tokens of licensed public and synthetic text, at a sequence length of 2,048. See the technical report for an overview.
Licence
Apache-2.0 (weights and tokenizer); see LICENSE. The chat template is the official Gemma 4 template (Apache-2.0).
Citation
@misc{udgamlabs2026udgam384m,
title = {Udgam-384M: a small on-device tool-calling model trained from scratch},
author = {{Udgam Labs}},
year = {2026},
howpublished = {\url{https://huggingface.co/udgamlabs/Udgam-384M-Chat}},
note = {Technical report: \url{https://udgamlabs.com/reports/udgam-384m}}
}
Contact
Udgam Labs. Please use the Community (discussions) tab of the model page for questions, issues and feedback.
About Udgam Labs. Udgam Labs is an independent AI research lab. We work from first principles: before we build, we understand why things work, whether we are training a model, fine-tuning one or applying AI to a new problem. Udgam (उद्गम) is Sanskrit for origin. udgamlabs.com
- Downloads last month
- 898
