Summary and Setup
This lesson builds, from scratch, a small transformer model that classifies pairs of jets from CMS Open Data as coming from a Higgs boson decaying to two bottom quarks (Hbb), a Higgs boson decaying to two charm quarks (Hcc), or ordinary QCD background with no Higgs boson involved. This model, MiniParT, is a scaled-down version of the Particle Transformer architecture used in real CMS physics analyses: small enough to train in minutes on a free Google Colab session, but built using the same ideas as the full-size version.
This lesson grew out of the Notre Dame CMS Open Data Workshop and follows the same format as the CMS Open Data Workshop lessons. It runs entirely in Google Colab. You do not need to install Python locally or download any data files: the Working in Google Colab episode covers everything you need, including streaming the CMS data files directly from CERN’s servers.
By the end of this lesson, you will have read real CMS Open Data files, built the truth labels needed to train a classifier, built and trained a small transformer model, and evaluated whether it actually learned to tell Hbb, Hcc, and QCD jet pairs apart, including where it succeeds and where the underlying physics makes the problem genuinely hard.
Prerequisites
- Basic Python: variables, functions, loops, and reading simple code.
- Some familiarity with the general idea of machine learning (for example, that a model is trained on examples and then makes predictions on new data). No prior experience with neural networks or transformers is assumed; those concepts are introduced from scratch in this lesson.
- A Google account, used to open and run notebooks in Google Colab.
- No prior particle physics background is required. The physics concepts needed (jets, quarks, the Higgs boson, and how CMS records collisions) are introduced in the first two episodes.
Setup
Before starting this lesson, see Setup for how to open a Colab notebook and install the packages this lesson needs. There is nothing to download or install on your own computer.
This lesson runs entirely in Google Colab. There is nothing to install on your own computer, and no dataset to download before you begin. All CMS Open Data files this lesson uses are streamed directly from CERN’s servers while your Colab notebook is running.
What you need
- A Google account, to open and run notebooks in Google Colab.
- A web browser.
- Nothing else. No local Python installation, no virtual environment, and no downloaded data files are required.
Opening a Colab notebook
Go to colab.research.google.com and sign in with your Google account, then choose “New notebook.” Everything in this lesson can be typed or pasted into cells in that notebook, in the order the episodes present it.
Installing the packages this lesson needs
Colab already has several common data science packages installed,
including numpy, pandas,
matplotlib, seaborn,
scikit-learn, and torch. It does not have
uproot, fsspec-xrootd, awkward,
or vector, which this lesson uses to read CMS data files.
Run this in the first cell of your Colab notebook, before anything else
in this lesson:
PYTHON
!pip install uproot fsspec-xrootd awkward vector numpy torch scikit-learn matplotlib seaborn pandas
Full details on why these specific packages are needed, and how the rest of this lesson reads CMS data without downloading it, are covered in Working in Google Colab, the second episode of this lesson. Start there once your notebook is open and the install command above has finished running.
No data download required
This lesson uses three CMS Open Data files (described in full in Working in Google Colab). None
of them need to be downloaded. Instead, this lesson reads them directly
from CERN’s eospublic.cern.ch server using
uproot, over a network protocol called xrootd, which
streams only the parts of a file that are actually needed rather than
requiring the whole file to sit on disk. This keeps the lesson well
within Colab’s storage limits and means the exact same code works
whether you are running this lesson today or next year, without
maintaining a local copy of any dataset.
If you would rather work locally instead of in Colab, everything in
this lesson still works in a local Jupyter notebook or plain Python
script. Replace the !pip install ... command above with the
same command without the leading !, run in a terminal, and
the same streaming file paths from Working in Google Colab will
work identically outside of Colab.
