A comprehensive, hands-on learning resource for LLM/Gen AI security concepts. This lab book provides structured guidance through 17 hands-on exercises covering various security challenges and defensive techniques using the Chat Playground project.
Ready to dive in? Visit the Live Lab Book to start learning!
The Chat Playground Lab Book is designed to complement the Chat Playground - an interactive web application that demonstrates LLM security vulnerabilities and defense mechanisms. While you can explore the playground freely, this lab book provides a structured learning path for those who prefer guided exercises.
This lab book covers essential LLM security concepts through 17 comprehensive exercises:
- Basic chatbot security - Understanding how simple rule-based systems work
- Content filtering - Implementing guardrails to prevent inappropriate outputs
- Prompt injection attacks - Recognizing and defending against manipulation attempts
- Code generation exploits - Preventing unauthorized code execution
- AI-powered moderation - Comparing simple vs. sophisticated security approaches
- Custom security filters - Building your own detection systems
The lab book is organized into 5 progressive labs with 17 total exercises, each with multiple skill levels:
- First Steps - Get acquainted with the playground environment (3 exercises)
- Broken Bot - Explore what happens without proper guardrails (4 exercises)
- Defense in Depth - Master prompt injection defense (4 exercises)
- AI-Powered Security - Compare local vs. AI moderation (3 exercises)
- Advanced Customization - Create your own security filters (3 exercises)
Exercises are designed for different skill levels:
- Level 1: No special skills required - anyone can complete these
- Level 2: Some sysadmin or developer experience helpful
- Level 3: Requires moderate developer skills - more challenging exercises
- Visit the Lab Book: Go to the Live Lab Book to start your learning journey
- Try the Playground: Visit the Chat Playground to experiment with the interactive demos
- Choose Your Path: Pick exercises that match your skill level and interests
Most exercises can be completed for free. Some advanced exercises require:
- An OpenAI API key (costs only a few pennies worth of tokens)
- Basic development environment (for Level 3 exercises)
This is an open source project and we welcome contributions! Here are some ways you can help:
- Create new exercises for existing labs
- Suggest new lab topics
- Improve existing exercise descriptions
- Add more skill level variations
- Propose entirely new lab concepts
- Focus on emerging LLM security challenges
- Create labs for specific use cases or industries
- Fix typos or unclear instructions
- Add better explanations or context
- Improve the formatting and navigation
- Translate to other languages
- Fork this repository
- Create a feature branch for your changes
- Make your improvements
- Submit a pull request with a clear description
- Chat Playground - The main interactive application
- Live Demo - Try the playground online
- Test Suite - Automated security testing
This project is licensed under the MIT License - see the LICENSE file for details.
This lab book was created to support hands-on learning of LLM security concepts. Special thanks to the open source community for their contributions and feedback.
Ready to start learning? Visit the Live Lab Book to begin your LLM security journey!