Mitigate potential harms
Unit 5 of 8 · Module 6: Implement a responsible generative AI solution in Microsoft Foundry
Go deeper
Unlocks when you've watched the lesson.
Read this lesson
Four layers
With a baseline, and a way to measure harmful output, you can start to mitigate the harms, then retest the changed system when it makes sense, and compare the new harm levels with the baseline. Mitigation comes in layers, like the safety on a roller coaster: no single measure does it all. There are four layers to work with: the model, the safety system, the system message and grounding, and the user experience. The model layer is the generative AI model, or models, at the center of your solution, like GPT-4: the coaster train itself. Here, you choose a model that suits the job it's meant to do. GPT-4 is powerful and flexible, but if your solution only sorts short, specific pieces of text, a simpler model may do the job with less risk of producing harmful content, like picking a gentle family ride for a small park. You can also fine-tune a foundation model on your own training data, so its answers are more likely to stay relevant and inside your scenario, like building a train custom-made for your track.
The safety system
The safety system layer covers settings and features at the platform level that help reduce harm: the ride's control booth. Microsoft Foundry supports guardrails that block prompts and responses using content filters. The filters rate content in four harm categories, hate and fairness, sexual, violence, and self-harm, at four severity levels: safe, low, medium, and high; guardrails can add other checks too, like task adherence, which watches that an agent's actions stay on task. Foundry guardrails also include prompt shields, which catch prompt attacks, like a user trying to subvert the system prompt, or instructions hidden in a document the model reads, the way a gate attendant catches someone sneaking around the barrier.
Prompts and the experience
The system message and grounding layer is about how you build the prompts that go to the model: the track and the ride program. You can write system inputs that set the model's rules of behavior. You can use prompt engineering to add grounding data to the prompts, so relevant, harmless output is as likely as possible. And you can use retrieval augmented generation to bring in context from trusted sources. The user experience layer is the app people actually use to talk to the model, plus the documentation and other material that explains it to users and stakeholders. Design the interface so inputs stay within certain topics or types, like the height bar at the queue, and add input and output validation, like the check at the ride exit, to cut the risk of harmful responses. And keep your documentation honest about what the system can and can't do, which models it runs on, and any harms your mitigations might not always catch, like the rules board posted at the entrance.
Facts from Microsoft's documentation: Overview of Responsible AI practices for Azure OpenAI in Foundry Models; Guardrails and controls overview in Microsoft Foundry; Prompt Shields in Azure AI Content Safety (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.