Alignment on Airline Policies
Alignment on Airline Policies
Despite its size and capabilities, a generalist foundational model may have incomplete or out-of-date knowledge of policies, regulations, or rules of specific airlines. In this tutorial, we will use SeekrFlow to create a helpful assistant with up-to-date knowledge of baggage policies from American Airlines, based on Llama-3-8B-Instruct
. We will use one or more of the following documents to automatically create our fine-tuning data:
- Baggage and optional fees
- Bags
- Restricted Items
- Baggage Delivery Service
- Lost and Found
- Special Assistance
Automatic synthetic data creation
Let's first define our base prompt:
base_prompt = "Your task is to read and understand the American Airlines policies and provide answers to inquiries about these policies."
Next, let's upload a JSON tree structure file which is a graph representation of our source data (see here for an example JSON file):
import os
from seekrai import SeekrFlow
client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
# Upload the alignment JSON graph tree (generated from a source file, e.g. a markdown file)
file = client.files.upload("out.json", purpose="alignment")
(Note the documentation section What is Principle Alignment?
details how one can convert a source markdown file into a JSON tree file that is ready to be consumed by alignment.)
We are now ready to supply the American Airlines baggage regulations (now an uploaded file) along with our base prompt to SeekrFlow principle alignment, which generates instruction fine-tuning (IFT) pairs of question and answers (our data):
client.alignment.generate(instructions=base_prompt, files=[file.id])
See the documentation section What is Principle Alignment?
, specifically sub-section Structuring with domain principles
, for more information on how to retrieve the status of the alignment job that generates the IFT pair data file. Once the job completes, we can obtain the name of the .parquet
data file to use for fine-tuning or download it to edit locally and re-upload it.
See the section Fine-tuning
for instructions on how to use the generated data file (or re-uploaded file) for fine-tuning.
After a sufficient number of IFT pairs have been generated and a model has been successfully fine-tuned, we can explore the model's behavior in the SeekrFlow Sandbox.
Updated 4 months ago