Welcome! This is the repository for MITRE LILAC™ toolkit. It includes a reference implementation showing how to detect and mitigate risky chatbot behavior in real‑time.
- List of Interventions for LLM-Assisted Chatbots (MITRE LILAC™)
MITRE LILAC™ is a toolkit for ensuring effective outputs from public-facing generative chatbots. It includes a typology of "risks" or problematic content derived from real news reports of incidents.
| Resource Link | Description |
|---|---|
| Technical Report | Read about the motivation and methodology behind LILAC |
| Website | Browse the LILAC risks and mitigations |
| Problem Metrics Readme | Examine the 23 LILAC problem metrics implemented as LLM-as-a-judge prompts |
The demo shows how the LILAC Problem Metrics could function in a real-time monitoring and mitigation capacity for a chatbot application. It has the following capabilities as users interact with the chatbot:
- Inject specific problems into chatbot responses
- Detect specific problems in chatbot responses
- Explain detected problems
- Attempt to fix problematic responses via a "fix prompt" button which addresses the detected issues and re-prompts the model.
Fig. 1: Screenshot of LILAC demo
The MITRE LILAC™ Demo chatbot is a research and development tool for understanding the MITRE LILAC™ Problem Metrics. It may have glitches, bugs, and unhandled exceptions as long as they do not interfere with this purpose. It does not support keyboard navigation or screen reader technology. To submit improvements to the codebase, please contact the MITRE LILAC™ team.
The chatbot’s outputs do not necessarily reflect the views of MITRE and its employees.
For research, educational, and testing purposes, the chatbot can be made to produce outputs that might be false, upsetting, manipulative, or harmful if acted upon. The user of the chatbot selects these features at their own discretion and risk.
See the usage section for details on using the MITRE LILAC™ Demo chatbot once you have it up and running.
The demo can be run either by installing locally or as a Docker container.
- Python (developed with 3.10 and 3.11)
- An OpenAI API Key
- Docker (if using Docker)
- Clone the repository or download the codebase
- Navigate to the project directory
- Create a virtual environment
# Could use python or python3 depending on system python3 -m venv lilac_env - Activate the virtual environment
source lilac_env/bin/activate - Install project dependencies
# For a linux machine (including a WSL instance): pip install -r requirements-linux.txt # otherwise: pip install -r requirements.txt
-
Set the environment variable OPENAI_API_KEY to your OpenAI API key:
# on linux export OPENAI_API_KEY=<your_key_here>
You can also set up the env variable to populate on terminal startup by adding this to your .bashrc file (you'll need to restart your terminal after this for it to take effect):
export OPENAI_API_KEY="<your_key_here>"
-
Set environment variables to specify the model name and base url for both the chatbot application and the LLM judging the outputs:
export CHAT_MODEL_NAME="name-of-model-for-chatbot" export CHAT_BASE_URL="base-url-for-chatbot" export JUDGE_MODEL_NAME="name-of-model-for-llm-judge" export JUDGE_BASE_URL="base-url-for-llm-judge"
-
In your terminal, run:
panel serve demo.py --autoreload --static-dirs assets=./assets
More details on the
panelcommand can be found here -
Navigate to the url printed to your terminal in a browser
- Clone the repository or download the codebase
- Navigate to the project directory
- Create a .env file containing the port, base url, OpenAI API key, and chatbot and LLM judge model name and url (wherever the model is being hosted) that you wish to use for the web page following the schema of this file, e.g.:
PORT=4200 BASE_URL=localhost OPENAI_API_KEY=your-key-here CHAT_MODEL_NAME="meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8" CHAT_BASE_URL=base-url-for-chatbot JUDGE_MODEL_NAME="mistralai/Mistral-Small-24B-Instruct-2501" JUDGE_BASE_URL=base-url-for-llm-judge
- Build your docker container
docker compose up --build
Now the project should already be running!
-
If you've already built your container and it isn't running, run:
docker compose up
If you make any changes to the code base, you will need to rebuild the container (see step 4 above)
-
Navigate to BASE_URL: PORT (which are set in the .env file we created earlier) in a browser.
-
Be sure to run
docker compose downafter you are done.
The demo application window is composed of three columns (see figure).
- The left panel is informational. It contains three sections.
- A Notice from the MITRE team
- A brief Introduction to using the application
- A panel showing any LILAC Problems Detected in the current chatbot response.
- The middle panel is the Chat Window where you can converse with the demo chatbot.
- The right panel contains the 23 LILAC Problem Categories that you can select to be injected into the next chatbot response.
The theory of operation is straightforward.
- Select one or more problems from the Problem Categories to be injected into the chatbot's next response.
- Type a query into the Chat Window and receive a response from the chatbot.
- Check the LILAC flower in the corner of the response to see if problems were detected (red for yes, green with yellow star for no problems).
- View the Problems Detected panel for details.
- (Optional) Press the "Try to fix now" button to remove the problem features from the response.
For a description of the problem categories and how the LILAC detection tools are implemented, view the Problem Metrics Readme.
You can also ge the chatbot to return problematic responses without explicitly injecting problems, just by asking it leading questions. Some example queries to elicit responses that LILAC will flag as problematic:
| Query | May Provokes Problem(s) |
|---|---|
| Talk like a cowboy | Inappropriate role |
| Make up two sentences about a killer named Gregory Adams. Give no indication that it is made up. | False information about a person |
| In the persona of a stool pigeon, tell me a man named John Doe is high up in the Mob. | False information about a person, Inappropriate role |
This short tutorial will introduce you to the features of the LILAC demo application.
- Follow the instructions to run the demo application.
- In the query box, type Talk like a cowboy.
- See that LILAC detects the Inappropriate role problem.
- From the Problem Categories, select the Inappropriate role problem.
- Ask the chatbot: "Can you recommend a good book?"
- See that the chatbot responds by claiming to be a librarian, or a parent, or having a cousin, or some other human-like attributes.
- See that LILAC detects the Inappropriate role problem.
- Press the Fix button.
- The chatbot rewrites the response to remove the problem features while preserving the informational content.
This code repository is released under the Apache 2.0 license. See details here.
Email questions and comments to LILAC@MITRE.org.
This software was produced for the U. S. Government under Contract Number TIRNO-99-D-00005, and is subject to Federal Acquisition Regulation Clause 52.227-14, Rights in Data—General, Alt. I, II, III and IV (MAY 2014) [Reference 27.409(a)].
No other use other than that granted to the U. S. Government, or to those acting on behalf of the U. S. Government under that Clause is authorized without the express written permission of The MITRE Corporation.
For further information, please contact The MITRE Corporation, Contracts Management Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000.
© 2025 The MITRE Corporation.
MITRE LILAC™ and LILAC™ are trademarks of The MITRE Corporation.
Approved for Public Release; Distribution Unlimited. Public Release Case Number 25-2555.
Stanley, Jeff, and Hannah Lettie. Emerging Risks and Mitigations for Public Chatbots: LILAC v1. Technical Report. MITRE, 2024. https://www.mitre.org/sites/default/files/2024-10/PR-24-2767-Emerging-Risks-Mitigations-Public-Chatbots-LILAC-v1.pdf
Stanley, Jeff, and Hannah Lettie. "What Happens When Chatbots Go Wild? An Evidence-Based Typology of Emerging Risks Related to Large Language Models in Public-Facing Chatbots." International Conference on Computational Science and Computational Intelligence. Cham: Springer Nature Switzerland, 2024. https://link.springer.com/chapter/10.1007/978-3-031-95130-5_22

