Text Generation
Transformers
Safetensors
PyTorch
English
axiom
causal-lm
fine-tuned
instruct-model
custom-architecture
tiktoken
chatml
custom_code
Instructions to use user-anto/Axiom-Dense-380M-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use user-anto/Axiom-Dense-380M-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="user-anto/Axiom-Dense-380M-Instruct", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("user-anto/Axiom-Dense-380M-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use user-anto/Axiom-Dense-380M-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "user-anto/Axiom-Dense-380M-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "user-anto/Axiom-Dense-380M-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/user-anto/Axiom-Dense-380M-Instruct
- SGLang
How to use user-anto/Axiom-Dense-380M-Instruct 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 "user-anto/Axiom-Dense-380M-Instruct" \ --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": "user-anto/Axiom-Dense-380M-Instruct", "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 "user-anto/Axiom-Dense-380M-Instruct" \ --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": "user-anto/Axiom-Dense-380M-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use user-anto/Axiom-Dense-380M-Instruct with Docker Model Runner:
docker model run hf.co/user-anto/Axiom-Dense-380M-Instruct
Updated README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,139 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: transformers
|
| 3 |
license: apache-2.0
|
| 4 |
+
datasets:
|
| 5 |
+
- HuggingFaceTB/smoltalk
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- causal-lm
|
| 11 |
+
- fine-tuned
|
| 12 |
+
- instruct-model
|
| 13 |
+
- custom-architecture
|
| 14 |
+
- pytorch
|
| 15 |
+
- tiktoken
|
| 16 |
+
- chatml
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
<p align="center">
|
| 20 |
+
<img src="./axiom_logo.png" width="220">
|
| 21 |
+
</p>
|
| 22 |
+
|
| 23 |
+
# Axiom-Dense-380M-Instruct
|
| 24 |
+
|
| 25 |
+
Axiom-Dense-380M-Instruct is a fine-tuned, instruction-following decoder-only causal language model. It was trained by performing Supervised Fine-Tuning (SFT) on the base model [Axiom-Dense-380M-Base](https://huggingface.co/user-anto/Axiom-Dense-380M-Base) using instruction-response conversational data.
|
| 26 |
+
|
| 27 |
+
# Quickstart
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 31 |
+
|
| 32 |
+
model_name = "user-anto/Axiom-Dense-380M-Instruct"
|
| 33 |
+
|
| 34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 35 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="cpu")
|
| 36 |
+
|
| 37 |
+
prompt = "<|im_start|>user\nWrite a short email to my team about meeting tomorrow.<|im_end|>\n<|im_start|>assistant\n"
|
| 38 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cpu")
|
| 39 |
+
|
| 40 |
+
with torch.no_grad():
|
| 41 |
+
outputs = model.generate(
|
| 42 |
+
**inputs,
|
| 43 |
+
max_new_tokens=128,
|
| 44 |
+
temperature=0.2,
|
| 45 |
+
top_p=0.85,
|
| 46 |
+
repetition_penalty=1.15,
|
| 47 |
+
no_repeat_ngram_size=3,
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
print(tokenizer.decode(outputs[0]))
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Model Summary
|
| 54 |
+
|
| 55 |
+
- Model type: decoder-only Transformer (causal LM)
|
| 56 |
+
- Parameter count: 385,849,344
|
| 57 |
+
- Context length: 1,024 tokens
|
| 58 |
+
- Vocabulary: 100,277 (`tiktoken` `cl100k_base` with ChatML special tokens patched)
|
| 59 |
+
- Training objective: Autoregressive supervised fine-tuning (SFT) using target masking (only computing loss on the assistant's responses)
|
| 60 |
+
- Prompt format: ChatML (`<|im_start|>`, `<|im_end|>`)
|
| 61 |
+
|
| 62 |
+
## Architecture
|
| 63 |
+
|
| 64 |
+
This model preserves the same dense Transformer stack as the base model, but utilizes added special tokens to delimit speaker turns during inference.
|
| 65 |
+
|
| 66 |
+
- Hidden size: 1024
|
| 67 |
+
- Layers: 24
|
| 68 |
+
- Attention heads: 16
|
| 69 |
+
- KV heads: 8 (GQA)
|
| 70 |
+
- FFN multiplier: 2.6667 (rounded to 2816 intermediate dimension)
|
| 71 |
+
- Normalization: RMSNorm
|
| 72 |
+
- Positional encoding: RoPE (`theta=10000`)
|
| 73 |
+
- Activation: SwiGLU
|
| 74 |
+
- Special tokens: `<|im_start|>` (100264) and `<|im_end|>` (100265) for ChatML boundaries
|
| 75 |
+
|
| 76 |
+
## Training Data
|
| 77 |
+
|
| 78 |
+
- Source dataset: `HuggingFaceTB/smoltalk`
|
| 79 |
+
- Local dataset path during training: `data/smol-smoltalk`
|
| 80 |
+
- SFT targets: Computes loss only on assistant response tokens, masking out prompt and user tokens.
|
| 81 |
+
- Total training tokens: 204,802,175 (~0.205B tokens)
|
| 82 |
+
- Validation tokens: 197,825 tokens
|
| 83 |
+
|
| 84 |
+
## SFT Training Setup
|
| 85 |
+
|
| 86 |
+
- Effective tokens per optimizer step: 319,488 (`batch_size=1`, `seq_len=1024`, `grad_accum=312`)
|
| 87 |
+
- Total optimizer steps: 641
|
| 88 |
+
- Optimizer: AdamW8bit (with bitsandbytes)
|
| 89 |
+
- LR schedule: warmup, constant phase, cosine decay
|
| 90 |
+
- Warmup steps: 51 steps (8% of training)
|
| 91 |
+
- Cosine decay phase: 102 steps (16% of training, starting at step 539)
|
| 92 |
+
- LR max/min: 3e-4 / 3e-5 (initial learning rate starts at 1.5e-4 during warmup)
|
| 93 |
+
- Weight decay: 0.1
|
| 94 |
+
- Precision: bfloat16
|
| 95 |
+
- Gradient checkpointing: enabled
|
| 96 |
+
|
| 97 |
+
## Evaluation Snapshot
|
| 98 |
+
|
| 99 |
+
- Pretraining base perplexity: 18.1233
|
| 100 |
+
- Best observed SFT eval loss: 1.2641 at step 630
|
| 101 |
+
- Best observed SFT eval perplexity: 3.5398 at step 630
|
| 102 |
+
- Final SFT step (640) eval loss: 1.2868
|
| 103 |
+
- Final SFT step (640) eval perplexity: 3.6210
|
| 104 |
+
|
| 105 |
+
The SFT process successfully aligned the model to follow prompt formats and drastically reduced perplexity on conversational validation targets.
|
| 106 |
+
|
| 107 |
+
## Chat Format
|
| 108 |
+
|
| 109 |
+
This model uses the standard **ChatML** system format. A typical chat turn looks like:
|
| 110 |
+
|
| 111 |
+
```text
|
| 112 |
+
<|im_start|>user
|
| 113 |
+
Write a short email to my team about meeting tomorrow.<|im_end|>
|
| 114 |
+
<|im_start|>assistant
|
| 115 |
+
Subject: Meeting Tomorrow...<|im_end|>
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
## Intended Use
|
| 119 |
+
|
| 120 |
+
- Assistant-style task completion
|
| 121 |
+
- Multi-turn conversational chat
|
| 122 |
+
- Zero-shot and few-shot instruction-following
|
| 123 |
+
- Educational use and custom model inference experimentation
|
| 124 |
+
|
| 125 |
+
## Out-of-Scope / Limitations
|
| 126 |
+
|
| 127 |
+
- Safety-critical domains (medical, legal, financial advice)
|
| 128 |
+
- Deployment in production without robust safety classifiers and filters
|
| 129 |
+
- Handling long contexts beyond the 1,024-token limit
|
| 130 |
+
- Language support beyond English (which dominates the smoltalk dataset)
|
| 131 |
+
|
| 132 |
+
## Tokenization
|
| 133 |
+
|
| 134 |
+
- Tokenizer: `tiktoken` with `cl100k_base` base ranks
|
| 135 |
+
- Patched special tokens:
|
| 136 |
+
- `<|endoftext|>` = 100257 (EOS/PAD)
|
| 137 |
+
- `<|im_start|>` = 100264
|
| 138 |
+
- `<|im_end|>` = 100265
|
| 139 |
+
- `<|endofprompt|>` = 100276
|