Orca 2 is built for research purposes only and provides a single turn response in tasks such as reasoning over user given data, reading comprehension, math problem solving and text summarization. The model is designed to excel particularly in reasoning.
Note that:
This is a research model, intended to show that we can use capable models and complex workflows (advanced prompts, multiple calls) to create synthetic data that can teach Small Language Models (SLMs) new capabilities. We chose reasoning because it is a widely useful capability that SLMs lack.
The model is not optimized for chat and has not been trained with RLHF or DPO. It is best used after being finetuned for chat or for a specific task.
Beyond reasoning, the model inherits capabilities and limitations of its base (LLAMA-2 base). We have already seen that the benefits of the Orca training can be applied to other base model too.
We make Orca 2's weights publicly available to support further research on the development, evaluation, and alignment of SLMs.
What is Orca 2’s intended use(s)?
Orca 2 is built for research purposes only.
The main purpose is to allow the research community to assess its abilities and to provide a foundation for
building better frontier models.
How was Orca 2 evaluated?
Orca 2 has been evaluated on a large number of tasks ranging from reasoning to grounding and safety. Please refer
to Section 6 and Appendix in the Orca 2 paper for details on evaluations.
Model Details
Orca 2 is a finetuned version of LLAMA-2. Orca 2’s training data is a synthetic dataset that was created to enhance the small model’s reasoning abilities.
All synthetic training data was moderated using the Microsoft Azure content filters. More details about the model can be found in the Orca 2 paper.
Please refer to LLaMA-2 technical report for details on the model architecture.
Orca 2, built upon the LLaMA 2 model family, retains many of its limitations, as well as the
common limitations of other large language models or limitation caused by its training process,
including:
Data Biases: Large language models, trained on extensive data, can inadvertently carry
biases present in the source data. Consequently, the models may generate outputs that could
be potentially biased or unfair.
Lack of Contextual Understanding: Despite their impressive capabilities in language understanding and generation, these models exhibit limited real-world understanding, resulting
in potential inaccuracies or nonsensical responses.
Lack of Transparency: Due to the complexity and size, large language models can act
as “black boxes”, making it difficult to comprehend the rationale behind specific outputs or
decisions. We recommend reviewing transparency notes from Azure for more information.
Content Harms: There are various types of content harms that large language models
can cause. It is important to be aware of them when using these models, and to take
actions to prevent them. It is recommended to leverage various content moderation services
provided by different companies and institutions. On an important note, we hope for better
regulations and standards from government and technology leaders around content harms
for AI technologies in future. We value and acknowledge the important role that research
and open source community can play in this direction.
Hallucination: It is important to be aware and cautious not to entirely rely on a given
language model for critical decisions or information that might have deep impact as it is
not obvious how to prevent these models from fabricating content. Moreover, it is not clear
whether small models may be more susceptible to hallucination in ungrounded generation
use cases due to their smaller sizes and hence reduced memorization capacities. This is an
active research topic and we hope there will be more rigorous measurement, understanding
and mitigations around this topic.
Potential for Misuse: Without suitable safeguards, there is a risk that these models could
be maliciously used for generating disinformation or harmful content.
Data Distribution: Orca 2’s performance is likely to correlate strongly with the distribution
of the tuning data. This correlation might limit its accuracy in areas underrepresented in
the training dataset such as math, coding, and reasoning.
System messages: Orca 2 demonstrates variance in performance depending on the system
instructions. Additionally, the stochasticity introduced by the model size may lead to
generation of non-deterministic responses to different system instructions.
Zero-Shot Settings: Orca 2 was trained on data that mostly simulate zero-shot settings.
While the model demonstrate very strong performance in zero-shot settings, it does not show
the same gains of using few-shot learning compared to other, specially larger, models.
Synthetic data: As Orca 2 is trained on synthetic data, it could inherit both the advantages
and shortcomings of the models and methods used for data generation. We posit that Orca
2 benefits from the safety measures incorporated during training and safety guardrails (e.g.,
content filter) within the Azure OpenAI API. However, detailed studies are required for
better quantification of such risks.
This model is solely designed for research settings, and its testing has only been carried
out in such environments. It should not be used in downstream applications, as additional
analysis is needed to assess potential harm or bias in the proposed application.
1#@title Live Chat with Orca2import torch
3from transformers import AutoTokenizer, AutoModelForCausalLM
45# Load the tokenizer and model6quant_path ="oieieio/Orca-2-13b-awq"7tokenizer = AutoTokenizer.from_pretrained(quant_path)8model = AutoModelForCausalLM.from_pretrained(quant_path)910# Move the model to GPU if available11device ='cuda'if torch.cuda.is_available()else'cpu'12model.to(device)1314# Initial system message15system_message ="You are Orca, an AI language model created by Microsoft. You are a cautious assistant..."1617whileTrue:18# User input19 user_message =input("User: ")20if user_message.lower()=='quit':21break2223# Construct the prompt24 prompt =f"system\n{system_message}\nuser\n{user_message}\nassistant"2526# Encode and generate response27 inputs = tokenizer(prompt, return_tensors='pt').to(device)28 output_ids = model.generate(inputs["input_ids"], max_length=512)29 answer = tokenizer.decode(output_ids[0], skip_special_tokens=True)3031# Print the response32print("AI: ", answer)
python
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
34# Load the tokenizer and model5quant_path ="oieieio/Orca-2-13b-awq"6tokenizer = AutoTokenizer.from_pretrained(quant_path)7model = AutoModelForCausalLM.from_pretrained(quant_path)89# Move the model to GPU if available10device ='cuda'if torch.cuda.is_available()else'cpu'11model.to(device)1213# Initial system message14system_message ="You are Orca, an AI language model created by Microsoft. You are a cautious assistant..."1516whileTrue:17 user_message =input("User: ")18if user_message.lower()=='quit':19break2021 prompt =f"system\n{system_message}\nuser\n{user_message}\nassistant"22 inputs = tokenizer(prompt, return_tensors='pt').to(device)2324 output_ids = model.generate(25 inputs["input_ids"],26 max_new_tokens=50,# Adjust the number of generated tokens27 temperature=0.7,# Adjust for randomness28 top_k=50,# Adjust the number of highest probability tokens to consider29 top_p=0.95,# Adjust the cumulative probability threshold30 do_sample=True# Use sampling instead of greedy decoding3132)33 answer = tokenizer.decode(output_ids[0], skip_special_tokens=True)34print("AI: ", answer)
python
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
34# Load the tokenizer and model from Hugging Face Hub5quant_path ="oieieio/Orca-2-13b-awq"6tokenizer = AutoTokenizer.from_pretrained(quant_path)7model = AutoModelForCausalLM.from_pretrained(quant_path)89# Move the model to GPU if available10device ='cuda'if torch.cuda.is_available()else'cpu'11model.to(device)1213# First turn of the conversation14system_message ="You are Orca, an AI language model created by Microsoft. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior."15user_message ="How can you determine if a restaurant is popular among locals or mainly attracts tourists, and why might this information be useful?"1617prompt =f"system\n{system_message}\nuser\n{user_message}\nassistant"1819# Encode the first prompt20inputs = tokenizer(prompt, return_tensors='pt').to(device)21output_ids = model.generate(inputs["input_ids"], max_length=512)2223# Decode the first response24answer = tokenizer.decode(output_ids[0], skip_special_tokens=True)2526# Print the first response27print(answer)2829# Second turn of the conversation30second_turn_user_message ="Give me a list of the key points of your first answer."3132# Append the second turn message to the already generated ids without adding special tokens33second_turn_message_in_markup =f"\nuser\n{second_turn_user_message}\nassistant"34second_turn_tokens = tokenizer(second_turn_message_in_markup, return_tensors='pt', add_special_tokens=False).to(device)35second_turn_input_ids = torch.cat([output_ids, second_turn_tokens['input_ids']], dim=1)3637# Generate the second response38output_ids_2 = model.generate(second_turn_input_ids, max_length=1024)3940# Decode the second response41second_turn_answer = tokenizer.decode(output_ids_2[0], skip_special_tokens=True)4243# Print the second response44print(second_turn_answer)45
Citation
bibtex
1@misc{mitra2023orca,
2 title={Orca 2: Teaching Small Language Models How to Reason},
3 author={Arindam Mitra and Luciano Del Corro and Shweti Mahajan and Andres Codas and Clarisse Simoes and Sahaj Agrawal and Xuxi Chen and Anastasia Razdaibiedina and Erik Jones and Kriti Aggarwal and Hamid Palangi and Guoqing Zheng and Corby Rosset and Hamed Khanpour and Ahmed Awadallah},
4 year={2023},
5 eprint={2311.11045},
6 archivePrefix={arXiv},
7 primaryClass={cs.AI}
8}