Text Generation
Transformers
Safetensors
English
llama
causal-lm
from-scratch
dpo
chat
conversational
text-generation-inference
Instructions to use dkumar15/aria-1b-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dkumar15/aria-1b-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dkumar15/aria-1b-chat") 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("dkumar15/aria-1b-chat") model = AutoModelForCausalLM.from_pretrained("dkumar15/aria-1b-chat", 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
- vLLM
How to use dkumar15/aria-1b-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dkumar15/aria-1b-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dkumar15/aria-1b-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dkumar15/aria-1b-chat
- SGLang
How to use dkumar15/aria-1b-chat 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 "dkumar15/aria-1b-chat" \ --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": "dkumar15/aria-1b-chat", "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 "dkumar15/aria-1b-chat" \ --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": "dkumar15/aria-1b-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dkumar15/aria-1b-chat with Docker Model Runner:
docker model run hf.co/dkumar15/aria-1b-chat
|
Download README.md from dkumar15/aria-1b-chat: direct link, hf CLI and curl.
- Browser
- Download file 3.93 kB
-
https://huggingface.co/dkumar15/aria-1b-chat/resolve/main/README.md
- Command line
-
hf download hf://dkumar15/aria-1b-chat/README.md
-
curl -L -o README.md https://huggingface.co/dkumar15/aria-1b-chat/resolve/main/README.md
3.93 kB
| language: | |
| - en | |
| license: apache-2.0 | |
| tags: | |
| - llama | |
| - causal-lm | |
| - from-scratch | |
| - dpo | |
| - chat | |
| - text-generation | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| model-index: | |
| - name: Transformer-1B-Chat | |
| results: [] | |
| # Transformer-1B-Chat | |
| A **1.1 billion parameter** decoder-only language model trained **entirely from scratch** -- pretraining, supervised fine-tuning, and preference alignment -- on 8x NVIDIA H100 GPUs. | |
| ## Model Details | |
| | Property | Value | | |
| |---|---| | |
| | Parameters | 1,105,827,840 (1.1B) | | |
| | Architecture | LLaMA-style Decoder-only Transformer | | |
| | Hidden Size | 2048 | | |
| | Intermediate Size | 5504 (SwiGLU) | | |
| | Layers | 22 | | |
| | Attention Heads | 32 (Grouped Query Attention) | | |
| | KV Heads | 8 | | |
| | Head Dim | 64 | | |
| | Max Sequence Length | 2048 | | |
| | Vocab Size | 32,003 | | |
| | Precision | BFloat16 | | |
| ### Architecture Highlights | |
| - **RoPE** (Rotary Position Embeddings) with theta=10,000 | |
| - **Grouped Query Attention** (GQA) -- 4:1 query-to-KV head ratio for efficient inference | |
| - **SwiGLU** Feed-Forward Network | |
| - **RMSNorm** in a pre-norm configuration | |
| - **Flash Attention 2** via PyTorch SDPA | |
| ## Training Pipeline | |
| This model was built through a complete 3-stage training pipeline: | |
| ### Stage 1: Pretraining | |
| | Detail | Value | | |
| |---|---| | |
| | Dataset | HuggingFaceFW/fineweb-edu (sample-10BT) | | |
| | Tokens Trained | ~20B tokens | | |
| | Steps | 19,070 | | |
| | Duration | ~12.3 hours | | |
| | Optimizer | AdamW (lr=3e-4, betas=0.9/0.95, wd=0.1) | | |
| | Schedule | WSD (Warmup-Stable-Decay), warmup=1000 steps | | |
| | Batch Size | 512 sequences (8 GPUs x 8 micro x 8 grad accum) | | |
| | Final Loss | 2.43 | | |
| | Throughput | ~338K tokens/sec | | |
| ### Stage 2: Supervised Fine-Tuning (SFT) | |
| | Detail | Value | | |
| |---|---| | |
| | Dataset | HuggingFaceH4/ultrachat_200k (207,865 conversations) | | |
| | Steps | 3,240 (2 epochs) | | |
| | Duration | ~52 minutes | | |
| | Optimizer | AdamW (lr=2e-5, cosine decay) | | |
| | Batch Size | 256 sequences | | |
| | Final Loss | 1.20 | | |
| ### Stage 3: Direct Preference Optimization (DPO) | |
| | Detail | Value | | |
| |---|---| | |
| | Dataset | argilla/ultrafeedback-binarized-preferences-cleaned (60,917 pairs) | | |
| | Steps | 952 (1 epoch) | | |
| | Duration | ~14 minutes | | |
| | Optimizer | AdamW (lr=5e-7, cosine decay) | | |
| | Beta | 0.1 | | |
| | Batch Size | 64 pairs | | |
| | Final Loss | 0.49 | | |
| | Final Accuracy | 72.5% (chosen preferred over rejected) | | |
| | Final Reward Margin | 0.84 | | |
| ### Hardware | |
| - **8x NVIDIA H100 80GB HBM3** | |
| - **Distributed Strategy**: PyTorch DDP (DistributedDataParallel) | |
| - **Communication**: NCCL | |
| - **Mixed Precision**: BF16 autocast | |
| - **Total Training Time**: ~13.5 hours (all 3 stages) | |
| ## Chat Template | |
| The model uses a simple chat template with special tokens: | |
| ``` | |
| <|user|> | |
| Your message here | |
| <|end|> | |
| <|assistant|> | |
| Model response here | |
| <|end|> | |
| ``` | |
| ### Special Tokens | |
| | Token | ID | Purpose | | |
| |---|---|---| | |
| | `<|user|>` | 32000 | Start of user turn | | |
| | `<|assistant|>` | 32001 | Start of assistant turn | | |
| | `<|end|>` | 32002 | End of turn | | |
| ## Limitations | |
| - **1.1B parameters** -- smaller models have inherent limitations in reasoning depth and factual accuracy | |
| - Trained on English data only | |
| - May generate plausible-sounding but incorrect information | |
| - The DPO alignment is single-epoch; additional iterations could improve quality | |
| - Not safety-tuned beyond what the UltraFeedback dataset provides | |
| ## Training Code | |
| The full training code is open-sourced alongside this model. | |
| ``` | |
| model/ | |
| config.py # Model and training hyperparameters | |
| transformer.py # Full transformer implementation from scratch | |
| data.py # Pretraining data pipeline (FineWeb-Edu) | |
| sft_data.py # SFT data pipeline (UltraChat) | |
| dpo_data.py # DPO data pipeline (UltraFeedback) | |
| train.py # Pretraining script (DDP, 8-GPU) | |
| train_sft.py # SFT script | |
| train_dpo.py # DPO script | |
| chat.py # Interactive chat interface | |
| export_to_hf.py # Export to HuggingFace format | |
| ``` | |
| ## License | |
| Apache 2.0 | |