Instructions to use ombd/Llama-3.1-8B-Aleph-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ombd/Llama-3.1-8B-Aleph-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ombd/Llama-3.1-8B-Aleph-2") 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("ombd/Llama-3.1-8B-Aleph-2") model = AutoModelForCausalLM.from_pretrained("ombd/Llama-3.1-8B-Aleph-2", 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 ombd/Llama-3.1-8B-Aleph-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ombd/Llama-3.1-8B-Aleph-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ombd/Llama-3.1-8B-Aleph-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ombd/Llama-3.1-8B-Aleph-2
- SGLang
How to use ombd/Llama-3.1-8B-Aleph-2 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 "ombd/Llama-3.1-8B-Aleph-2" \ --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": "ombd/Llama-3.1-8B-Aleph-2", "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 "ombd/Llama-3.1-8B-Aleph-2" \ --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": "ombd/Llama-3.1-8B-Aleph-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ombd/Llama-3.1-8B-Aleph-2 with Docker Model Runner:
docker model run hf.co/ombd/Llama-3.1-8B-Aleph-2
Llama-3.1-8B-Aleph-2
Built with Llama. A reasoning model made from Meta's Llama 3.1 8B base by one person on a few tens of dollars of compute. It thinks inside a marked block, then answers. Every number on this page was measured on problems the model never trained on, with the same prompts' rules and the same grader for every model in the table.
This is version 2 of Llama-3.1-8B-Aleph.
What is new in version 2
- One run instead of three. Version 1 was trained in three separate stages. Version 2 comes from one single run of the same trainer, started again from the same warmup model: about seventy rounds on one GPU.
- Better on every test. It is above version 1 on all nine tests, and on eight of them by more than the tests' noise: GSM8K 72.3 to 76.0, MBPP 30.2 to 42.0, IFEval 40.5 to 50.8, tool calls 84.4 to 99.5.
- Ahead of Meta's Instruct on two tests. Tool calls and extraction, where version 1 was level with it.
What it is
- The start: Meta's Llama 3.1 8B base model (not the Instruct).
- A warmup: supervised fine-tuning (SFT), then a few short rounds of ORPO. It teaches the model to think inside a marked block and, above all, to stop when it is done. The warmup model is published too: Llama-3.1-8B-Aleph-warmup.
- The training: the Aleph trainer, which is my own. It is reinforcement learning from verifiable rewards with one idea at its center: for each problem it does not collect separate answers, it grows a tree of them, the Aleph tree. Answers share their beginnings and split along the way, so the trainer can see where in an answer the outcome was decided, and it learns from the difference between branches that ended right and branches that ended wrong. The only reward is a program's verdict on the final answer: no judge model, no human labels, nothing that scores the reasoning itself. An answer that goes in circles is ended and counted as wrong.
The numbers
Solved, percent. One greedy answer a problem (temperature 0), no examples in the prompt, the same grader for every model. Meta's Instruct is read in its own chat format and asked to box its final answer.
| test | problems | the warmup model | version 1 | this model | Meta's Llama 3.1 8B Instruct |
|---|---|---|---|---|---|
| GSM8K, grade-school math word problems | 1,319 | 52.3 | 72.3 | 76.0 | 85.8 |
| a second math set, harder and mixed (from Big-Math) | 1,009 | 30.6 | 36.2 | 40.6 | 63.2 |
| MBPP, Python tasks with hidden tests | 500 | 27.4 | 30.2 | 42.0 | 54.0 |
| HumanEval, Python functions with hidden tests | 164 | 35.4 | 38.4 | 40.2 | 70.1 |
| IFEval, following written instructions | 541 | 33.3 | 40.5 | 50.8 | 74.7 |
| tool calls: choosing a function and its arguments, as JSON | 199 | 69.8 | 84.4 | 99.5 | 82.4 |
| extraction: filling a JSON record from a text | 200 | 61.0 | 85.5 | 99.0 | 90.0 |
| following several written constraints at once (own test) | 191 | 15.7 | 15.2 | 38.2 | 47.1 |
| text puzzles (own test) | 200 | 10.5 | 12.0 | 28.5 | 31.0 |
GSM8K read the way Meta's card reads it (one greedy answer after 8 solved examples): this model 72.2, the Instruct 83.9. Meta's card says 84.5 for the Instruct, so this page's way of reading reproduces their number.
How to read the table:
- Against Meta's Instruct: ahead on tool calls and on extraction, by more than the tests' noise. Level on the text puzzles. 9.9 points behind on GSM8K and about 9 on the constraints test, 12 behind on MBPP, and far behind on harder math, IFEval and HumanEval. Meta's model had a full instruction tuning; this one had a warmup and about seventy rounds of training on one GPU.
- Against its own start: 24 points gained on GSM8K, 30 and 38 on tool calls and extraction, 18 on IFEval, 15 on MBPP, 10 on the harder math set, 22 and 18 on the two last tests. On HumanEval the gain is inside the noise.
- Against version 1: above it on every test, and by more than the noise on all but HumanEval.
- A difference under about 3 points between two models on one test is inside the noise of one pass.
- How this version was picked. The run was tested at six points along the way, with these same tests, and this is the best of them. The points next to it read 74.0 and 73.7 on GSM8K, so read that number as "about 74 to 76". The numbers in the table are this model's own and are what you get from these weights.
- The last four tests were made for this project (generated tasks, a program checks each answer). The others are public tests with their own checkers.
- The 8 examples do not help this model (72.2 against 76.0 without them): it answers in the form it was trained in.
- On the harder math set this model's answers stop by themselves 96 percent of the time; the Instruct's 88 percent.
How to use it
The chat template writes the system line the model was trained with when you give none, and opens the think block.
The answer comes after </think>.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "ombd/Llama-3.1-8B-Aleph-2"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForCausalLM.from_pretrained(name, dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "A shop sells pens at 3 for $2. How much do 12 pens cost?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt",
return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=1536, do_sample=False)
print("<think>" + tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
With vLLM:
vllm serve ombd/Llama-3.1-8B-Aleph-2 --dtype bfloat16 --max-model-len 4096
Greedy decoding (temperature 0) is the reading of the table above. The model was trained with answers of up to 1,536 tokens.
If you fine-tune it with an adapter and then merge: merge in 32-bit floats, not in 16-bit. Small changes to a weight are rounded away when they are added to 16-bit weights directly.
What it was trained on
- Math: GSM8K's training split and problems from Big-Math (checked one by one first: about a tenth of that set is flawed, and those were dropped).
- Code: MBPP's training and validation tasks (never its test split) and the easy level of APPS, each answer run against hidden tests.
- Tool calls, extraction, instruction following and text puzzles: tasks generated by programs written for this project, each answer checked by a program.
No test problem on this page was in training: every training row of every stage was compared with every test problem, and the few that matched are left out of the numbers for every model (15 of the second math set's 1,024 problems, 1 of the 200 tool-call problems, and 9 of the 200 constraints problems: one was generated again as a training task, and eight are harder versions of a training task on the same topic). HumanEval, IFEval and MBPP's test split were never trained on in any form.
Limits
- Code is still behind. This is not a code model.
- Hard math is still hard. On problems well above grade-school level it is right about four times in ten.
- Long answers can go in circles. An answer that runs to the length limit is almost never a deep one.
- English only in training and in every test here.
- It can be confidently wrong, like any model of its size. Check what matters.
Acknowledgments
The trainer's idea and design, the experiments and every decision are the author's. Claude (Anthropic) was the engineering partner for the code, the tests and the records.
Licence
Llama 3.1 Community License. The licence and Meta's acceptable use policy are in this repo.
Author: Omar Badran.
- Downloads last month
- 32
