
One Prompt, One Free GPU: Tell Your Agent to Fine-Tune a Model With the Google Colab CLI
Chris Harper
2 min read
Aug 13, 2026 · 04:07 UTC
The Google Colab CLI makes Colab GPUs scriptable from any terminal — hand an agent a dataset prompt and get a fine-tuned adapter pushed to the Hub, free.
Google's Colab CLI (pip install colab) removes the notebook UI from the equation. Any process that can run shell commands — Claude Code, a LangChain agent, a Python script — can provision a free T4 GPU, run training code on it, stream live metrics, and push results, all without a browser.
HuggingFace published the proof of concept: an agent was given one instruction and handled every step.
What the agent did, step by step:
colab start— provisioned a free T4 runtime- Installed TRL, trackio, and bitsandbytes on the remote Colab session
- Authenticated with HuggingFace Hub inside the runtime
- Read TRL's SFTTrainer examples, then wrote a QLoRA training script from them
- Ran training; wired
trackioto stream the loss curve to a HuggingFace Space in real time push_to_hub=True— LoRA adapter uploaded when training finishedcolab stop— runtime cleaned up
Total cost: $0. Base model: Qwen2.5-0.5B-Instruct; the whole run finished in a few minutes on a free T4.
Try it from a Claude Code session:
pip install colab
colab login # authenticates with your Google account
Then give Claude Code this prompt:
Fine-tune Qwen2.5-0.5B-Instruct on ./data/train.jsonl using TRL SFTTrainer
with QLoRA (r=16, alpha=32). Run on a Colab T4 via the Colab CLI, stream
metrics with trackio, push the adapter to <your-hf-username>/<repo-name>.
Claude Code reads the TRL docs, writes the script, provisions and runs the runtime, and reports back when the adapter is live on the Hub.
Why this pattern matters: agentic ML doesn't require you to own GPUs. The Colab CLI makes free compute programmable — combine it with an agent that knows the training APIs and you get a zero-infrastructure fine-tuning workflow that any developer can run today.
Sources: I fine-tuned a model for free from one prompt, with TRL and the Google Colab CLI — HuggingFace Blog · TRL SFTTrainer docs — HuggingFace