🚀 Building Deterministic AI Workflows: Fine-Tuning Qwen 2.5
I’m excited to share my project for the Hugging Face hashtag#build-small-hackathon! My goal was to explore how we can make agentic task planning more predictable and repeatable.
One of the biggest challenges in agentic workflows is consistency. For this hackathon, I focused on fine-tuning a Qwen 2.5 (0.5B) model to see if it could produce the exact same set of predicted tasks every time it’s asked the same question.
Key Project Highlights:
Custom Dataset: Built a unique dataset from scratch with 1,000 training rows and 200 test rows.
Fine-Tuning: Leveraged Azure Machine Learning and LoRA configuration to train the model efficiently using the SFTTrainer.
Deployment: Pushed the final model to the Hugging Face Hub and created a Gradio-based web application to test the planner in real-time.
The results are promising! Both local testing and the Hugging Face Space show the model providing consistent, deterministic outputs for task planning.
Here is the youtube video:
https://www.youtube.com/watch?v=Xfw3L1O0E6Q&feature=youtu.be
Check out the project here: 📺 Full Technical Walkthrough: Fine-Tuning Qwen 2.5 for Agentic AI Task Planning 🌐 Live Demo on Hugging Face Spaces:
https://huggingface.co/spaces/build-small-hackathon/agentflow
It was a fantastic experience learning and contributing to the build-small-hackathon.
hashtag#AI hashtag#MachineLearning hashtag#LLM hashtag#FineTuning hashtag#AgenticAI hashtag#HuggingFace hashtag#Qwen2 hashtag#BuildSmallHackathon hashtag#AzureML
This model is a fine-tuned version of
Qwen/Qwen2.5-3B-Instruct.
It has been trained using
TRL.
1from transformers import pipeline
2
3question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
4generator = pipeline("text-generation", model="Balab2021/qwen-workflow-planner-qwen2p5-lora", device="cuda")
5output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
6print(output["generated_text"])
This model was trained with SFT.
1@software{vonwerra2020trl,
2 title = {{TRL: Transformers Reinforcement Learning}},
3 author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
4 license = {Apache-2.0},
5 url = {https://github.com/huggingface/trl},
6 year = {2020}
7}