Orca-2-13b-awq | Quantized 4 Bit

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:

  1. 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.
  2. 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.
  3. 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.

License

Orca 2 is licensed under the Microsoft Research License.

Llama 2 is licensed under the LLAMA 2 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.

Bias, Risks, and Limitations

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.

Getting started with Orca-2-13b-awq

Inference with Hugging Face library

!pip install autoawq
!pip install torch --upgrade --index-url https://download.pytorch.org/whl/cu121
#@title Live Chat with Orca
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Load the tokenizer and model
quant_path = "oieieio/Orca-2-13b-awq"
tokenizer = AutoTokenizer.from_pretrained(quant_path)
model = AutoModelForCausalLM.from_pretrained(quant_path)

# Move the model to GPU if available
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model.to(device)

# Initial system message
system_message = "You are Orca, an AI language model created by Microsoft. You are a cautious assistant..."

while True:
    # User input
    user_message = input("User: ")
    if user_message.lower() == 'quit':
        break

    # Construct the prompt
    prompt = f"system\n{system_message}\nuser\n{user_message}\nassistant"

    # Encode and generate response
    inputs = tokenizer(prompt, return_tensors='pt').to(device)
    output_ids = model.generate(inputs["input_ids"], max_length=512)
    answer = tokenizer.decode(output_ids[0], skip_special_tokens=True)

    # Print the response
    print("AI: ", answer)
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Load the tokenizer and model
quant_path = "oieieio/Orca-2-13b-awq"
tokenizer = AutoTokenizer.from_pretrained(quant_path)
model = AutoModelForCausalLM.from_pretrained(quant_path)

# Move the model to GPU if available
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model.to(device)

# Initial system message
system_message = "You are Orca, an AI language model created by Microsoft. You are a cautious assistant..."

while True:
    user_message = input("User: ")
    if user_message.lower() == 'quit':
        break

    prompt = f"system\n{system_message}\nuser\n{user_message}\nassistant"
    inputs = tokenizer(prompt, return_tensors='pt').to(device)

    output_ids = model.generate(
        inputs["input_ids"], 
        max_new_tokens=50,  # Adjust the number of generated tokens
        temperature=0.7,    # Adjust for randomness
        top_k=50,           # Adjust the number of highest probability tokens to consider
        top_p=0.95,         # Adjust the cumulative probability threshold
        do_sample=True     # Use sampling instead of greedy decoding
          
    )
    answer = tokenizer.decode(output_ids[0], skip_special_tokens=True)
    print("AI: ", answer)
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Load the tokenizer and model from Hugging Face Hub
quant_path = "oieieio/Orca-2-13b-awq"
tokenizer = AutoTokenizer.from_pretrained(quant_path)
model = AutoModelForCausalLM.from_pretrained(quant_path)

# Move the model to GPU if available
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model.to(device)

# First turn of the conversation
system_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."
user_message = "How can you determine if a restaurant is popular among locals or mainly attracts tourists, and why might this information be useful?"

prompt = f"system\n{system_message}\nuser\n{user_message}\nassistant"

# Encode the first prompt
inputs = tokenizer(prompt, return_tensors='pt').to(device)
output_ids = model.generate(inputs["input_ids"], max_length=512)

# Decode the first response
answer = tokenizer.decode(output_ids[0], skip_special_tokens=True)

# Print the first response
print(answer)

# Second turn of the conversation
second_turn_user_message = "Give me a list of the key points of your first answer."

# Append the second turn message to the already generated ids without adding special tokens
second_turn_message_in_markup = f"\nuser\n{second_turn_user_message}\nassistant"
second_turn_tokens = tokenizer(second_turn_message_in_markup, return_tensors='pt', add_special_tokens=False).to(device)
second_turn_input_ids = torch.cat([output_ids, second_turn_tokens['input_ids']], dim=1)

# Generate the second response
output_ids_2 = model.generate(second_turn_input_ids, max_length=1024)

# Decode the second response
second_turn_answer = tokenizer.decode(output_ids_2[0], skip_special_tokens=True)

# Print the second response
print(second_turn_answer)

Citation

@misc{mitra2023orca,
      title={Orca 2: Teaching Small Language Models How to Reason}, 
      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},
      year={2023},
      eprint={2311.11045},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}
Downloads last month
23
Safetensors
Model size
2.03B params
Tensor type
I32
·
FP16
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.