This page hasn’t yet been updated for Airflow 3. The concepts shown are relevant, but some code may need to be updated. If you run any examples, take care to update import statements and watch for any other breaking changes.

- Changing the data that is ingested for fine-tuning and inference.
- Modifying the Anyscale jobs and services to align with your requirements.
- Adjusting the data processing steps and model fine-tuning parameters.
This tutorial uses Anyscale with the Anyscale provider to run Ray jobs. If you want to run Ray jobs on other platforms, you can use the Ray provider instead. See also Orchestrate Ray jobs on Anyscale with Apache Airflow®.
Architecture

- Data ingestion: new user feedback about video games is collected from several APIs, preprocessed, and stored in an S3 bucket.
- Fine-tuning and deploying of Mistral-7B: once a threshold of 200 new feedback entries is reached, the data is used to fine-tune a pre-trained LLM model, Mistral-7B, on Anyscale using distributed compute. The fine-tuned model is deployed using Anyscale Services.
Airflow features
The DAGs in this reference architecture highlight several key Airflow features and best practices:- Branching: Using Airflow Branching, DAGs can execute different paths based on runtime conditions or results from previous tasks. This allows for dynamic workflow adjustments depending on the data or processing requirements. In this reference architecture branching is used to determine whether the fine-tuning process should be executed.
- Airflow retries: To protect against transient API failures and rate limits, all tasks are configured to automatically retry after an adjustable delay.
- Dynamic task mapping: Transforming data from multiple data sources is split into multiple parallelized tasks using dynamic task mapping. The number of parallelized tasks is determined at runtime based on the number of data sources that need to be processed.
- Data-aware scheduling: The DAGs run on a data-driven schedule to regularly and automatically update the LLM model when new data has been ingested. Aside from data-driven scheduling, Airflow offers options such as time-based scheduling or scheduling based on external events detected using sensors.
- Task groups: In the champion-challenger DAG, related tasks are organized into logical groups within the DAG with Airflow task groups. This improves the overall structure of complex workflows and makes them easier to understand and maintain.