Model Overview
Model Features
Model Capabilities
Use Cases
๐ A bagel, with everything (except DPO)
This model, named "llama-3-bagel-8b-v1.0", is built upon Meta's llama-3. It's a fine - tuned version of llama - 3 - 8b using the bagel dataset, standardized on the llama - 3 instruct prompt format instead of 4 different prompt formats.
๐ Quick Start
The model is ready for use once you've set up the appropriate environment. You can refer to the bagel repository for more details on the datasets used. The DPO version will be available soon here.
โจ Features
- Fine - tuned on Diverse Datasets: Utilizes a wide range of data sources, including AI - related datasets, coding problems, and multi - lingual content, to enhance its performance in various tasks.
- Standardized Prompt Format: Adopts the llama - 3 instruct prompt format, making it easier to use and integrate.
- Multiple Prompting Strategies: Supports different prompting strategies such as context - obedient question answering, summarization, function calling, chain of thought, and reWOO style function planning/execution.
๐ฆ Installation
No specific installation steps are provided in the original README.
๐ป Usage Examples
Basic Usage
Here is an example of using the tokenizer's apply_chat_template
method to format prompts:
import transformers
tokenizer = transformers.AutoTokenizer.from_pretrained("jondurbin/bagel-8b-v1.0", trust_remote_code=True)
chat = [
{"role": "system", "content": "You are Bob, a friendly AI assistant."},
{"role": "user", "content": "Hello, how are you?"},
{"role": "assistant", "content": "I'm doing great. How can I help you today?"},
{"role": "user", "content": "I'd like to show off how chat templating works!"},
]
print(tokenizer.apply_chat_template(chat, tokenize=False))
Advanced Usage
Context Obedient Question Answering
The following is an example of a closed - context prompt for question answering:
BEGININPUT
BEGINCONTEXT
[date: 2021-01-01]
[url: https://web.site/123]
ENDCONTEXT
In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
ENDINPUT
BEGININSTRUCTION
What color are blueberries? Source?
ENDINSTRUCTION
The model's response should be:
Blueberries are now green.
Source:
date: 2021-01-01
url: https://web.site/123
Summarization
For summarization tasks, use the following format:
BEGININPUT
{text to summarize}
ENDINPUT
BEGININSTRUCTION
Summarize the input in around 130 words.
ENDINSTRUCTION
Function Calling
There are two main function - calling formats:
Format 1: From airoboros dataset Prompt:
As an AI assistant, please select the most suitable function and parameters from the list of available functions below, based on the user's input. Provide your response in JSON format.
Input: I want to know how many times 'Python' is mentioned in my text file.
Available functions:
file_analytics:
description: This tool performs various operations on a text file.
params:
action: The operation we want to perform on the data, such as "count_occurrences", "find_line", etc.
filters:
keyword: The word or phrase we want to search for.
Response:
{
"function": "file_analytics",
"params": {
"action": "count_occurrences",
"filters": {
"keyword": "Python"
}
}
}
Format 2: GlaiveAI function calling Prompt:
<|start_header_id|>system<|end_header_id|>
You are a helpful assistant with access to the following functions. Use them if required -
{
"name": "generate_random_name",
"description": "Generate a random name",
"parameters": {
"type": "object",
"properties": {
"gender": {
"type": "string",
"description": "The gender of the name (e.g. male, female)"
}
},
"required": [
"gender"
]
}
}
<|eot_id|>
<|start_header_id|>user<|end_header_id|>
I need a random male name for my novel's character.<|eot_id|>
<|start_header_id|>assistant<|end_header_id|>
Response:
<|begin_func|> {"name": "generate_random_name", "arguments": '{"gender": "male"}'} <|end_func|>
Then, re - prompt the model with the function response:
<|begin_func_response|>{"name": "James"}<|end_func_response|>
The final response:
How about the name "James" for your novel's character?
Chain of Thought
Example prompt:
A group of people decide to play a round - robin tournament where every player plays every other player exactly once. If a total of 45 games were played, how many players participated in the tournament? Offer several potential answers, rank them according to mathematical logic, and pick the most feasible one.
Example response:
Solution 1:
In a round - robin tournament, each player plays every other player exactly once. This means that the total number of games played is equal to the combination of all players taken two at a time (since a game involves two players).
The formula for combinations is nC2 = n(n - 1)/2, where n is the total number of players. We know that nC2 equals 45 (the total number of games), so we can set up the equation as follows:
n(n - 1)/2 = 45
Solving this equation gives us n = 10.
Final answer: There were 10 players in the tournament.
Solution 2:
Another way to approach this problem is by using the concept of triangular numbers. Triangular numbers are a sequence of numbers where each number can be represented as a triangle with dots. The nth triangular number is given by the sum of the first n natural numbers.
If we consider each game as a dot and each player as a side of the triangle, then the total number of games (45) would correspond to the 9th triangular number because 1+2+3+4+5+6+7+8+9 = 45. However, since each side of the triangle represents a player, and there's one more player than sides in our model (because the last player has no one left to play against), we need to add one more to get the total number of players.
Final answer: There were 10 players in the tournament.
Solution 3:
We could also use trial and error to solve this problem. Starting from a small number of players, we calculate how many games would be played in a round - robin tournament until we reach 45 games. For example, with 2 players, only 1 game is played; with 3 players, 3 games are played; with 4 players, 6 games are played, and so on. Continuing this process, we find that with 10 players, 45 games are played.
Final answer: There were 10 players in the tournament.
Ranking of solutions from best to worst:
1. Solution 1: This solution uses direct mathematical reasoning based on the properties of a round - robin tournament and solves an equation to find the answer.
2. Solution 2: This solution uses the concept of triangular numbers which requires additional steps and knowledge beyond the immediate problem context, but still arrives at the correct answer.
3. Solution 3: This solution relies on trial and error, which is less efficient and reliable than the other methods, but it eventually gets to the right answer.
Best and final answer: There were 10 players in the tournament.
๐ Documentation
Data Sources
There are numerous data sources used in the bagel models. See https://github.com/jondurbin/bagel for more information.
Only train splits are used, and a decontamination by cosine similarity is performed at the end as a sanity check against common benchmarks. If you don't know the difference between train and test, please learn.
SFT data sources
- ai2_arc
- Abstraction and reasoning dataset, useful in measuring "intelligence" to a certain extent.
- airoboros
- Variety of categories of synthetic instructions generated by gpt - 4.
- apps
- Python coding dataset with 10k problems.
- belebele
- Multi - lingual reading comprehension dataset.
- bluemoon
- Roleplay data scraped from Bluemoon, then cleaned and formatted as ShareGPT.
- boolq
- Corpus of yes/no questions (which can be surprisingly difficult for AI to answer apparently?)
- camel - ai biology
- GPT - 4 generated biology instructions.
- camel - ai chemistry
- GPT - 4 generated chemistry instructions.
- camel - ai math
- GPT - 4 generated math instructions.
- camel - ai physics
- GPT - 4 generated physics instructions.
- capybara
- Multi - turn dataset used to create the capybara models.
- cinematika (instruction and plain text)
- RP - style data synthesized from movie scripts so the model isn't quite as boring as it otherwise would be.
- emobank
- Emotion annotations using the Valence - Arousal - Domninance scheme.
- evol - instruct
- WizardLM's evol instruct 70k dataset.
- glaive - function - calling - v2
- GlaiveAI function calling dataset.
- gutenberg (plain text)
- Books/plain text, again to make the model less boring, only a handful of examples supported by chapterize
- limarp - augmented
- Augmented and further modified version of LimaRP
- lmsys_chat_1m (only gpt - 4 items, also used for DPO)
- Chats collected by the lmsys chat arena, containing a wide variety of chats with various models.
- lollms
- LoLLMs question answering dataset by ParisNeo, with helpful question answer pairs for using LoLLMs.
- mathinstruct
- Composite dataset with a variety of math - related tasks and problem/question formats.
- natural_instructions
- Millions of instructions from 1600+ task categories (sampled down substantially, stratified by task type)
- openbookqa
- Question answering dataset.
- pippa
- Deduped version of PIPPA in ShareGPT format.
- piqa
- Phyiscal interaction question answering.
- python_alpaca
- Python instruction response pairs, validated as functional.
- ropes
- Reasoning Over PAragraph Effects in Situations - enhances ability to apply knowledge from a passage of text to a new situation.
- rosetta_code
- Code problems and solutions in a variety of programming languages taken from rosettacode.org.
- slimorca
- Collection of ~500k gpt - 4 verified chats from OpenOrca.
- sql - create - context
- SQL - targeted dataset, combining WikiSQL and Spider.
- squad_v2
- Contextual question answering (RAG).
- airoboros - summarization
- Combination of various summarization datasets, formatted into the airoboros context - obedient format.
- synthia
- GPT - 4 generated data using advanced prompting from Migel Tissera.
- whiterabbitneo chapter 1 and chapter 2
- Offensive cybersecurity dataset by WhiteRabbitNeo/Migel Tissera
- winogrande
- Fill in the blank style prompts.
DPO data sources
- airoboros 3.2 vs airoboros m2.0
- The creative/writing tasks from airoboros - 2.2.1 were re - generated using gpt4 - 0314 and a custom prompt to get longer, more creative, less clichโยฎ responses for airoboros 3.1, so we can use the shorter/boring version as the "rejected" value and the rerolled response as "chosen"
- contextual - dpo
- Contextual prompt/response dataset using the airoboros context - obedient question answering format.
- helpsteer
- Really neat dataset provided by the folks at NVidia with human annotation across a variety of metrics. Only items with the highest "correctness" value were used for DPO here, with the highest scoring output as "chosen" and random lower scoring value as "rejected"
- distilabel_orca_dpo_pairs
- Another interesting dataset, originally by Intel, enhanced by argilla with distilabel which provides various DPO pairs generated from prompts included in the SlimOrca dataset.
- gutenberg - dpo
- DPO pairs meant to increase the models novel writing abilities, using public domain books from https://gutenberg.org/
- py - dpo
- Python DPO dataset (based on the SFT python_alpaca dataset above)
- toxic - dpo
- highly toxic and potentially illegal content! De - censorship, for academic and lawful purposes only, of course. Generated by llama - 2 - 70b via prompt engineering.
- truthy
- DPO pairs meant to increase truthfulness of the model, e.g. common misconceptions, differentiate between AI assistants and roleplayed human in terms of corporeal awareness/locality/etc.
- ultrafeedback
- One of the bits of magic behind the Zephyr model. Only the items with a chosen score of 8 or higher were included.
Prompt Formatting
The model uses the llama - 3 - instruct prompt template, and it's provided in the tokenizer config. You can use the apply_chat_template
method to accurately format prompts.
Prompting Strategies
Context Obedient Question Answering
This is a special prompt format for answering questions from provided context, e.g., RAG. The model was trained to ignore its prior knowledge and use the context to answer questions, and was tuned to limit responses to the provided context to reduce hallucinations.
The format for a closed - context prompt is as follows:
BEGININPUT
BEGINCONTEXT
[key0: value0]
[key1: value1]
... other metdata ...
ENDCONTEXT
[insert your text blocks here]
ENDINPUT
[add as many other blocks, in the exact same format]
BEGININSTRUCTION
[insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
ENDINSTRUCTION
It's advisable to add "Don't make up answers if you don't know." to the instruction block.
Summarization
The summarization prompt format is the same as context - obedient question answering, and it's fine - tuned with this dataset.
Function Calling
There are two primary function - calling formats: one from the airoboros dataset and the GlaiveAI function - calling format.
Chain of Thought
This strategy is useful for having the model propose multiple possible responses, reason through each, and select the most probable answer.
reWOO style function planning/execution
The model supports execution planning for complex instructions.
๐ง Technical Details
The model is a fine - tuned version of the Meta - llama/Meta - Llama - 3 - 8B base model. It uses a wide range of datasets for training to enhance its performance in different tasks.
๐ License
This project is licensed under the llama3 license.
Property | Details |
---|---|
Model Type | Fine - tuned version of Meta - Llama - 3 - 8B |
Training Data | Multiple datasets including ai2_arc, allenai/ultrafeedback_binarized_cleaned, etc. |

