colab-finetuning
Fine-tune LLMs on Google Colab GPUs directly from openscience. Connects to Colab runtimes via WebSocket bridge for remote training with Unsloth. Supports SFT, GRPO, DPO, vision, and TTS workflows on free T4 to Pro A100 GPUs.
- License 许可
- MIT
- 最近更新
- 2026-10-28
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- colab-finetuning
- tags
- [ "Fine-Tuning", "Google Colab", "GPU", "Remote Training", "Unsloth", "LoRA", "GRPO", "Cloud GPU" ]
- author
- Synthetic Sciences
- license
- MIT
- version
- 1.0.0
- category
- ml-training
- description
- Fine-tune LLMs on Google Colab GPUs directly from openscience. Connects to Colab runtimes via WebSocket bridge for remote training with Unsloth. Supports SFT, GRPO, DPO, vision, and TTS workflows on free T4 to Pro A100 GPUs.
- dependencies
- [ "unsloth", "torch", "transformers", "trl", "datasets" ]
02 资源文件 3
- 参考文档references/bridge-setup.md2.1 KB
- 参考文档references/gpu-tiers.md1.6 KB
- 参考文档references/troubleshooting.md2.9 KB
03 SKILL.md 正文
Google Colab Fine-Tuning
Fine-tune LLMs using Google Colab GPUs directly from the openscience CLI. Connect to free or paid Colab runtimes and run Unsloth training workflows remotely.
When to Use Colab Fine-Tuning
Use Colab when:
- You don't have a local GPU but need to fine-tune a model
- You want free GPU access (T4 with 15GB VRAM on Colab Free)
- Training models up to ~14B parameters (4-bit QLoRA)
- Quick experiments and prototyping before scaling to cloud
- Colab Pro/Pro+ for A100 (40-80GB) access
Don't use Colab when:
- You need persistent long-running jobs (>12h) — use Tinker or cloud providers
- Training 70B+ models — use Lambda, RunPod, or multi-GPU cloud
- You need guaranteed uptime — Colab may disconnect idle sessions
- Production training pipelines — use managed services
Colab vs Alternatives:
| Need | Use |
|---|---|
| Free GPU, quick experiments | Google Colab |
| Managed cloud training (any size) | Tinker |
| Persistent multi-GPU training | Lambda / RunPod |
| Local GPU available | Unsloth directly |
| Enterprise with SLA | Colab Enterprise (Vertex AI) |
Quick Start
Step 1: Generate Bridge Notebook
Use colab_notebook tool with workflow="bridge"
This creates a openscience-bridge.ipynb file that establishes a WebSocket tunnel between openscience and the Colab GPU.
Step 2: Open in Colab
- Go to colab.research.google.com
- Upload the bridge notebook (File → Upload notebook)
- Select GPU runtime (Runtime → Change runtime type → T4 GPU)
- Run all cells
- Copy the WebSocket URL that appears
Step 3: Connect from openscience
Use colab_connect tool with connection_url="wss://..."
Step 4: Run Training
Use colab_finetune tool with:
workflow: "sft"
model: "unsloth/Qwen3-4B-unsloth-bnb-4bit"
dataset: "mlabonne/FineTome-100k"
Or execute individual cells:
Use colab_execute tool with code="import torch; print(torch.cuda.get_device_name(0))"
GPU Tiers
| Tier | GPU | VRAM | Max Model (QLoRA) | Session Limit |
|---|---|---|---|---|
| Free | T4 | 15 GB | ~14B | 12h, may disconnect |
| Pro ($10/mo) | T4/V100/A100 | 16-40 GB | ~32B | 24h, priority |
| Pro+ ($50/mo) | A100 (80GB) | 80 GB | ~72B | 24h, guaranteed |
| Enterprise | Configurable | Any | Any | No limit |
See references/gpu-tiers.md for detailed VRAM requirements.
Available Tools
| Tool | Purpose |
|---|---|
colab_connect |
Connect to a Colab runtime (standard bridge or enterprise) |
colab_execute |
Run arbitrary Python code on the connected GPU |
colab_status |
Check GPU, memory, disk, connection status |
colab_finetune |
Run complete Unsloth training workflow (SFT/GRPO/DPO/vision/TTS) |
colab_notebook |
Generate .ipynb notebooks for Colab |
Training Workflows
SFT (Supervised Fine-Tuning)
Standard instruction tuning. Best for: chat models, domain adaptation, format learning.
colab_finetune workflow=sft model="unsloth/Qwen3-4B-unsloth-bnb-4bit" dataset="mlabonne/FineTome-100k"
GRPO (Reinforcement Learning)
Train reasoning models with reward functions. Best for: math, coding, structured output.
colab_finetune workflow=grpo model="unsloth/Qwen3-4B-unsloth-bnb-4bit" dataset="your-dataset"
DPO (Direct Preference Optimization)
Align models with human preferences. Requires chosen/rejected pairs.
colab_finetune workflow=dpo model="unsloth/Llama-3.1-8B-unsloth-bnb-4bit" dataset="HuggingFaceH4/ultrafeedback_binarized"
Vision Fine-Tuning
Fine-tune vision-language models (Qwen3-VL, Gemma 3, Llama 3.2 Vision).
colab_finetune workflow=vision model="unsloth/Qwen3-VL-2B-unsloth-bnb-4bit" dataset="your-vision-dataset"
TTS Fine-Tuning
Fine-tune text-to-speech models (Orpheus, Sesame-CSM).
colab_finetune workflow=tts model="unsloth/orpheus-3b-0.1-ft-unsloth-bnb-4bit" dataset="your-tts-dataset"
Troubleshooting
Connection Issues
- "WebSocket connection failed": Ensure the bridge notebook is still running in Colab. Re-run the tunnel cell if the URL expired.
- "Execution timeout": Colab may have disconnected due to inactivity. Run the keep-alive cell.
- "Connection closed during execution": Colab Free disconnects after idle time. Upgrade to Pro for more stability.
Training Issues
- CUDA OOM: Reduce batch_size, max_seq_length, or lora_rank. Use 4-bit quantization.
- Slow training: Ensure GPU runtime is selected. Check with
colab_status detail=gpu. - Package not found: Unsloth is installed automatically by
colab_finetune. For custom packages, usecolab_executewith pip install.
Colab Enterprise
- Requires GCP project with Vertex AI API enabled
- Use
colab_connect mode=enterprise project_id="your-project" - GPU quotas apply — check GCP console for availability
See references/troubleshooting.md for more solutions.
04 同仓库更多 Skills
statistical-power
Sample size calculation, power analysis, and effect size conversion for scientific studies. Use BEFORE data collection (a priori) to determine required N, or after (post-hoc) to compute achieved power. Covers parametric tests (t-test, ANOVA, chi-square, proportions, correlation, regression), simulation-based power for complex/clustered/nested designs, and power curves. Use this skill when someone asks 'how many samples do I need', 'what is my power', 'what effect size can I detect', or any variant. Pairs with /experimental-design (choose design first, then compute power) and /statistical-analysis (analyze data after collection).
statistical-analysis
Guided statistical analysis with test selection and reporting. Use when you need help choosing appropriate tests for your data, assumption checking, power analysis, and APA-formatted results. Best for academic research reporting, test selection guidance. For implementing specific models programmatically use statsmodels.
scientific-writing
Core skill for the deep research and writing tool. Write scientific manuscripts in full paragraphs (never bullet points). Use two-stage process with (1) section outlines with key points using research-lookup then (2) convert to flowing prose. IMRAD structure, citations (APA/AMA/Vancouver), figures/tables, reporting guidelines (CONSORT/STROBE/PRISMA), for research papers and journal submissions.
scientific-visualization
Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.
research-code
Debug, profile, review, and restructure Python research and analysis code. Use when analysis scripts crash, produce wrong results, run too slowly, or need a correctness review. Covers: reading tracebacks and diagnosing root causes, hypothesis-driven debugging, reviewing code for common statistical/numerical errors, profiling data pipelines, improving reproducibility (seeds, environments, determinism), and structuring analysis scripts for sharing. Distinct from /exploratory-data-analysis (which understands data) and /statistical-analysis (which chooses and runs tests) — this skill focuses on the code itself.
markdown-mermaid-writing
Comprehensive markdown and Mermaid diagram writing skill. Use when creating any scientific document, report, analysis, or visualization. Establishes text-based diagrams as the default documentation standard with full style guides (markdown + mermaid), 24 diagram type references, and 9 document templates.