AI Tools & GPT AGENTS Directory

stabilityai/StableBeluga2 · Hugging Face

May 17, 2024
stabilityai/StableBeluga2 · Hugging Face

Discover the Capabilities of Stable Beluga 2

In the realm of text generation, AI models are transforming the landscape. One such marvel of technology is the Stable Beluga 2, developed by Stability AI. This sophisticated language model is designed to follow instructions with precision, aiding users in a variety of tasks from crafting written content to generating creative compositions.

What is Stable Beluga 2?

At the heart of Stable Beluga 2 is an auto-regressive language model that builds on the foundations of the Llama2 70B. Its primary function is to understand and complete tasks communicated through text by producing contextually relevant and coherent responses.

How Does Stable Beluga 2 Work?

For those curious to interact with Stable Beluga 2, initiating a conversation is straightforward thanks to a simple code implementation. By integrating a few lines of code in Python, users can set up the model to respond to prompts. Here's a quick look at the process:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

tokenizer = AutoTokenizer.from_pretrained("stabilityai/StableBeluga2", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("stabilityai/StableBeluga2", torch_dtype=torch.float16, low_cpu_mem_usage=True, device_map="auto")

system_prompt = "### System:\nYou are Stable Beluga, an AI that follows instructions extremely well. Help as much as you can. Remember, be safe, and don't do anything illegal.\n\n"
message = "Write me a poem please"
prompt = f"{system_prompt}### User: {message}\n\n### Assistant:\n"

inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=256)
print(tokenizer.decode(output[0], skip_special_tokens=True))

When using Stable Beluga 2, it's essential to format your prompts as shown in the code snippet to ensure model comprehension and appropriate responses.

Training and Model Quality

The proficiency of Stable Beluga 2 comes from its training on Stability AI's internal Orca-style dataset, optimized through a detailed procedure involving mixed-precision and the AdamW optimizer. This has crafted a model known for detailed and accurate text generation.

Ethical Use and Limitations

Like any tool, Stable Beluga 2 carries a responsibility for ethical use. While the technology is innovative, it's not without its risks. Testing has primarily been conducted in English, and there's no guarantee against the production of inaccurate or biased outputs. Users and developers are encouraged to rigorously test and adapt the model before integrating it into applications.

How to Reach Out

For anyone seeking to learn more or address queries regarding Stable Beluga 2, Stability AI welcomes contact via email at

In Summary

Stable Beluga 2 embodies the advancements in text generation AI, offering a resourceful tool for developers and content creators alike. While mindful usage is required due to its inherent limitations, the potential applications of such a model in crafting text are broad and quite promising.

For a deeper dive into the model, exploring the Hugging Face community documentation is advisable. As AI continues to evolve, models like Stable Beluga 2 represent steps towards more fluent and capable machine-assisted writing.

Learn more about Stable Beluga 2

Explore the Hugging Face community

Considerations on Using Stable Beluga 2


  • Facilitates various text generation tasks with ease
  • Accessible for users with programming knowledge
  • Trained on a comprehensive internal dataset for quality output


  • Potential for producing biased or inaccurate content
  • Testing is limited to English; capabilities in other languages are not verified
  • Requires careful ethical consideration in its application

Similar AI Tools & GPT Agents