We are committed to supporting our community in building Llama applications responsibly. In addition to our Llama Protections effort, we provide this Developer Use Guide that outlines best practices in the context of Responsible GenAI. In this section, we provide resources to facilitate the implementation of these best practices.
Based on the intended use and audience for your product, a content policy defines what content is allowable and may specify safety limitations on producing illegal, violent, or harmful content. These limits should be evaluated in light of the product domain, as specific sectors and regions may have different laws or standards.
If you are new to value considerations in the development and deployment of AI, refer to the principles and guidance on risk management released by academic institutions and governing organization, such as:
You can also use existing standards to build a baseline policy to cover commonly agreed upon harms. MLCommons published a taxonomy of these categoriesāalong with definitionsāas well as a survey on existing taxonomies in their whitepaper. The MLCommons harm taxonomy comprises the following harm areas:
There are 3 general steps needed to responsibly fine-tune an LLM for alignment, guided at a high level by Metaās Responsible AI framework.
Preparing data includes annotating a dataset. Below are helpful tips on what to include in a guideline document for annotators, that provides instructions on how to complete the task:
Consider what volume of data is required for your task.
Specify an appropriate interface for annotators
Engage with your privacy or legal partner to ensure data processing is in accordance with relevant privacy regulations.
Considerations might include whether first-party data needs to be passed to the annotators and whether additional privacy mitigations, such as image blurring, might be required.
Pay attention to how human feedback and annotation of data may further polarize a fine-tuned model with respect to subjective opinions. Take steps to prevent injecting bias into annotation guidelines and to mitigate the effect of annotatorsā bias. Resources on this topic include:
Fine-tuning an LLM for safety can involve a number of techniques, many of which the research paper on Llama 2 and Llama 3.1 describes in greater depth. You can follow the Meta Llama fine-tuning recipe to get started with finetuning your model for safety. Hugging Face provides further detailed information on how to implement the most commonly used fine-tuning method in their alignment handbook.
To evaluate your model, you could rely on your own private benchmarks. This requires building your own dataset and safety evaluation solution. However, we believe safety evaluations should be standardized to ensure transparency and a consistent, industry-wide approach to safety testing. Such standards are emerging, such as the MLCommons AI Safety v0.5 Proof of Concept.
In the meantime, we recommend using public benchmarking platforms and datasets:
As outlined in our Developer Use Guide, you should deploy appropriate system level safeguards to mitigate safety and security risks of your system. As part of our responsible release approach, we provide open source solutions including:
To get started building with Llama safeguards, head to our ready-to-use recipes on GitHub. We also provide notebooks to tune Llama Guard on your own dataset: GitHub - PurpleLlama, GitHub - Cookbook - Responsible AI.
Transparency and feedback mechanisms are of the utmost importance for safety. We recommend becoming familiar with the Llama Model Card and creating your own model card if you are building a custom LLM.
If you identify harmful content generated from Llama models, please provide feedback here.