Inspiration

Fine-tuning has become the dominant workflow in modern deep learning. Instead of training models from scratch, developers adapt existing models to new tasks such as image classification, segmentation, or specialized language tasks.

However, fine-tuning is still difficult to approach for many people.

A large number of researchers, students, and domain experts want to use machine learning on their own data but are not experienced ML engineers. They often struggle with:

  • understanding how a training script should be structured
  • configuring models correctly
  • avoiding inefficient training setups

As a result, experiments are often slow, unstable, and waste a lot of GPU compute.

At the same time, inefficient pipelines translate directly into higher energy usage and CO₂ emissions.

We wanted to build a tool that helps people learn how to fine-tune models correctly, while also learning good sustainability practices by default.


What it does

LeafTune is an interactive assistant that helps users write better fine-tuning pipelines.

A developer, student, or researcher can paste a Python training script and the system will:

  • analyze the code
  • compare it against a checklist of good practices
  • explain what is correct or missing
  • suggest improvements
  • apply fixes automatically
  • generate a cluster job script ready to run

The tool acts like a green copilot for fine-tuning.

It helps beginners understand how a training pipeline should look, while also encouraging efficient use of compute resources.

The prototype focuses on common fine-tuning scenarios:

  • vision classification using pretrained CNNs
  • simple segmentation tasks
  • transformer-based text classification

These use cases cover a large portion of real-world fine-tuning workflows.


How we built it

The system combines a web interface, a knowledge base of machine learning best practices, and a retrieval-augmented AI assistant.

The architecture has three main components.

Frontend

An interactive interface where users can paste code, see a checklist of recommendations, and chat with the assistant.

Backend

A Python analysis pipeline that:

  • extracts signals from the code
  • checks for common training issues
  • retrieves relevant guidance from a knowledge base.

AI assistant

A lightweight coding model that receives the retrieved context and explains issues, suggests improvements, and helps guide the user.

To keep the experience responsive, we implemented a two-stage analysis system:

  1. A fast local analysis that runs immediately while the user edits the code.
  2. A deeper retrieval + model analysis triggered when the code stabilizes.

This hybrid approach allows the system to remain fast while still providing useful explanations.


Challenges we ran into

One of the biggest challenges was balancing speed and reasoning quality.

Large language models provide better explanations but introduce latency, which hurts the user experience. We addressed this by combining deterministic checks with a smaller coding model.

Another challenge was designing meaningful rules for “green” training. We focused on optimizations that are both:

  • common in real training pipelines
  • impactful in terms of compute usage.

We also had to ensure the system behaved reliably across environments and avoid issues related to dependencies and file encoding.


Accomplishments that we're proud of

In a short time we built a working prototype that includes:

  • an interactive user interface
  • automatic code analysis
  • a knowledge-based checklist
  • a retrieval-augmented assistant
  • automatic generation of cluster job scripts

Most importantly, the project demonstrates how sustainability can be integrated directly into the machine learning development workflow.

Instead of asking developers to think about energy later, the tool introduces these practices while they learn how to fine-tune models.


What we learned

During this project we learned that many inefficiencies in machine learning pipelines come from small configuration issues rather than hardware limitations.

We also found that combining deterministic checks with language models leads to more reliable developer tools.

Another key insight was that sustainability tools must integrate naturally into the workflow of developers and researchers. If the tool helps them learn and build faster, they are more likely to adopt greener practices.


What's next for SUSTAI (Table 37)

There are several directions we would like to explore next.

First, expanding the knowledge base to support more machine learning frameworks and training patterns.

Second, improving the estimation of energy usage and CO₂ emissions by integrating real cluster telemetry.

Another important direction is carbon-aware scheduling, allowing training jobs to run when electricity is cleaner.

In the long term, we envision a system that continuously helps ML practitioners write efficient pipelines and make better decisions about compute usage.

The goal is to make sustainable machine learning the default, not an afterthought.

Built With

  • chart.js
  • click
  • crusoe-api
  • electricitymaps-api-(carbon-data)
  • html
  • jinja
  • json-config-datasets
  • node.js
  • nvidia-nvml-/-intel-rapl-/-apple-powermetrics-(energy-telemetry)
  • optional-crusoe-api
  • python
  • slurm-(sbatch-generation)
  • typescript
  • yahoofinance
Share this project:

Updates