Llama Guard (7B) API

Enhanced AI moderation with Llama Guard, a specialized LLM model
Output
$0.21 / 1M

Overview

Llama Guard (7B) Description

Llama Guard is an LLM-based model, particularly the Llama2-7b version, designed to enhance the safety of Human-AI conversations. It incorporates a comprehensive safety risk taxonomy, aiding in the classification of safety risks associated with LLM prompts and responses. This model has been instruction-tuned on a carefully curated high-quality dataset, exhibiting robust performance in benchmarks like the OpenAI Moderation Evaluation dataset and ToxicChat. Its capabilities are on par with, or exceed, those of existing content moderation tools.

Safety Risk Taxonomy

The safety risk taxonomy within Llama Guard serves as a foundational tool for categorizing specific safety risks found in LLM prompts, known as prompt classification, and the responses generated by LLMs, referred to as response classification. This systematic approach enhances the model's ability to ensure safer interactions in AI-generated conversations.

Performance and Tuning

Despite its lower data volume, Llama Guard demonstrates exceptional performance, matching or surpassing current content moderation solutions in accuracy and reliability. The model carries out multi-class classification and provides binary decision scores, benefiting from instruction fine-tuning. This fine-tuning process allows for task customization and output format adaptation, making Llama Guard a flexible tool for various safety-related applications.

Customization and Adaptability

Instruction fine-tuning also enables Llama Guard to adjust taxonomy categories and facilitate zero-shot or few-shot prompting, allowing for seamless integration with diverse taxonomies. This adaptability enhances the model’s utility across different use cases, ensuring tailored safety measures in AI interactions.

Availability and Future Development

The Llama Guard model weights are made available to the public, encouraging researchers to further refine and adapt the model to meet the community's evolving AI safety needs. This open approach aims to foster innovation and continual improvement in AI moderation and safety practices.

Usage

Use cases

  • Classifying the safety of incoming prompts to LLMs
  • Classifying the safety of responses generated by LLMs
  • Detecting unsafe content and policy violations in Human-AI conversations
  • Generating binary classification scores for safety decisions
  • Adaptable for custom safety taxonomies and moderation policies

How to use Llama Guard (7B) API

Install any OpenAI-compatible SDK, point it at api.aimlapi.com/v1, and set the model to .

OpenAI-compatible — swap the base URL and it works with your existing SDK.

Llama Guard (7B) API Pricing

TypePrice
Input
$0.21 / 1M
Output
$0.21 / 1M

Frequently asked questions

Llama Guard (7B) is priced at input $0.21 / 1M, output $0.21 / 1M.

Yes, Llama Guard (7B) can stream responses as they are generated.

Yes, Llama Guard (7B) supports both function calling and structured outputs.

Llama Guard (7B) was built by Meta.

Start building with Llama Guard (7B)

Get API Key
1000+ models, one API.