Company

Filter responses of any model with Llama Guard or your own safety model

December 10, 2023

By 

Together

We’re excited to announce we’ve partnered with Meta to make Llama Guard available through the Together Platform.

You can now use Llama Guard, an LLM-based input-output safeguard model through the Together API. From Day 1, Together API was designed with safety in mind – It natively supports optional safety models to moderate any open model that is being hosted. Now you can use Llama Guard with all 100+ open models that are available, by adding one parameter to your API call (safety_model=Meta-Llama/Llama-Guard-7b). You can also run Llama Guard as a model on its own.

Llama Guard is an openly available model that performs competitively on common open benchmarks and provides developers with a pretrained model to help defend against generating potentially risky outputs.

We are committed to transparent and safe science, and are thrilled to help build towards open trust and safety in the new world of generative AI.

We are also working closely with the Meta team to allow end users to benchmark their models against their Cybersecurity Evals.

1. Use Llama Guard as a standalone classifier

Use this code snippet in your command line to run inference on Llama-Guard-7b:

curl -v -X POST https://api.together.xyz/inference \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $TOGETHER_API_KEY" \
  -d '{
  "model": "Meta-Llama/Llama-Guard-7b",
  "messages": [ { "role": "user", "content": "a horse is a horse" } ]
}'

2. Use Llama Guard as a filter to safeguard responses from 100+ models

Use this code snippet in your command line to run inference of any of our 100+ models together with Llama Guard (the only change is adding the safety_model parameter):

curl -v -X POST https://api.together.xyz/inference \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $TOGETHER_API_KEY" \
  -d '{
  "model": "togethercomputer/llama-2-13b-chat",
  "max_tokens": 32,
  "prompt": "a horse is a horse",
  "temperature": 0.1,
  "safety_model": "Meta-Llama/Llama-Guard-7b"
}'

Llama Guard is also available in our playground: 

  • LOREM IPSUM

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.

    $0.030/image

    Try it out
  • LOREM IPSUM

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.

    $0.030/image

    Try it out
  • Value Prop #1

    Body copy goes here lorem ipsum dolor sit amet

    • Bullet point goes here lorem ipsum  
    • Bullet point goes here lorem ipsum  
    • Bullet point goes here lorem ipsum  
  • Value Prop #1

    Body copy goes here lorem ipsum dolor sit amet

    • Bullet point goes here lorem ipsum  
    • Bullet point goes here lorem ipsum  
    • Bullet point goes here lorem ipsum  
  • Value Prop #1

    Body copy goes here lorem ipsum dolor sit amet

    • Bullet point goes here lorem ipsum  
    • Bullet point goes here lorem ipsum  
    • Bullet point goes here lorem ipsum  
  • List Item  #1

    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
  • List Item  #1

    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
  • List Item  #1

    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
    • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.
  • List Item  #2

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

  • List Item #2

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

  • List Item #3

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

  • Build

    Benefits included:

    • ✔ Up to $15K in free platform credits*

    • ✔ 3 hours of free forward-deployed engineering time.

    Funding: Less than $5M

  • Grow

    Benefits included:

    • ✔ Up to $30K in free platform credits*

    • ✔ 6 hours of free forward-deployed engineering time.

    Funding: $5M - $10M

  • Scale

    Benefits included:

    • ✔ Up to $50K in free platform credits*

    • ✔ 10 hours of free forward-deployed engineering time.

    Funding: $10M - $25M

Start
building
yours
here →