Summary and Schedule
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.
| Setup Instructions | Download files required for the lesson | |
| Duration: 00h 00m | 1. The Big Picture |
What physical process are we trying to classify when we look at a pair
of jets from the CMS detector? Why is telling Hbb and Hcc jets apart harder than telling either of them apart from QCD background? Why does this problem call for machine learning instead of a hand-written rule? What does “mini” mean in MiniParT, and how does it relate to the full-scale Particle Transformer used in real CMS analyses? :::::: |
| Duration: 00h 20m | 2. Working in Google Colab |
Which packages does this lesson need installed in Colab, and how do you
install them? How do you read a CMS Open Data file directly from CERN without downloading it? Which three files does this lesson use, and how do you check a stream actually worked? :::::: |
| Duration: 00h 30m | 3. The Complete Code |
What does the finished MiniParT pipeline look like, before we build it
piece by piece? Where can you find the complete pipeline as one unbroken block of code, without the surrounding explanation? :::::: |
| Duration: 00h 40m | 4. What Is a Jet? |
What is a jet, and why does the CMS detector record jets instead of
individual quarks? What are the 10 numbers used to describe each jet, and what physical property does each one capture? Why does MiniParT use pre-computed summary numbers per jet instead of raw particle-level data? Why does this lesson deliberately avoid using DeepJet/DeepCSV tagger scores as features? Where does this jet data actually come from, and how do we read it in Python? :::::: |
| Duration: 01h 10m | 5. Finding the Truth Labels |
Why does training a model require already knowing the right answer for
each example? How do we identify which simulated particles came from the Higgs boson, using only ID numbers? How do we match a truth-level quark to an actual reconstructed jet, and why is that not automatic? Why does the QCD background sample not need any of this matching? How does all of this become the label (0, 1, or 2) attached to each training example? :::::: |
| Duration: 01h 45m | 6. Preparing the Data |
How do the three separate datasets (ttHTobb, ttHTocc, QCD) get combined
into one dataset the model can train on? Why do we hold back part of the data as a test set instead of training on everything? Why does every feature need to be put on the same numerical scale before training? Why is it important to fit the scaler only on training data, never on test data? Why does the model see data in small shuffled batches instead of all at once? :::::: |
| Duration: 02h 15m | 7. Building MiniParT |
What are the four main pieces that make up the MiniParT model, and what
does each one do? What is self-attention, and why does it matter that the two jets can “look at” each other? Why does the model use mean pooling to go from two jet descriptions down to one event summary? Why not simply concatenate the two jets’ features together instead of using a transformer? What does data actually look like, shape by shape, as it flows through the model from input to final prediction? :::::: |
| Duration: 03h 00m | 8. Training the Model |
What do the loss function and optimizer actually do during
training? What happens, step by step, inside the training loop for one batch of data? What is an epoch, and why do we repeat the training loop for several of them? Why is training accuracy not enough to trust on its own? :::::: |
| Duration: 03h 30m | 9. Evaluating the Model |
Why isn’t training accuracy enough to trust on its own? What does a confusion matrix show that a single accuracy number hides? What do ROC curves and AUC tell us about a classifier’s tradeoffs? What does the model’s internal “fingerprint” of an event let us check that its final answer alone doesn’t? :::::: |
| Duration: 04h 10m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
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.
