At a glance
- Free runtimes last at most 12 hours, "depending on availability and your usage patterns".
- Google does not publish the idle timeout or GPU quotas, because "they can vary over time".
- Pro+ background execution keeps a running cell alive up to 24 hours; idle time still deletes the VM.
- When the VM is deleted, its disk goes with it, so checkpoints belong on Google Drive.
The limits Google actually publishes
If your Colab runtime just died mid-training, you hit one of two walls: the session cap or the idle cutoff. Google's documentation is upfront about the general rules, even if it's light on exact numbers. As the Colab FAQ puts it, "Colab prioritizes interactive compute. Runtimes will time out if you are idle."
On the free tier, notebooks "can run for at most 12 hours, depending on availability and your usage patterns." That 12-hour figure is a ceiling, not a promise.
Free runtimes are built for interactive use: they time out when you stop interacting, and Google deletes idle VMs after a while. Google also bars free runtimes from SSH shells, remote desktops and distributed computing workers.
Paid plans get "increased compute availability based on your compute unit balance". Colab Pro ($9.99 a month for 100 compute units) adds "extended execution times and saving of output to Drive based on availability", and Colab Pro+ ($49.99 a month for 600 units) adds background execution. If your units run out on a paid plan, Google says to "expect to experience backend termination", and you drop back to free-tier limits.
What Google does not publish
Search for Colab disconnect rules and you'll find posts quoting exact idle minutes or daily GPU quotas. None of those numbers come from Google.
The FAQ says plainly that "Colab does not publish these limits, in part because they can vary over time." Free GPU access is "heavily restricted" and the GPU types "vary over time". What worked for someone last month isn't a rule you can plan a training run around, because the caps move with demand and with how much you've used the service.
Google's one concrete tip: close Colab tabs when you're done, and avoid GPUs or extra memory when your work doesn't need them. That makes it "less likely that you will run into usage limits".
Colab limits by plan, next to Kaggle
If you're deciding between paying for compute units and moving your notebook to Kaggle, here is how the tiers line up on paper.
| Limit | Colab free | Colab Pro | Colab Pro+ | Kaggle free |
|---|---|---|---|---|
| Price (US, as of October 2026) | $0 | $9.99 a month, 100 units | $49.99 a month, 600 units | $0 |
| Longest run | Up to 12 hours | Longer, "based on availability" | Up to 24 hours of background execution | 12 hours, 9 on TPU |
| Idle timeout | Not published | Not published | Not published, applies once code stops | 20 minutes while editing |
| Keeps running with the tab closed | No | No | Yes, while a cell runs and units last | Yes, with Save & Run All |
| GPU | Very limited, types vary | Faster GPUs, by availability | Priority access to premium GPUs | 1 P100 or 2 T4, 30 hours a week |
Kaggle's weekly GPU quota is 30 hours "or sometimes higher depending on demand and resources". You also get 20 GB of saved output in /kaggle/working, and "Save & Run All" runs the whole notebook in a new session, as long as it finishes within 12 hours. Kaggle's notebook docs give the idle limit while editing as 20 minutes, but its GPU tips page mentions 60, so don't plan around either.
Survive a disconnect: checkpoint to Google Drive and resume
When Colab deletes your VM, its local disk goes with it. Everything you wrote to /content is gone, so a disconnect at hour 11 wipes out the whole run unless your checkpoints live somewhere else.
The fix is to mount Google Drive, save a checkpoint there every N steps, and have the training loop look for that checkpoint before it starts from scratch. Writing to a temporary file first and renaming it means a disconnect in the middle of a save can't leave you with a broken checkpoint.
import os
import torch
from google.colab import drive
from tqdm import tqdm
drive.mount("/content/drive")
CKPT = "/content/drive/MyDrive/checkpoints/run1.pt"
os.makedirs(os.path.dirname(CKPT), exist_ok=True)
start_step = 0
if os.path.exists(CKPT):
state = torch.load(CKPT, map_location="cpu")
model.load_state_dict(state["model"])
optimizer.load_state_dict(state["optimizer"])
start_step = state["step"] + 1
for step in tqdm(range(start_step, total_steps), initial=start_step, total=total_steps):
train_step()
if step % 500 == 0:
state = {"model": model.state_dict(), "optimizer": optimizer.state_dict(), "step": step}
torch.save(state, CKPT + ".tmp")
os.replace(CKPT + ".tmp", CKPT)After a disconnect, reconnect, run the cells again and the bar picks up where the last checkpoint left off. Save often enough that losing one interval doesn't hurt, but not so often that writing to Drive slows training.
What Pro+ background execution changes, and what it doesn't
Colab Pro+ lets you close the browser and keep training for up to 24 hours, as long as you have a positive compute unit balance. Your output is saved to Drive after each cell finishes.
What it doesn't give you is a machine that waits around while nothing runs. Google is explicit that "Idle timeouts only apply if code execution terminates." Once your training cell finishes, or a cell errors out, the idle clock starts and the VM is deleted. Even on Pro+, "Colab resources are not guaranteed and not unlimited, and usage limits sometimes fluctuate."
Get a ping when the runtime dies
Checkpoints save your weights, but you still lose hours if a run dies at midnight and you only notice the next morning. A try/except block or a message at the bottom of the notebook can't help: when Colab deletes the VM, your Python process dies with it, and in a notebook an ordinary exception doesn't end the process either. The only thing that catches a dead runtime is an outside alert that fires when progress stops.
Use the drop-in tqdm from tqdm_live in notebooks, because the notebook widget bar is not streamed; it takes the same initial and total arguments. Keep the stall window at 30 minutes or less, and a little longer than your slowest checkpoint save.
FAQ
How long can a Google Colab session run?
On the free tier, at most 12 hours, and often less depending on availability and your usage. Colab Pro+ keeps a running notebook going for up to 24 hours in the background while you have compute units. On any paid plan, running out of units can end the runtime early.
What is the Colab idle timeout?
Google does not publish it. The FAQ only says runtimes time out when you are idle and that Colab doesn't publish its limits because they vary over time. Minute counts you find online are other people's observations, not official numbers.
Does Colab keep running if I close the browser?
On the free tier, no. Google says execution is interrupted when user interaction stops and the VM is deleted soon after. Colab Pro+ keeps an actively running notebook alive for up to 24 hours with the browser closed, as long as you have compute units.
Why can't I get a GPU on Colab?
Free GPU access is heavily restricted and depends on demand and on how much you've used Colab recently. Google suggests closing tabs when you're done and not requesting a GPU when you don't need one. Paid plans and compute units raise your access, though resources are never guaranteed.
How do I resume training after Colab disconnects?
Save a checkpoint with the model, optimizer and step number to Google Drive every few hundred steps. After reconnecting, mount Drive again, load the checkpoint if it exists and continue the loop from the saved step, passing initial to tqdm so the bar starts in the right place.
Check on long runs from your phone
Change one import and every tqdm bar prints a link you can open on any device. Get a Discord or Slack message when the run finishes, fails or stalls.
pip install tqdm-liveSources
- Google Colab FAQ research.google.com
- Colab plans and pricing (signup page) colab.research.google.com
- Colab: external data, mounting Google Drive colab.research.google.com
- PyTorch: saving and loading a general checkpoint docs.pytorch.org
- Kaggle Notebooks documentation kaggle.com
- Kaggle: efficient GPU usage tips kaggle.com