Instructions to use udgamlabs/Udgam-384M-Base-4K with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use udgamlabs/Udgam-384M-Base-4K with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="udgamlabs/Udgam-384M-Base-4K") 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-4K") model = AutoModelForCausalLM.from_pretrained("udgamlabs/Udgam-384M-Base-4K", 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-4K 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-4K:Q8_0 # Run inference directly in the terminal: llama cli -hf udgamlabs/Udgam-384M-Base-4K: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-4K:Q8_0 # Run inference directly in the terminal: llama cli -hf udgamlabs/Udgam-384M-Base-4K: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-4K:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf udgamlabs/Udgam-384M-Base-4K: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-4K:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf udgamlabs/Udgam-384M-Base-4K:Q8_0
Use Docker
docker model run hf.co/udgamlabs/Udgam-384M-Base-4K:Q8_0
- LM Studio
- Jan
- vLLM
How to use udgamlabs/Udgam-384M-Base-4K 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-4K" # 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-4K", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/udgamlabs/Udgam-384M-Base-4K:Q8_0
- SGLang
How to use udgamlabs/Udgam-384M-Base-4K 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-4K" \ --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-4K", "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-4K" \ --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-4K", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use udgamlabs/Udgam-384M-Base-4K with Ollama:
ollama run hf.co/udgamlabs/Udgam-384M-Base-4K:Q8_0
- Unsloth Desktop
- Pi
How to use udgamlabs/Udgam-384M-Base-4K 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-4K: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-4K:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use udgamlabs/Udgam-384M-Base-4K with Docker Model Runner:
docker model run hf.co/udgamlabs/Udgam-384M-Base-4K:Q8_0
- Lemonade
How to use udgamlabs/Udgam-384M-Base-4K with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull udgamlabs/Udgam-384M-Base-4K:Q8_0
Run and chat with the model
lemonade run user.Udgam-384M-Base-4K-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use udgamlabs/Udgam-384M-Base-4K 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-4K: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-4K:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use udgamlabs/Udgam-384M-Base-4K 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-4K: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-4K: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-384M-Base-4K
The 4,096-token-context version of Udgam-384M-Base, a 384M-parameter English base model trained from scratch by UdgamLabs: the same pretraining plus a short continued-pretraining stage at 4,096 tokens. 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. Udgam-384M-Chat was fine-tuned from this model.
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 | UdgamLabs |
| 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 | 4,096 tokens (max_position_embeddings 4096; GGUF context_length 4096). 8,192 is not supported (recall fails beyond ~4K) |
| Language | English |
| Training | pretrained from scratch on roughly 8B tokens of licensed public and synthetic text, plus a short continued-pretraining stage at 4,096 tokens |
| Licence | Apache-2.0 |
How to use
from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("UdgamLabs/Udgam-384M-Base-4K")
model = AutoModelForCausalLM.from_pretrained("UdgamLabs/Udgam-384M-Base-4K")
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]))
As with official Gemma 4, tokenizer(text) does not add <bos>; prepend it (or use the chat template).
GGUF (in gguf/: f16 and Q8_0) with llama.cpp:
llama-cli -m Udgam-384M-Base-4K-Q8_0.gguf -c 4096 -p "The capital of France is" -n 40. Ollama (raw completion):
FROM ./Udgam-384M-Base-4K-Q8_0.gguf
TEMPLATE """{{ .Prompt }}"""
PARAMETER temperature 0.7
PARAMETER top_p 0.9
PARAMETER repeat_penalty 1.15
PARAMETER num_ctx 4096
MLX: mlx_lm.generate --model UdgamLabs/Udgam-384M-Base-4K --ignore-chat-template --prompt "<bos>The capital of France is"
(mlx-lm reads the safetensors directly). Keep the literal <bos>: without it the model degenerates ("is is is…");
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
Compared with the 2K base on the same evaluation text (bits per byte, lower is better; needle = recall a 5-digit code hidden in filler text):
| metric | Udgam-384M-Base (2K) | this model (4K) |
|---|---|---|
| bits per byte at 2,048: mixed / web / tool-and-chat text | 0.6622 / 0.8552 / 0.3910 | 0.6632 (+0.15%) / 0.8548 / 0.3920 |
| long documents, bits per byte at positions 2,048–3,072 / 3,072–4,096 | 0.769 / 0.848 | 0.734 / 0.730 |
| needle recall at 1K / 2K / 3.5K / 7K context (100 trials) | 100 / 100 / 1 / 0 % | 100 / 100 / 83 / 1 % |
| copy a 48-token span, next-token accuracy at 1K / 3.5K / 7K | 0.98 / 0.18 / 0.14 | 0.98 / 0.86 / 0.22 |
Short-context quality is unchanged and the model can use 4K positions. Chat-format tool-calling probes (greedy): BFCL v3 simple 66%, multiple 75%, parallel 48%, irrelevance 11% (it calls a tool almost always); held-out app-action exact match 24%. Long-prompt parity was checked at ~3,300 and ~3,900 tokens: llama.cpp and Ollama (num_ctx 4096) give the same tokens as transformers.
Limitations
- Small model, small token budget: limited world knowledge, frequent factual errors, repetition, date-reasoning errors and buggy code.
- English only. Context 4,096 tokens at most.
- 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, then continued pretraining for a short stage at 4,096 tokens. 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 = {{UdgamLabs}},
year = {2026},
howpublished = {\url{https://huggingface.co/UdgamLabs/Udgam-384M-Chat}},
note = {Technical report: TECHNICAL_REPORT.md in the Udgam-384M-Chat repository}
}
Contact
UdgamLabs. Please use the Community (discussions) tab of the model page for questions, issues and feedback.
- Downloads last month
- 59