Want to access all premium content?

Become a paying subscriber to get access to all courses, guides like this, prompts and skills library, and $500+ worth of AI tools.

Google Colab lets you use a free NVIDIA T4 GPU through your browser. You can run open AI models too large for your laptop, summarize articles in batches or compare models before paying for anything. All it takes is a Google account, with no card or local installation.

We'll enable the GPU, install Ollama and run Google's Gemma 4, then try three batch tasks. Free GPU access depends on availability, and Google doesn't publish fixed usage limits.

Step 1: Open a notebook. Sign in and create a blank notebook.

Step 2: Turn on the GPU. Select the free T4 runtime and connect.

Step 3: Install Ollama. Run four cells to install it and download Gemma 4.

Step 4: Run your first model. Check the GPU and ask a question.

Step 5: Manage your session. Save your results and disconnect when finished.

Step 1: Open a notebook

Go to colab.research.google.com and sign in with your Google account. The welcome page shows example notebooks and your recent files.

Click New notebook. Colab creates a notebook with one empty code cell and saves it to Google Drive.

Click Untitled0.ipynb at the top left to rename it.

Step 2: Turn on the GPU

Open Runtime, then Change runtime type. Under Hardware accelerator, select T4 GPU and click Save. The other GPUs listed are for paid plans.

Click Connect at the top right. Once connected, you'll see a green check and small RAM and Disk bars. Click the bars to open Resources.

Look for 15.0 GB of GPU RAM. If Connect spins for more than a minute, reload the page and run your first cell, which also starts the connection.

Step 3: Install Ollama

Ollama downloads open models and runs them on the GPU. Paste each block into a separate cell, then run it with Shift + Enter. Work through them in order.

First, install the helpers Ollama needs:

!apt-get -qq install -y zstd pciutils lshw > /dev/null

Then install Ollama:

!curl -fsSL https://ollama.com/install.sh | sh

Installation took 24 seconds in our test. You can ignore the red “systemd is not running” warning here because the next cell starts Ollama manually.

Start Ollama in the background:

import subprocess
subprocess.Popen(["ollama", "serve"], stdout=open("ollama.log", "w"), stderr=subprocess.STDOUT, start_new_session=True)

Download the 12B version of Gemma 4 and list the installed models:

!ollama pull gemma4:12b && ollama list

Colab hides the progress bar, so the cell may appear blank for a minute or two. Once it finishes, you should see gemma4:12b listed at 8.0 GB.

If it says “could not connect to ollama server”, rerun the third cell and wait ten seconds.

Step 4: Run your first model

Check that the notebook can see the GPU:

!nvidia-smi

Look for a Tesla T4 row. If the command fails, return to Step 2 and check that T4 GPU is selected.

Then ask Gemma 4 a question:

!ollama run gemma4:12b --think=false --nowordwrap "Explain what a GPU does in 3 short sentences, for someone who has never coded. Put each sentence on its own line." < /dev/null

The --think=false flag skips the model's extended thinking stage, which can take minutes on a T4, and the < /dev/null ending closes input so Ollama doesn't keep waiting for more text.

Expect the first answer to take half a minute while the model loads. Later answers may arrive in a few seconds.

Check where the model is running:

!ollama ps

The PROCESSOR column should show 100% GPU. If it shows CPU use, check the runtime type and available GPU memory.

Step 5: Manage your session

Colab disconnects idle sessions, and free usage limits vary. Once you're done, open Runtime, select Disconnect and delete runtime, then confirm with Yes.

This releases the GPU. It also clears Ollama, downloaded models and uploaded files. Your notebook and its cells remain in Google Drive.

Next time, reconnect and run the setup cells from top to bottom.

If Colab won't assign a GPU, wait a few hours and try again. Other services offer free GPU access too:

Platform

Free offer

What to check

Kaggle

About 30 GPU hours a week on two T4s

Requires phone verification, and some numbers lead to an ID check

Modal

$30 a month in Starter credits

Check whether a card is required for the full $30

Lightning AI

Starter credits for GPU Studios

The free tier changed twice this autumn, so check current pricing

Hugging Face ZeroGPU

5 GPU minutes a day on a free account

Supports Gradio apps on Spaces, rather than your own notebook

The Ollama cells also run on Kaggle, making it a backup once your phone is verified.

Use cases

Try these in the same session after Gemma 4 answers your first question.

To upload files, click the folder icon in the left sidebar, then the upload button in Files. Uploads disappear when the runtime ends, so keep the originals.

Use case #1: Summarize articles in a batch

Upload your .txt files and check that they arrived:

!ls /content/*.txt

Then run:

import subprocess, glob
for path in sorted(glob.glob("/content/*.txt")):
    text = open(path).read()
    prompt = "Summarize this article in 3 bullet points. Keep names and numbers exact.\n\n" + text
    out = subprocess.run(["ollama", "run", "gemma4:12b", "--think=false", "--nowordwrap", prompt], capture_output=True, text=True, stdin=subprocess.DEVNULL).stdout
    print("## " + path.split("/")[-1])
    print(out)

Five short articles took 14 seconds in our test. Compare two summaries with the originals, paying particular attention to names and numbers.

Use case #2: Compare three models

Give three models the same task and compare their answers. Each downloads before running, so allow about three minutes.

import subprocess
task = "Write a 2-sentence product description for a reusable water bottle aimed at students. Put each sentence on its own line."
for model in ["gemma4:12b", "qwen2.5:7b", "llama3.1:8b"]:
    subprocess.run(["ollama", "pull", model], capture_output=True, stdin=subprocess.DEVNULL)
    out = subprocess.run(["ollama", "run", model, "--think=false", "--nowordwrap", task], capture_output=True, text=True, stdin=subprocess.DEVNULL).stdout
    print("## " + model)
    print(out)

Check whether each answer follows the prompt. In our run, Qwen ignored the one-line-per-sentence rule. Llama invented a product name and bottle size.

Use case #3: Write captions in bulk

Upload topics.csv with a column called topic and one topic per row. This cell generates a caption for each and saves them to captions.csv:

import subprocess, csv
rows = list(csv.DictReader(open("/content/topics.csv")))
for row in rows:
    prompt = "Write one Instagram caption under 25 words about: " + row["topic"] + ". No hashtags."
    row["caption"] = subprocess.run(["ollama", "run", "gemma4:12b", "--think=false", "--nowordwrap", prompt], capture_output=True, text=True, stdin=subprocess.DEVNULL).stdout.strip()
with open("captions.csv", "w", newline="") as f:
    writer = csv.DictWriter(f, fieldnames=list(rows[0].keys()))
    writer.writeheader()
    writer.writerows(rows)
print(open("captions.csv").read())

Eight captions took 51 seconds. Download captions.csv through Files before closing the runtime, and read every caption before posting.

You can also translate product pages, sort support emails by topic or try a smaller model such as gemma4:e4b if the T4 feels slow.

Limitations

Google doesn't publish fixed free-tier limits. GPU availability, session length and idle timeouts vary with demand. A T4 may not be available when you need one.

Open models can invent details. Check names, numbers and claims against your sources before using the results.

Files are processed on Google's servers. Ending the runtime deletes uploaded files and models, so keep copies elsewhere and leave out passwords and client data.

The free T4 has 15GB of GPU memory, which limits model size. Models much larger than Gemma 4 12B may not fit, and each new session requires downloading the model again.

The original guide was checked on December 3, 2026. GPU access, model names and the free offers above may change.

Closing

Run the four setup cells and ask the question in Step 4. Check that ollama ps shows 100% GPU.

Then try summarizing a few articles or notes. Download the results you need and disconnect the runtime when finished.

See you in the next one :)