Instructions to use ARotting/snip-0.09m-distilled with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ARotting/snip-0.09m-distilled with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ARotting/snip-0.09m-distilled")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ARotting/snip-0.09m-distilled") model = AutoModelForCausalLM.from_pretrained("ARotting/snip-0.09m-distilled", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ARotting/snip-0.09m-distilled with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ARotting/snip-0.09m-distilled" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ARotting/snip-0.09m-distilled", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ARotting/snip-0.09m-distilled
- SGLang
How to use ARotting/snip-0.09m-distilled 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 "ARotting/snip-0.09m-distilled" \ --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": "ARotting/snip-0.09m-distilled", "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 "ARotting/snip-0.09m-distilled" \ --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": "ARotting/snip-0.09m-distilled", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ARotting/snip-0.09m-distilled with Docker Model Runner:
docker model run hf.co/ARotting/snip-0.09m-distilled
SNIP-0.4M
SNIP means Small Neural Intelligence Prototype. SNIP-0.4M is a deliberately tiny causal transformer designed to make the complete language-model lifecycle inspectable on ordinary hardware.
Architecture
- approximately 400,000 parameters;
- 3 transformer layers;
- 96 hidden dimensions;
- 3 attention heads;
- 128-token context;
- custom 512-token byte-level BPE tokenizer;
- GPT-2-compatible architecture saved with Hugging Face Transformers.
Training
The base model is initialized from scratch and pretrained on a bounded stream from
roneneldan/TinyStories. It does not inherit pretrained weights.
uv run python projects/snip-0.4m/prepare_data.py
uv run python projects/snip-0.4m/train.py
uv run python projects/snip-0.4m/evaluate.py
Intended use
SNIP is an educational and experimental base model. Its small capacity makes it useful for testing tokenizers, adapters, curricula, evaluation pipelines, compression, and RL methods quickly. It is not intended as a factual assistant or production chatbot.
Results
Measured parameter count, held-out loss, perplexity, throughput, and generation samples
are written to artifacts/snip-0.4m-base/evaluation.json after training.
Base v1
- Parameters: 397,152
- Pretraining tokens: 1,638,400
- Held-out loss: 3.3656
- Held-out perplexity: 28.9508
These are local CPU results over 200 held-out 128-token blocks.
SNIP-0.09M compression variant
The compressed student has 87,360 parameters: two layers, 48 hidden dimensions, three attention heads, and the same 512-token vocabulary and 128-token context. It was trained for 500 steps over 1,024,000 tokens.
| Variant | Parameters | Held-out loss | Perplexity |
|---|---|---|---|
| SNIP-0.4M teacher | 397,152 | 3.3656 | 28.95 |
| SNIP-0.09M scratch | 87,360 | 3.8325 | 46.18 |
| SNIP-0.09M distilled | 87,360 | 3.7831 | 43.95 |
The distilled student is 4.55 times smaller than its teacher and improves perplexity by 4.82% over the architecture-matched scratch run. It still trails the larger teacher, making the compression-quality tradeoff explicit.
uv run python projects/snip-0.4m/train_distilled.py --steps 500
uv run python projects/snip-0.4m/train_distilled.py --steps 500 `
--distillation-weight 0 --output-name snip-0.09m-scratch
Story LoRA
The first post-trained variant attaches a rank-4 LoRA adapter to the attention and feed-forward projections. It learns an instruction-shaped microfiction format while leaving the 397K base weights frozen.
uv run python projects/snip-0.4m/train_lora.py
uv run python projects/snip-0.4m/evaluate_variants.py
The run saves both a lightweight adapter and a standalone merged variant.
Pairwise reward model
SNIP Reward reuses the pretrained 397K transformer and replaces the language-model head with a scalar ranking head. It learns from 810 structured preference pairs and is evaluated on 90 held-out pairs.
uv run python projects/snip-0.4m/train_reward.py --epochs 4 --batch-size 128
The 397,248-parameter model reached 100% pairwise accuracy on both wrong-goal and wrong-lesson corruptions, with a mean chosen-minus-rejected margin of 3.3656. This is a narrow synthetic consistency test, not evidence of general human-preference alignment.
Verifiable-reward language RL
SNIP-GRPO applies an 18,432-parameter LoRA policy to parity, comparison, and threshold prompts with exact binary rewards. Each update samples 16 actions per prompt, centers and normalizes reward inside each group, clips the policy ratio, and penalizes KL divergence from the frozen base policy.
uv run python projects/snip-0.4m/train_grpo.py --steps 300
Across 176 held-out prompts, greedy accuracy improved from 52.27% to 69.32%. Less-than accuracy rose from 47.50% to 77.50%, and sum-threshold accuracy rose from 57.89% to 65.79%. Parity stayed at 50%, an explicit failure mode rather than a hidden average. The method is GRPO-style group-relative policy optimization over a constrained two-token action space; it is not a full open-ended reasoning model.
Logic SFT control
An architecture- and data-matched supervised LoRA control trained for 300 updates on the same 684 examples and evaluated on the same 176 held-out prompts:
| Variant | Overall | Less-than | Parity | Sum threshold |
|---|---|---|---|---|
| Frozen base | 52.27% | 47.50% | 50.00% | 57.89% |
| Logic SFT | 69.32% | 80.00% | 15.00% | 72.37% |
| GRPO | 69.32% | 77.50% | 50.00% | 65.79% |
SFT and GRPO tied in aggregate but did not learn the same behavior. SFT was stronger on comparison and thresholds while catastrophically degrading parity; GRPO preserved base parity performance. The merged SFT artifact was independently reloaded and re-evaluated after training.
- Downloads last month
- 21