LLGA · Course notes

Optimization and Responsible AI for Sustainability

CSC_51076_EP (formerly CSC_52073_EP) · Year 1 · Period 1

Contents

Introduction and overview

Module Optimization and Responsible AI for Sustainability
Code CSC_51076_EP (2026–2027 catalogue); formerly CSC_52073_EP (2025–2026)
Team and volume 2026–2027 catalogue (CSC_51076_EP): Sonia Vanier (listed by École Polytechnique, LIX: ORAILIX) and Hossein Nick Zinat Matin (listed on a Télécom Paris listing) · 2025–2026 sheet (CSC_52073_EP): coordinator-instructors H. Nick Zinat Matin and S. Vanier, occurrence coordinator S. Vanier · 36 h (programme value; the SynapseS sheets display no teaching hours) · 4.5 ECTS (program data; the 2025–2026 sheet indicates 4.5 ECTS for the Trust & Responsible AI track and 5 ECTS for the engineering curriculum) · optimizing under several objectives and resource constraints — from the Pareto front to carbon-aware scheduling, from mixed integer linear programming to honest measurement of emissions, with constant vigilance against greenwashing.
Period 2026–2027: Period 1, code CSC_51076_EP — lecture on Wednesday 08:30–10:30, then tutorial 10:45–12:45. Former occurrence: CSC_52073_EP, Fall semester — period 2 (X-3A-P2), from 06/01/2026 to 19/03/2026 · X3A ME1 slot; that code is no longer in the 2026–2027 LLGA 1 – S2 list.
Language Not communicated on the official sheet.
Assessment (2025-2026 sheet) Numerical grade out of 20 (literal conversion / American grade); resit allowed (max of the two grades); course unit earned if final grade ≥ 10. Detailed modalities: not communicated.
Status in the program Notes kept for reference Not in the LLGA 2026–2027 lists: formerly a Period 2 option (CSC_52073_EP, 2025–2026), the course moved to Period 1 as CSC_51076_EP and is listed neither in LLGA 1 – S1 nor in LLGA 1 – S2; it is still taught at the École, and these notes are kept for reference.

Audience: an engineer who ships models and must trade off performance, cost and carbon without greenwashing. Empirical first: every chapter starts from a situation that goes wrong in practice — a “green model” whose training is left off the balance sheet, a Pareto front ignored in favour of one magic KPI — and only then names the tool that repairs it: multi-objective optimization, linear and integer programming, carbon-aware scheduling, measurement protocols.

The module is the responsible-AI compass of the program: decisions backed by numbers, not by slogans.

What you will be able to do

Official objectives and syllabus

The course changed code and period. In the 2026–2027 catalogue, “Optimisation and Responsible AI” carries the code CSC_51076_EP (Programme d’approfondissement, Computer Science) and is taught in Period 1, with a weekly lecture on Wednesday 08:30–10:30 followed by a tutorial 10:45–12:45; Sonia Vanier is listed by École Polytechnique and Hossein Nick Zinat Matin on a Télécom Paris listing. The former code CSC_52073_EP (Period 2, 2025–2026) is no longer in the 2026–2027 LLGA 1 – S2 list, and the new code is not in the LLGA lists either: these notes are kept for reference.

The last sheet published under the former code (SynapseS 2025–2026) is minimal: no description, no learning objectives, no detailed syllabus, no prerequisites and no language are communicated there. The table below therefore reports the available official fields — most of them “not communicated”; the content of this module (Pareto front, resource constraints, frugality, ILP, greenwashing) extends the official title without matching any published official syllabus.

Official field Value (last published sheet, 2025-2026)
Official title Optimisation and Responsible AI
Type Programme d’approfondissement · Field: Computer Science · degrees concerned (2025-2026): Ingénieur degree, Exchange programs, MScT Trust & Responsible AI
Official learning objectives Not communicated.
Official detailed syllabus Not communicated.
Official prerequisites Not communicated.
Language Not communicated.
Teaching hours Not displayed on the sheet; program value: 36 h · 4.5 ECTS (TRAI track; 5 ECTS engineering curriculum)
Assessment Numerical grade out of 20, resit allowed (max of the two grades), course unit earned if final grade ≥ 10; detailed modalities not communicated

Where this course fits in the program

Notes kept for reference: formerly taught in Period 2 (CSC_52073_EP), the course moves to Period 1 in 2026–2027 (CSC_51076_EP) and is not in the LLGA lists; the last official sheet (2025–2026) lists no prerequisites. Chapter 0 rests on same-period material: Machine Learning, ch. 0 (convexity; 0.4 Lagrangian duality and KKT) and ch. 3 (the SVM dual), and Refresher in Computer Science, ch. 7 (NP-hardness). The distillation lab assumes the PyTorch training of CNNs and MLPs from Deep Learning (P1, ch. 3–4), and the scaling laws of ch. 1 are those of Emerging ML, ch. 7.

Related, later period: Optimization for AI (P2) turns the convexity and duality of chapter 0 into algorithms; Deep Learning (P2 variant) makes compute budgets a primary quantity; and ML Ops and LLM Engineering Principles (M2, ch. 10) places frugality and green ops at the heart of ML system deployment.

Course outline

Session plan

36 h in class (announced) = 9 sessions of 4 h. The 36 h are the programme value quoted for this course (the SynapseS sheets display no teaching hours), and they correspond to nine of the weekly 4 h slots of the 2026–2027 timetable (lecture on Wednesday 08:30–10:30, then tutorial 10:45–12:45); no session-by-session programme is published, so the split below is our proposal for covering these notes in that time. Level 1 = foundations (reviews, definitions, first worked examples), 2 = core methods, 3 = advanced or open questions; the level never goes down from one session to the next.

Session Hours Level Content Practice
1 4 h 1 ch. 0 Refresher: LP, duality, shadow prices; ch. 1 Dominance, Pareto front, weighted scalarization Ex. 1
2 4 h 2 ch. 1 Hollow fronts, ε-constraints, Chebyshev, the accuracy–energy front Ex. 4
3 4 h 2 ch. 2 Carbon intensity, temporal shifting, the price of a budget Ex. 5
4 4 h 2 ch. 3 Distillation, quantization, pruning Ex. 2, 6
5 4 h 2 ch. 4 ILP modelling, relaxation, shadow prices Ex. 8 (a)
6 4 h 2 ch. 4 Branch and bound, solvers; ch. 5 Data center powered by renewables Ex. 3, Ex. 8 (b–d)
7 4 h 2 ch. 5 Coordinated charging of an electric vehicle fleet lab: the EV LP and its duals
8 4 h 2 ch. 6 Measurement boundary, PUE, embodied emissions, uncertainty, break-even Ex. 7
9 4 h 3 ch. 7 Accounting pitfalls, rebound effect, audit grid Ex. 9, 10

Self-study, outside the 36 h (about 2 h in total): ch. 8 Course research notes — ORAILIX (Vanier, Matin) (≈ 2 h).

How to study this module

Independent note The master’s program trains for a powerful and measured AI: here, the M2 LLMs — whose training and inference are costly — meet the questions of budget and impact, while optimization methods serve as the common language. The module’s skills are sought in the emerging careers of responsible AI and green ops, and sustainable operations research is an open field for research and industry alike.

0. Refresher: optimization, duality, complexity

L3 reminders — the foundation (see Machine Learning module, ch. 0 and 3; related, later period: Optimization for AI module, ch. 0; Optimal Transport module, ch. 0)

  • Linear program (LP): \min_x c^\top x subject to Ax \leq b, x \geq 0 — the feasible set is a polyhedron; the optimum (if it exists) is attained at a vertex (extreme point); solved in polynomial time (interior points, simplex in practice).
  • Duality: the dual of an LP is an LP; d^\star \leq p^\star always (weak duality), equality under conditions (Slater); the dual variables \lambda \geq 0 are interpreted as marginal prices — how much an extra unit of each resource is worth. This “economic” reading will be our central tool: the price of carbon, the price of a MWh, the price of a GPU hour. Proofs and the KKT conditions: Machine Learning, 0.4, and the SVM dual of its ch. 3.
  • Integer variables (ILP): as soon as one variable is integral (choose / do not choose), the problem becomes NP-hard in general (see Refresher CS module, ch. 7); it is handled by continuous relaxation + branch and bound (ch. 4).
  • Partial derivatives, convexity: convexity distinguishes “easy” (a local minimum is global) from “hard” — see Machine Learning, ch. 0; related, later period: the Optimization for AI module, ch. 0 (Refresher: convexity and duality).

Proposition 0.1 — The lemma that serves the whole module (proved) Consider the LP \min\{c^\top x : Ax = b,\ x \geq 0\} and its dual \max\{b^\top \lambda : A^\top \lambda \leq c\}. Call a vector \lambda dual feasible if A^\top\lambda \leq c, and write \mu = c - A^\top\lambda \geq 0 for its reduced costs. Then b^\top \lambda \leq c^\top x for every feasible x and every dual feasible \lambda. If equality is attained, both solutions are optimal.

Proof. Using dual feasibility together with x \geq 0 first, then Ax = b: c^\top x \geq (A^\top\lambda)^\top x = \lambda^\top A x = \lambda^\top b .

If c^\top x = b^\top\lambda, then x attains a dual lower bound: x and \lambda are optimal. The gap c^\top x - b^\top\lambda, zero, decomposes as \mu^\top x, whence the complementary slackness \mu_i x_i = 0. ∎

Position of the module — the “decision” point of view The other modules of the master’s program optimize models (loss, generalization). Here we optimize decisions: when to launch which training run, on which data center, with what numerical precision, which performance/energy trade-off to accept. Three new ingredients: several incommensurable objectives (ch. 1), constrained physical resources (ch. 2), and the requirement to measure what we claim to optimize (ch. 6–7) — for a mis-counted kg CO2 optimizes a fable, not the climate.

1. Multi-objective optimization and the Pareto front

A loss such as “error + λ · energy” looks like a sensible way to obtain a frugal model, but the single number it returns hides the trade-off that a decision maker needs to see. This chapter replaces the single score by the Pareto front: the set of solutions that cannot be improved on one objective without being worsened on another.

What breaks Three habits break the analysis: summing objectives that have no common unit, leaving part of the footprint (the discarded training runs, the hardware manufacturing) outside the accounting boundary, and selling a single KPI as a proof of sustainability.

“Maximize accuracy”, “minimize energy”, “minimize latency”: three objectives with no common unit. Adding them naively — a “magic loss” — hides the trade-offs; the Pareto formalism makes them explicit and negotiable.

Definition 1.1 — Dominance and Pareto optimality Let there be q objectives F = (F_1, \dots, F_q), all to be minimized over a feasible set \mathcal{X}. A solution x dominates x' if F_i(x) \leq F_i(x') \text{ for all } i \quad \text{and} \quad F_j(x) < F_j(x') \text{ for at least one } j. A solution is Pareto-optimal if no solution dominates it; the image of the set of these solutions is the Pareto front \mathcal{P} = F(\mathcal{X}_{\mathrm{Par}}) \subset \mathbb{R}^q. In the plane, it is the “southwest frontier” of the set of attainable values.

Theorem 1.2 — Weighted scalarization produces Pareto points (proved) Let w \in \mathbb{R}^q_+, w \neq 0, and x_w a minimizer of the scalar function F_w(x) = \sum_i w_i F_i(x) over \mathcal{X}. Then:

  • (a) if w \geq 0 (positive or zero weights): x_w is weakly Pareto-optimal — no x' \in \mathcal{X} is strictly better on every objective;
  • (b) if w > 0 (all weights strictly positive): x_w is Pareto-optimal.

Proof.

  1. Suppose x_w is dominated by some x' \in \mathcal{X}: F_i(x') \leq F_i(x_w) for all i, with a strict inequality for one index j. Summing against w: F_w(x') = \sum_i w_i F_i(x') \leq \sum_i w_i F_i(x_w) = F_w(x_w), and since w_j > 0 the inequality is strict: F_w(x') < F_w(x_w) contradicts the minimality of x_w.

  2. Suppose some x' satisfies F_i(x') < F_i(x_w) for every index. Since w \neq 0, some weight w_k is positive; that term of the sum decreases strictly and no term increases, because w \geq 0. Hence F_w(x') < F_w(x_w), again a contradiction. With a zero weight on some objective, a solution that is better on that objective only, and equal on the others, leaves F_w unchanged: only weak optimality survives. ∎

Proposition 1.3 — The converse is false: Pareto points that no weighting finds (worked example) Objectives F_1(x) = x and F_2(x) = 1 - x^2 over x \in [0, 1].

Proof. F_1 is strictly increasing, F_2 strictly decreasing: every point of [0,1] is Pareto-optimal, and the front is the arc \{(t,\, 1-t^2) : t \in [0,1]\}. It is a concave arc (it sags above the chord (0,1)–(1,0): in the middle, (0.5\,;\,0.75) against (0.5\,;\,0.5) for the chord), typical of “hollowed” fronts.

Yet, for every weighting w > 0, the function F_w(x) = w_1 x + w_2(1 - x^2) is concave in x (second derivative -2w_2 < 0): its minimum over [0,1] is attained at the endpoints, never inside.

Weighted scalarizations thus produce only the two endpoints x=0 and x=1: the whole middle of the front — for example x = 0.5 — is Pareto-optimal but invisible to any weighting. Geometry: a weighting traces a line of negative slope in the (F_1,F_2) plane and picks the lowest point; on a hollowed front, the line can rest only at the endpoints.

In practice: training networks (non-convex landscapes, often hollowed fronts) and then sweeping only the weights visits only part of the trade-off — other tools are needed (\varepsilon-constraints, Chebyshev method — def. 1.4; multi-objective evolutionary algorithms such as NSGA-II). ∎

Definition 1.4 — Two scalarizations that see the whole front

  • \varepsilon-constraints: minimize F_1(x) subject to F_i(x) \leq \varepsilon_i (i \geq 2). By sweeping the \varepsilon, one visits the whole front — including the non-convex part. It is also the most dialogue-friendly formulation: “I impose at most k kWh on myself, what is the best accuracy?”
  • Chebyshev: \min_x \max_i\, w_i\,(F_i(x) - z_i^\star), where z^\star is the ideal point (the minimum of each objective separately). Every Pareto-optimal solution minimizes such a function for some w > 0 (under a standard assumption); the resulting w reads as an exchange rate.

Example 1.5 — The ε-constraint method recovers the hollow part of the front Return to prop. 1.3: F_1(x) = x, F_2(x) = 1 - x^2 on [0,1].

The \varepsilon-constraint problem reads: minimize x subject to 1 - x^2 \leq \varepsilon, that is x \geq \sqrt{1-\varepsilon}, for \varepsilon \in [0, 1]. Its solution is x_\varepsilon = \sqrt{1-\varepsilon}, and as \varepsilon sweeps [0,1] the point x_\varepsilon sweeps the whole interval: every point of the front is reached, including x = 0.5, obtained for \varepsilon = 0.75. The weighted sums of theorem 1.2 found only the two endpoints.

The price to pay is that each value of \varepsilon is a constrained problem, usually harder to solve than an unconstrained weighted sum; the reward is that the parameter \varepsilon is a budget expressed in the units of the objective (“at most 0.75”), which a decision maker can discuss, whereas a weight has no unit.

Common mistakes when drawing a front

  1. Comparing points that were not measured under the same conditions — another test set, another hardware, another batch size — produces a front of artefacts.
  2. Reporting one run per configuration: if the seed-to-seed spread of accuracy is 0.5 point, two points closer than that are not ordered, and a “dominated” model may simply be unlucky.
  3. Reading a front as a recommendation: the front lists the rational options; choosing among them requires a value judgement (a carbon price, a latency requirement) that must be stated explicitly.

Example 1.6 — Accuracy vs training energy: the module’s most cited front On a given task (say image classification), for every energy budget E (kWh measured at the wall, ch. 6), the best attainable accuracy \mathrm{acc}(E) defines a point of the front. Typically: rapid growth (the under-trained model gains a lot for little energy), then an elbow, then a plateau (scaling law — see Emerging ML, ch. 7; related, later period: the Deep Learning P2 module, ch. 1).

Typical Pareto-rational decisions: stop at the elbow, where -d\,\mathrm{acc}/dE drops; the points beyond the elbow are dominated in the “carbon-cost” sense as soon as the kWh is valued at its carbon price (ch. 2).

import numpy as np
import matplotlib.pyplot as plt

# example: two models (growing size), fictitious but realistic measurement
E = np.array([0.4, 1.1, 2.6, 5.0, 9.5, 18.0])      # kWh (measured at the wall)
A = np.array([71.2, 78.9, 84.1, 87.0, 88.3, 89.0]) # accuracy % on a validation set

# Pareto front (minimize E, maximize A): keep the non-dominated points
keep = [True]*len(E)
for i in range(len(E)):
    for j in range(len(E)):
        if E[j] <= E[i] and A[j] >= A[i] and (E[j], A[j]) != (E[i], A[i]):
            keep[i] = False
print("front points:", list(zip(E[keep], A[keep])))
# marginal gain of acc per kWh -- the "elbow" of the front
print("d.acc/dE:", np.diff(A)/np.diff(E))
plt.loglog(E, 100 - A, "o-"); plt.xlabel("E (kWh)"); plt.ylabel("error (%)")
plt.show()

2. Optimizing under resource constraints

This chapter puts resource limits inside the optimization problem instead of checking them afterwards. The resources are GPU hours, watts, megabytes of memory and — the module’s signature angle — carbon, which depends on when and where one computes. The electric grid is not uniformly green: its carbon intensity varies by a factor of up to 10 depending on the hour and the region, which leaves a large margin of manoeuvre to a scheduler.

Definition 2.1 — Carbon intensity and emissions of a computation The carbon intensity c_t (gCO2eq/kWh) is the amount of CO2 emitted per kWh consumed on the grid, at hour t, in region r — public hourly data (grid operators, providers such as Electricity Maps). For a power P_t (kW) consumed during hour t:

Key result — emissions of a computation \text{emissions (gCO}_2\text{eq)} \;=\; \sum_t c_t \cdot P_t \cdot \Delta t .

This is to be multiplied by the PUE (ch. 6) if one counts the whole data center. Unlike the kWh, this criterion is non-uniform in time: this is precisely what makes scheduling profitable.

Theorem 2.2 — Temporal shifting gains (at most) the dispersion of c_t (proved) Let there be a deferrable job of duration T hours (at constant power P), executable within a window [0, H]. Let \bar c be the mean and c_{(1)} \leq \dots \leq c_{(H)} the sorted intensities of the window’s hours.

Then the minimal emission is attained by executing the job during the T cleanest hours, and equals P\,\Delta t \sum_{s=1}^{T/\Delta t} c_{(s)}. In particular the maximal relative gain compared to an average immediate launch is \frac{\bar c - \text{mean of the } T \text{ smallest}}{\bar c} \leq \frac{\max c - \min c}{\max c}.

Proof. The decision variable 0 \leq x_t \leq 1 (fraction of the job done at hour t) gives the LP \min \sum_t c_t x_t \quad \text{subject to} \quad \sum_t x_t = T/\Delta t, a continuous “knapsack”. The optimal solution saturates the x_t of the smallest c_t (monotone permutation).

Exchange argument: if x_t < 1, x_{t'} > 0 with c_{t'} > c_t, transferring an amount \delta > 0 from t' to t reduces the cost by \delta\,(c_{t'} - c_t) > 0. The gain bound follows by comparing with \bar c, itself between c_{(1)} and c_{(H)}. ∎

What the theorem does not say: the real constraints A training run is not a “knapsack”: it has a minimal duration, checkpoints that are costly to move, a deadline (a paper submission!), sometimes dependencies (pipeline parallelism, ch. 2 of the Deep Learning P2 module, a later-period course).

The true formulation is an ILP:

  • variables x_{j,t} \in \{0,1\} “task j runs at hour t”;
  • \sum_t x_{j,t} = d_j (duration);
  • precedence constraints s_j + d_j \leq s_k, windows;
  • machine capacity \sum_j P_j x_{j,t} \leq C;
  • objective \min \sum_{j,t} c_t P_j x_{j,t}.

This is exactly the ground of ch. 4 (branch and bound) — and the heart of the “carbon-aware computing” paper by Radovanovic et al. (Google), deployed in production to shift deferrable tasks toward the cleanest windows and regions (references); the Emerging ML module (ch. 2–3) covers the systems side (federation, placement).

Example 2.3 — One training run, 43 possible start times A 6-hour training run (1 GPU, 0.4 kW, PUE 1.1) can start at any time within the next 48 hours. Hourly intensities (fictitious data but of realistic shape: solar in the middle of the day, wind at night, gas at the evening peak):

import numpy as np
c = np.array([ 85, 72, 60, 55, 58,110,220,310,380,340,260,160,
              95, 70, 55, 45, 38, 42,120,280,420,470,390,240])  # gCO2/kWh, 0h..23h
c = np.concatenate([c, c])            # two identical days (simplification)
T, P, pue = 6, 0.4, 1.1

best = min(range(48 - T + 1), key=lambda s: c[s:s+T].sum())
worst = max(range(48 - T + 1), key=lambda s: c[s:s+T].sum())
emi = lambda s: P*pue*c[s:s+T].sum() / 1000               # kg CO2eq
print(f"best slot {best}h-{best+T}h: {emi(best):.2f} kg")
print(f"worst slot {worst}h-{worst+T}h: {emi(worst):.2f} kg")
print(f"relative gain: {1 - emi(best)/emi(worst):.0%}")
# expected: best 12h-18h, about 0.15 kg; worst 18h-24h, about 0.84 kg;
# a gain of about 82% (a factor 5.6) between the solar afternoon and the evening peak

Dual interpretation: if the scheduler minimizes the electricity bill \sum_t p_t x_t plus a carbon price \pi (€/gCO2eq) times the emissions \sum_t c_t x_t, hours are ranked by p_t + \pi c_t. At \pi = 0 the schedule follows the cheapest hours; as \pi grows it moves towards the cleanest ones, and the LP (ch. 4) tells exactly at which carbon price each hour enters or leaves the schedule. This is a shadow price: ch. 0 kept its promise.

Proposition 2.4 — A budget constraint has a price: the sensitivity of the optimum (proved for a smooth one-dimensional case) Let \mathrm{err}(E) be the best error attainable with an energy E, assumed decreasing, convex and differentiable, and consider the budgeted problem p^\star(B) = \min\{\mathrm{err}(E) : E \leq B\}. Then p^\star(B) = \mathrm{err}(B), the Lagrange multiplier of the budget constraint is \lambda^\star = -\mathrm{err}'(B) \geq 0, and \lambda^\star = -\frac{d p^\star}{dB} : the multiplier is the error saved by the last kWh of budget.

Proof. Since \mathrm{err} is decreasing, the constraint is active and p^\star(B) = \mathrm{err}(B). The Lagrangian L(E, \lambda) = \mathrm{err}(E) + \lambda (E - B) is stationary in E at E = B when \mathrm{err}'(B) + \lambda = 0, i.e. \lambda^\star = -\mathrm{err}'(B), which is non-negative because \mathrm{err} decreases; convexity makes these KKT conditions sufficient.

Differentiating p^\star(B) = \mathrm{err}(B) gives \frac{dp^\star}{dB} = \mathrm{err}'(B) = -\lambda^\star . (The same identity holds for convex problems in any dimension, wherever p^\star is differentiable: Boyd and Vandenberghe, §5.6.) ∎

Example 2.5 — Where to stop: the multiplier read in numbers Suppose measurements fit \mathrm{err}(E) = 30\,E^{-1/2} % (with E in kWh), a typical power-law shape.

  • With a budget B = 4 kWh, the error is 15 % and \lambda^\star = 15\,B^{-3/2} = 1.875 point per kWh: one more kWh buys almost two points of error.
  • With B = 16 kWh, the error is 7.5 % but \lambda^\star = 15 \cdot 16^{-3/2} \approx 0.23 point per kWh: the same extra kWh now buys a quarter of a point.

If the organization has decided that one point of error is worth at most 0.5 kWh of extra consumption (an exchange rate of 2 points per kWh), the rational budget is where \lambda^\star = 2, i.e. B^{3/2} = 7.5: B \approx 3.8 \text{ kWh}. The multiplier turns the vague “elbow” of example 1.6 into a number that can be negotiated.

3. Model frugality: distillation, quantization, pruning

The cheapest kg CO2 is the one not emitted: reducing the model’s cost at equal quality is the first lever of sustainable AI. Three families, complementary, all “Pareto-active” (ch. 1).

Definition 3.1 — Distillation (Hinton, Vinyals, Dean, 2015) Train a small student, with logits z_s, to reproduce the soft outputs of a large teacher, with logits z_t: \mathcal{L}_{\mathrm{KD}} = (1-\lambda)\,\mathrm{CE}(y, z_s) + \lambda\, T^2\, \mathrm{KL}\big(\mathrm{softmax}(z_t/T)\,\|\,\mathrm{softmax}(z_s/T)\big), where T is the temperature and \lambda \in [0,1] the weight of the teacher’s term (here \lambda is not a dual variable). At high temperature, the teacher’s logits deliver similarities between classes (dark knowledge) — far more information per example than the one-hot label alone.

Reference: Hinton et al. 2015; for the LLM case (logit distillation), see Large Language Models, def. 4.4, and the Deep Learning P2 module, ch. 5 (both in a later period).

Example 3.2 — What the temperature reveals, in numbers A teacher outputs the logits z_t = (4, 2, 0) for an image of a cat, the classes being (cat, dog, car).

  • At T = 1 the softmax gives (0.867,\ 0.117,\ 0.016): almost a one-hot label, and the student learns little more than “cat”.
  • At T = 4 the logits become (1, 0.5, 0) and the softmax gives (0.506,\ 0.307,\ 0.186): the teacher now says clearly that this cat looks much more like a dog than like a car.

This ranking of the wrong classes is the “dark knowledge” that a hard label does not carry. The factor T^2 in the loss compensates for the fact that the gradient of the softened term with respect to the student’s logits scales like 1/T^2; without it, raising the temperature would silently reduce the weight of the teacher’s term.

Proposition 3.3 — Uniform quantization error (proved) Quantizing on b bits a value x \in [x_{\min}, x_{\max}] means storing the integer code q(x) = \mathrm{clip}\big(\mathrm{round}((x - x_{\min})/s),\, 0, 2^b-1\big), with step s = \frac{x_{\max}-x_{\min}}{2^b - 1} (written \Delta below), and reconstructing \hat x = x_{\min} + s\, q(x). Then, for every x \in [x_{\min}, x_{\max}]:

Key result — uniform quantization error |\hat x - x| \;\leq\; \frac{\Delta}{2}.

(Libraries usually store the offset as an integer zero point z = \mathrm{round}(-x_{\min}/s), so that \hat x = s\,(q - z) and the value 0 is represented exactly; this only affects the bound at the edges of the range.)

For a network of L layers with Lipschitz constants \mathrm{Lip}_1, \dots, \mathrm{Lip}_L and quantizations of steps \Delta_1, \dots, \Delta_L: \|\hat f(x) - f(x)\| \;\leq\; \sum_{\ell=1}^{L} \Big(\Delta_\ell/2\Big) \prod_{m > \ell} \mathrm{Lip}_m.

Proof. First inequality: nearest-neighbor rounding of a value inside a cell of width \Delta moves it by at most \Delta/2; clipping only moves values closer to the bounds.

Second: by induction on depth. Let \varepsilon_\ell be the perturbation at the output of layer \ell, and assume (standard assumption) that quantizing the weights of layer \ell shifts its output by at most \Delta_\ell/2.

Layer \ell+1, Lipschitz, propagates \varepsilon_\ell to \mathrm{Lip}_{\ell+1}\,\varepsilon_\ell, then its own quantization adds at most \Delta_{\ell+1}/2: \varepsilon_{\ell+1} \leq \mathrm{Lip}_{\ell+1}\,\varepsilon_\ell + \Delta_{\ell+1}/2. Unrolling from \varepsilon_1 = \Delta_1/2, each \Delta_\ell/2 is multiplied by the Lipschitz constants of the subsequent layers, giving the announced sum (partial products \prod_{m>\ell}\mathrm{Lip}_m). ∎

PTQ vs QAT, pruning: the trade-off map

Technique What it touches Typical gain (orders of magnitude) Cost
PTQ (post-training quantization) rounding of trained weights (int8/int4), calibration without retraining 4× memory and bandwidth; 2–4× CPU speed minutes of calibration; possible loss > 1 pt below 8 bits on small models
QAT (quantization-aware training) simulating rounding during training (fake quantization, STE) int8 nearly lossless; int4 on large models partial or full retraining
Unstructured pruning zeroing individual weights (magnitude) up to 90% zeros, no real gain without sparse hardware sparse storage; CSR
Structured pruning removing whole channels/heads/layers effective speedup (conv, attention) loss to compensate by distillation
Distillation new training of a small model 10–50× fewer parameters at similar quality on one targeted task; far less on broad benchmarks (sources below) a teacher to train (once)

Foundational references: Jacob et al. 2018 (int8 PTQ/QAT, deployed); Han et al. 2016 (Deep Compression: pruning + quantization + Huffman). Caution (ch. 7): the “up to 10×” of brochures must be measured — the protocol of ch. 6 is non-negotiable.

Sources of the distillation range, the one also used by Deep Learning (P2 variant), prop. 5.2:

  • On one targeted task, XtremeDistil compresses multilingual BERT up to 35× for named-entity recognition while keeping 95 % of its F1 score (Mukherjee and Awadallah, 2020).
  • Tang et al. (2019) distil BERT-large into a BiLSTM with 349 times fewer parameters. On SST-2 it matches ELMo, itself 98 times larger than the student (90.7 % against 90.4 % accuracy), but stays about 4 points below its teacher (94.9 %). The “about 100×” quoted from this paper is the ratio to ELMo, not to the teacher.
  • On a broad benchmark the ratio falls: DistilBERT keeps 97 % of BERT’s GLUE score with 40 % fewer parameters (Sanh et al., 2019).

Definition 3.4 — Magnitude pruning Given trained weights W and a target sparsity \rho \in (0,1), magnitude pruning sets to zero the fraction \rho of weights with the smallest absolute values |W_{ij}|, then usually fine-tunes the remaining ones. It is unstructured when individual weights are removed, structured when the score is computed per channel, head or layer (for instance the norm of a whole filter) and whole blocks are removed. Only the structured version shrinks the dense matrices that ordinary hardware multiplies, which is why it is the one that delivers measured speedups.

Example 3.5 — Why bits matter more than FLOPs at inference When a language model generates text one token at a time with a small batch, every token requires reading all the weights from memory once, and the arithmetic units mostly wait for the data: generation is memory-bound.

A 7-billion-parameter model stored in 16-bit floats occupies 14 GB; with a memory bandwidth of 1 TB/s, at most 1000/14 \approx 71 tokens per second can be produced for one sequence. In int8 the weights occupy 7 GB (at most about 143 tokens/s), in int4 3.5 GB (about 286 tokens/s).

Energy follows the same logic: in Horowitz’s classic measurements (45 nm technology), reading 32 bits from DRAM costs about 640 pJ, while a 32-bit floating-point multiplication costs about 3.7 pJ — moving data costs two orders of magnitude more than computing on it. Halving the number of bits per weight therefore roughly halves the dominant energy term of generation, provided the kernels read the compressed weights directly.

Common mistakes with frugality claims

  1. Evaluating the compressed model on the benchmark used to calibrate it, instead of on the deployment distribution.
  2. Counting zeros as savings: 90% unstructured sparsity gives no speedup on hardware that multiplies dense matrices.
  3. Reporting the energy of the student’s inference while forgetting the teacher’s training and the distillation run itself; the saving is real only once the number of queries served pays back these one-off costs (ch. 6 gives the break-even computation).
import numpy as np
rng = np.random.default_rng(0)

def quantize_uniform(x, bits=8):
    xmin, xmax = x.min(), x.max()
    s = (xmax - xmin) / (2**bits - 1)
    q = np.clip(np.round((x - xmin)/s), 0, 2**bits - 1).astype(np.int64)
    return q, q*s + xmin                       # codes + dequantize

W = rng.normal(size=(64, 128)) * 0.03          # a trained layer (fictitious)
for bits in (16, 8, 4, 2):
    _, Wq = quantize_uniform(W, bits)
    err = np.abs(Wq - W).max()
    print(f"{bits:2d} bits: max error {err:.2e} (step/2 = "
          f"{((W.max()-W.min())/(2**bits-1))/2:.2e})")
# the error exactly follows the step/2 of proposition 3.3; at 4 bits it becomes
# perceptible -> that is where QAT (simulated fine-tuning) takes over.

4. Sustainable decision support: linear and mixed integer programming

The core business of operations research: turning a complex decision into a mathematical model that a solver drives to the optimum — not “nearly”. This is the toolbox of the module’s instructor (ch. 8) and the language of the case studies (ch. 5).

Definition 4.1 — Standard form and modeling (recipe) General ILP: \min_{x}\; c^\top x \quad \text{subject to}\quad Ax \leq b,\; x_i \in \mathbb{Z} \;\;(i \in I),\; x \geq 0. Modeling recipe (to know by heart):

  1. index: what do we decide on? (task × hour, site × capacity);
  2. variables: continuous (flows, powers) or binary (yes/no decisions, activation);
  3. constraints: physical (capacity, conservation), business (deadline, regulatory);
  4. objective: cost, carbon, or both (bi-objective, ch. 1).

Three writing reflexes: “at least one of” = \sum x_j \geq 1; “if-then” = big-M; “fixed activation cost” = z \in \{0,1\}, x \leq M z.

Proposition 4.2 — Continuous relaxation: a bound and the integrality gap (proved on an example) The relaxation (which drops x_i \in \mathbb{Z}) is an LP whose feasible set contains every integer solution. For a minimization problem its optimum \rho^\star therefore satisfies \rho^\star \leq v^\star, where v^\star is the integer optimum (immediate proof by inclusion of sets); for a maximization problem, such as the knapsack below, the inequality is reversed: \rho^\star \geq v^\star. The gap |v^\star - \rho^\star| is the integrality gap.

Example (fractional vs integer knapsack, to be maximized): capacity 10, items (v_i, w_i) \in \{(10,7), (6,5), (5,4)\}:

Proof. Relaxation. By decreasing value/weight ratio: \frac{10}{7} > \frac{5}{4} > \frac{6}{5}. Take item 1 whole (7 units), leaving 3 units of capacity for item 3 (next ratio): \rho^\star = 10 + \frac{3}{4}\cdot 5 = 13.75.

ILP. The integer solutions: \{1\} (10, weight 7), \{2,3\} (11, weight 9), \{1\} + nothing else fits — v^\star = 11.

Integrality gap 13.75 - 11 = 2.75, i.e. 25%: branch and bound (def. 4.3) will have to close it while proving that no integer choice exceeds 11. ∎

Definition/Theorem 4.3 — Branch and bound: correctness (proved) Algorithm. (written for a minimization problem)

  1. Solve the relaxation of the current problem;
  2. if the solution is integral, it is a candidate (upper bound);
  3. otherwise choose a fractional variable x_i and create two subproblems x_i \leq \lfloor \bar x_i\rfloor, x_i \geq \lceil \bar x_i\rceil (branch);
  4. prune a subproblem if its relaxation is infeasible, already solved, or has bound \rho^\star \geq the current upper bound (bound).

Correctness.

Proof. Each branching partitions the set of integer solutions (the two children cover everything, without overlap); subproblems pruned “by bound” cannot contain an optimum: their relaxation lower-bounds all their integer solutions (prop. 4.2), so none improves the current upper bound; the other cases prune empty sets.

At termination, the tree has covered the whole space except regions proven non-optimal: the best integer candidate found is the global optimum. (Termination is guaranteed in a finite number of branchings, the variables being bounded by the constraints.) ∎

In practice: solvers, formulations, difficulty The quality of an ILP formulation is judged by the quality of its relaxation: two formulations exactly equivalent in integer solutions can differ by a factor of 1000 in solving time (this is the modeler’s whole art — see Wolsey, references). Open-source solvers: CBC, HiGHS; commercial: Gurobi, CPLEX. The module does not ask you to run them by hand: exercise 3 walks through a branch and bound on a 4-item knapsack, then has it checked by PuLP:

import pulp
# knapsack: maximize value under capacity, binary variables
v = {0: 6, 1: 5, 2: 5, 3: 1};  w = {0: 5, 1: 5, 2: 5, 3: 1};  C = 10
prob = pulp.LpProblem("knapsack", pulp.LpMaximize)
x = {i: pulp.LpVariable(f"x{i}", cat="Binary") for i in v}
prob += pulp.lpSum(v[i]*x[i] for i in v)
prob += pulp.lpSum(w[i]*x[i] for i in v) <= C
prob.solve(pulp.PULP_CBC_CMD(msg=0))
print([(i, x[i].value()) for i in v], "=", pulp.value(prob.objective))
# "sustainability" variant: two objectives (value, carbon) -> epsilon-constraint
# prob += carbon(x) <= budget; maximize value  (see exercise 8)

Example 4.4 — Reading shadow prices on a two-variable LP A lab runs two kinds of jobs:

  • a job of type 1 brings a value 3, uses 1 GPU hour and 2 kWh;
  • a job of type 2 brings 2, uses 1 GPU hour and 1 kWh.

This week, 4 GPU hours and 6 kWh are available. The LP is \max\ 3x_1 + 2x_2 \quad \text{subject to} \quad x_1 + x_2 \leq 4,\ \ 2x_1 + x_2 \leq 6,\ \ x \geq 0. The vertices of the feasible polygon are (0,0), (3,0), (2,2) and (0,4), with values 0, 9, 10, 8. The optimum is x^\star = (2,2), \quad \text{value } 10, and both constraints are active.

The dual is \min\ 4y_1 + 6y_2 \quad \text{subject to} \quad y_1 + 2y_2 \geq 3,\ \ y_1 + y_2 \geq 2,\ \ y \geq 0. Complementary slackness (both x_j^\star > 0) makes both dual constraints active, so y^\star = (1, 1), \quad \text{of value } 4 + 6 = 10, equal to the primal value as prop. 0.1 requires.

Interpretation: one more GPU hour is worth 1, one more kWh is worth 1.

Check on the energy side: with 7 kWh, the active constraints x_1 + x_2 = 4, 2x_1 + x_2 = 7 give x = (3, 1) and value 11, exactly one unit more. If someone proposes to buy an extra kWh of certified renewable energy at a price above 1 unit of value, the model says no — for this week’s portfolio of jobs.

5. Case studies: data centers and electric vehicles

This chapter applies the LP and ILP toolbox of ch. 4 to two deployments where carbon, cost and physical capacity are traded off for real. In both cases the model fits on one page, and the dual variables carry the economic message.

Case study 5.1 — Data center powered by renewable energies Data. A compute site: flexible load (deferrable jobs: training runs, indexing, simulations) and rigid load (interactive services). Local energies: solar s_t (daytime slots), wind w_t, grid complement g_t \geq 0 at intensity c_t.

Model (sliding-window LP). \min \sum_t c_t\, g_t\,\Delta t \quad\text{subject to}\quad \begin{cases} g_t + s_t + w_t \;\geq\; \mathrm{PUE}\cdot u_t & \text{(power balance)}\\ \sum_{t \in \text{day}} f_t\,\Delta t \;\geq\; D & \text{(total deferred work, kWh)}\\ u_t \leq U^{\max}, \quad u_t = U^{\text{rigid}}_t + f_t,\; f_t \geq 0 &\end{cases} where f_t is the power allocated to flexible work: only the flexible energy counts toward the deferred work D, since the rigid load U^{\text{rigid}}_t runs anyway.

Dual reading. The multiplier of the total-work constraint is the marginal emission of one more kWh of flexible work, in gCO2eq per kWh. It is zero as long as some hour with spare capacity has surplus solar or wind power; otherwise it equals \mathrm{PUE}\cdot c_t for the cleanest hour that still has spare capacity, and it rises sharply when only the evening peak is left.

This is a dynamic price signal derived from the model, and the same mechanism as the industrial deployment described by Radovanovic et al. (references): planning ahead with forecasts of s_t, w_t, c_t (forecasts to which the Machine Learning module, ch. 5–6, applies directly).

Case study 5.2 — Coordinated charging of an electric vehicle fleet Data. N vehicles, each plugged in from a_i to d_i, need E_i (kWh), max power p_i.

Grid: hourly intensity c_t, tariff p_t^\text{elec}, local transformer capacity K (the real “bottleneck” of company parking lots: without coordination, everyone plugs in at 6 pm).

Model. \min_{x_{i,t} \geq 0}\; \sum_{i,t}\; c_t\, x_{i,t} \quad\text{subject to}\quad \begin{cases} \sum_{a_i \leq t < d_i} x_{i,t}\,\Delta t \;\geq\; E_i & \forall i \;\;\text{(energy need)}\\ 0 \leq x_{i,t} \leq p_i & \forall (i,t) \\ \sum_i x_{i,t} \;\leq\; K & \forall t \;\;\text{(transformer capacity)}\end{cases} Pure LP (continuous): solved to the optimum in seconds for thousands of vehicles. The dual delivers the usage prices of the transformer hour by hour — enough to price the incentive rather than forbid.

ILP variant: fast charging available when needed (z_{i,t} \in \{0,1\}, x \leq M z, fixed cost \kappa z); stochastic variant: unexpected departures (scenarios, recourse).

Robust variant: the intensities are forecasts, each known only to lie in an interval [\hat c_t - \delta_t,\ \hat c_t + \delta_t]. Minimizing the worst-case emissions over this box is the same LP with c_t replaced by \hat c_t + \delta_t, because every x_{i,t} \geq 0. A budget of uncertainty — at most \Gamma hours off their forecast (Bertsimas and Sim, 2004) — is less pessimistic, and by LP duality its robust counterpart is still an LP.

import numpy as np
from scipy.optimize import linprog

# 3 vehicles, 8 hourly slots from 18h to 2h, transformer capacity 11 kW
T, K = 8, 11.0
c = np.array([300, 380, 320, 140, 60, 55, 52, 58])    # gCO2/kWh per slot
veh = [ (0, 8, 20.0, 7.0), (0, 8, 28.0, 7.0), (2, 8, 15.0, 3.5) ]  # (a, d, E, p): slots a <= t < d
n = len(veh) * T                                      # variable x[i, t] = idx i*T + t
cost = np.array([c[idx % T] for idx in range(n)])     # minimize sum c_t x_it

A_ub, b_ub = [], []                                   # capacity per slot
for t in range(T):
    row = [1.0 if idx % T == t else 0.0 for idx in range(n)]
    A_ub.append(row); b_ub.append(K)
A_eq, b_eq = [], []                                   # energy need
for i, (a, d, E, p) in enumerate(veh):
    row = [1.0 if (idx // T == i and a <= idx % T < d) else 0.0 for idx in range(n)]
    A_eq.append(row); b_eq.append(E)
bounds = [(0, p) for (a, d, E, p) in veh for _ in range(T)]
res = linprog(cost, A_ub=np.array(A_ub), b_ub=b_ub, A_eq=np.array(A_eq),
              b_eq=b_eq, bounds=bounds, method="highs")
x = res.x.reshape(len(veh), T)
print("optimal emissions (kg CO2eq):", round(res.fun / 1000, 2))
print(np.round(x, 1))   # the cars wait for the low-carbon slots
print(res.ineqlin.marginals)   # transformer prices (negative: scipy's sign convention)

Example 5.3 — What the solver says about the transformer The program above returns 6.42 kg CO2eq. The four night slots (52–60 g/kWh) are saturated at 11 kW, as is the 21h slot (140 g/kWh); the remaining 8 kWh go to the 18h slot (300 g/kWh), the cleanest of the evening ones.

Removing the transformer limit (K very large) lets each vehicle charge only at night, for 3.60 kg: the capacity of the transformer costs 2.8 kg per evening.

The dual variables say the same thing hour by hour: the multiplier of the capacity constraint is 300 - c_t for each saturated slot — from 160 g/kWh at 21h to 248 g/kWh at 0h — because one more kW at that hour replaces one kWh charged at 300 g. These are the numbers to put in front of the facility manager: they price an upgrade of the transformer, or an incentive to leave the car plugged in longer, in kg of CO2 avoided.

What these cases teach (meta-lesson)

  1. Structure matters more than size: these models with thousands of variables solve in seconds because they are linear; a single non-linear term can change everything.
  2. The dual is a product: dynamic prices, incentive signals, marginal value of carbon.
  3. The hard part is not the optimizer but the data (forecasts, measurements) and governance (who accepts that their task waits?) — optimization is the art of making these trade-offs explicit.

6. Measuring the footprint: energy, PUE, carbon accounting

Every optimization of the previous chapters minimizes a number — kWh, gCO2eq — that someone must first measure. This chapter turns that number into a protocol: what is measured, at which boundary, with which conversion factors and with what uncertainty, so that two claims can be compared and audited (ch. 7).

Definition 6.1 — Energy of a job, measurement boundary and PUE The energy of a job is the integral of the power drawn while it runs, E_{\mathrm{IT}} = \int P(t)\,dt, in kWh. Its value depends on the boundary of the measurement: software counters read the power of one component — NVML for the GPU board, RAPL for the CPU package and the DRAM — while a meter at the wall plug sees the whole server, fans and power supply included.

The building adds cooling, power conversion losses and lighting, summarized by the power usage effectiveness \mathrm{PUE} = \frac{\text{total energy of the facility}}{\text{energy of the IT equipment}} \;\geq\; 1, so that the energy attributable to the job is E = \mathrm{PUE}\cdot E_{\mathrm{IT}}. Values around 1.1 are reported for the most efficient hyperscale sites; industry surveys give averages around 1.5.

Definition 6.2 — Operational and embodied emissions The operational emissions of a job are C_{\mathrm{op}} = E \cdot \mathrm{CI}, where \mathrm{CI} is a carbon intensity in gCO2eq/kWh (def. 2.1). The intensity can be location-based (the physical mix of the grid where and when the job ran) or market-based (the contractual factor of the electricity purchased, certificates included); the GHG Protocol asks companies to report both, and only the first one describes the physics of the grid (ch. 7, pitfall 3).

The embodied emissions come from manufacturing, transporting and disposing of the hardware; a job that occupies a machine for a duration T_{\mathrm{job}} out of a service life T_{\mathrm{life}} is charged the share C_{\mathrm{emb}} = \frac{T_{\mathrm{job}}}{T_{\mathrm{life}}}\; C_{\mathrm{manuf}}. The footprint reported for the job is C = C_{\mathrm{op}} + C_{\mathrm{emb}}.

Example 6.3 — The footprint of a three-day fine-tuning, step by step A fine-tuning runs for 72 h on a server with 8 GPUs.

  1. GPU counters. NVML reports an average of 300 W per GPU, i.e. 8 \times 0.3 \times 72 = 172.8 kWh.
  2. Wall meter. A meter at the wall reads an average of 3.4 kW for the whole server, i.e. E_{\mathrm{IT}} = 3.4 \times 72 = 244.8 kWh: the GPU-only figure misses 29\% of the server’s consumption.
  3. Facility. With a PUE of 1.2, E = 293.8 kWh.
  4. Operational emissions. On a low-carbon grid at 55 g/kWh, C_{\mathrm{op}} \approx 16.2 kg; on a grid dominated by gas and coal at 400 g/kWh, C_{\mathrm{op}} \approx 117.5 kg.
  5. Embodied share. Assume C_{\mathrm{manuf}} = 3000 kgCO2eq for the server and a service life of 4 years (35\,040 h) — published estimates of embodied footprints vary by a factor of several, so this is an assumption to be stated, not a datum. Then C_{\mathrm{emb}} = \frac{72}{35\,040} \times 3000 \approx 6.2 \text{ kg}.

The lesson is in the ratio: the embodied share is about 28\% of the total on the low-carbon grid and about 5\% on the fossil one. The cleaner the electricity, the more the manufacturing of the hardware matters — and the less a “we use green power” argument settles the question.

Proposition 6.4 — Relative uncertainties of a product add in quadrature (proved to first order) Let C = X_1 X_2 \cdots X_n be a product of independent positive factors, each with a small relative standard deviation r_i = \sigma_i / X_i. Then, to first order, the relative standard deviation of C is

Key result — relative uncertainties add in quadrature r_C \;\approx\; \sqrt{r_1^2 + \cdots + r_n^2}.

The worst-case relative error is at most \prod_i (1 + r_i) - 1 \approx r_1 + \cdots + r_n when each factor is off by at most r_i.

Proof. Take logarithms: \log C = \sum_i \log X_i. A small perturbation \delta X_i changes \log X_i by \delta X_i / X_i to first order, so \delta C / C \approx \sum_i \delta X_i / X_i . The variance of a sum of independent terms is the sum of the variances, which gives r_C^2 \approx \sum_i r_i^2. For the worst case, \prod_i (1+r_i) - 1 is the largest relative increase of the product when each factor increases by its maximal relative error, and its expansion to first order is \sum_i r_i. ∎

Example 6.5 — An honest error bar on example 6.3 Take a relative uncertainty of 10\% on E_{\mathrm{IT}} (software counters and averaging), 5\% on the PUE and 30\% on the carbon intensity (an annual average used for a job whose hourly intensity is unknown). Proposition 6.4 gives r_C \approx \sqrt{0.01 + 0.0025 + 0.09} \approx 0.32 . The operational footprint on the fossil grid should therefore be published as about 117 kg \pm 32\%, i.e. a one-standard-deviation range of roughly 80 to 155 kg — and not as “117.5 kg”.

The simulation below gives a 90% interval of about 70 to 200 kg. The quadrature sum also says where to invest effort: the intensity term dominates, so obtaining the hourly intensity of the region (Electricity Maps, grid operators) improves the estimate far more than a better power meter would.

Definition 6.6 — Training versus inference: the break-even time A model trained once with energy E_{\mathrm{train}} then serves N queries per day at an energy e_q per query. Inference overtakes training after D^\star = \frac{E_{\mathrm{train}}}{N\, e_q} \text{ days}.

Patterson et al. (2021) estimate the training of GPT-3 at about 1\,287 MWh. Under the assumption of 0.3 Wh per query:

  • 10 million queries a day consume 3 MWh a day, and inference overtakes training after about 430 days;
  • at 100 million queries a day, after about 43 days.

The same authors report that at Google, inference accounted for about three fifths of the energy spent on machine learning in 2019–2021 (Patterson et al., 2022). A footprint that counts only training therefore describes the beginning of the life of a widely used model, not its life.

The protocol sheet — what any published figure must state

  1. The task and the quality reached.
  2. The hardware: model and number of accelerators, and the server.
  3. The measurement method and its boundary (NVML, RAPL, wall meter) and the sampling period.
  4. The duration and the energy E_{\mathrm{IT}}, including the failed runs and the hyperparameter search, which Strubell et al. (2019) showed can multiply the cost of the final run many times over.
  5. The PUE and its source.
  6. The carbon intensity: location- or market-based, region, temporal resolution (hourly or annual), source.
  7. The embodied share and the assumptions behind it.
  8. An uncertainty range (prop. 6.4).
  9. The code and configuration needed to redo the measurement.

Tools such as CodeCarbon or the experiment-impact-tracker of Henderson et al. (2020) automate items 3 to 6 by reading the counters and a regional intensity table; when the counters are not accessible they fall back to estimates based on the nominal power of the processor, which must then be stated as such.

Common mistakes in measurement

  1. Multiplying the nominal maximal power (TDP) of a GPU by the duration: a GPU rarely runs at its TDP for a whole job, so the result overestimates, sometimes by a factor of two.
  2. Confusing kW (a power) and kWh (an energy): “the cluster consumes 40 kWh” says nothing without a duration.
  3. Measuring the GPU only and calling it the job’s energy (example 6.3: 29\% missing).
  4. Comparing two models measured with different boundaries or different intensity sources.
  5. Forgetting idle time: a reserved but idle node still draws a large fraction of its peak power, and that energy belongs to the project that reserved it.
import numpy as np
rng = np.random.default_rng(0)
n = 100_000
E_it = 244.8 * rng.lognormal(0, 0.10, n)     # kWh, +-10% (counters, averaging)
pue  = 1.2   * rng.lognormal(0, 0.05, n)     # +-5%
ci   = 0.400 * rng.lognormal(0, 0.30, n)     # kgCO2eq/kWh, +-30% (annual average)
C = E_it * pue * ci
lo, med, hi = np.percentile(C, [5, 50, 95])
print(f"median {med:.0f} kg, 90% interval [{lo:.0f}, {hi:.0f}] kg")
print(f"relative spread {np.std(np.log(C)):.2f} vs quadrature "
      f"{np.sqrt(0.10**2 + 0.05**2 + 0.30**2):.2f}")   # prop. 6.4

7. Limits, rebound effect and greenwashing

The previous chapters optimize and measure; this one asks what those numbers can and cannot prove. It lists the classic pitfalls of carbon accounting, models the rebound effect that can cancel an efficiency gain, and ends with an audit grid for “green AI” claims.

Honesty note — the five pitfalls of carbon accounting

  1. Average vs marginal. Adding up kWh at a country’s average intensity underestimates the real effect: new consumption calls, at peak time, on marginal generation means (often gas: 400–600 g/kWh). The “average or marginal?” debate changes conclusions by a factor of 2 to 5 — honesty requires testing both.
  2. Chosen scope. Counting training but not inference (which, at the scale of millions of users, often dominates); forgetting hardware manufacturing (depreciation: up to a third of the footprint depending on the study); forgetting storage and network.
  3. Offsets and RECs. Buying green certificates does not change the physics of the grid: nighttime computing in a coal region emits coal, even covered with certificates. Claiming “net zero” on that basis is documented greenwashing.
  4. Rebound effect (Jevons). Making AI four times cheaper in energy often increases… total AI consumption: new uses (and training loops) absorb the gain. Efficiency is necessary, not sufficient: only a cap constraint (an absolute carbon budget, ch. 1: \varepsilon-constraints) turns it into a guarantee. Proposition 7.1 below makes this quantitative.
  5. False precision. “273.4 kg” when the actual hourly intensity is unknown to ±30%: publish ranges and assumptions, not magic numbers.

Proposition 7.1 — Rebound in a constant-elasticity model (proved) A service (queries answered, images generated) is consumed in quantity Q, which responds to its unit cost p with a constant price elasticity \eta > 0 (written \eta to keep \varepsilon for the budgets of the \varepsilon-constraints): Q = A\,p^{-\eta}. An efficiency gain divides the energy per unit of service by k > 1, from e_0 to e_0/k, and the unit cost is proportional to that energy, p = p_0/k. Then the total energy E = Q\,e goes from E_0 to

Key result — rebound in a constant-elasticity model E = E_0\, k^{\eta - 1}.

Hence:

  • if \eta < 1, energy decreases, but by less than the factor k (partial rebound);
  • if \eta = 1, it does not change at all (full rebound);
  • if \eta > 1, it increases (backfire — the Jevons paradox).

The rebound fraction, the share of the expected saving 1 - 1/k that is lost, is R = 1 - \frac{1 - k^{\eta-1}}{1 - 1/k}.

Proof. Before the gain, E_0 = A\,p_0^{-\eta}\,e_0. After it, E = A\,(p_0/k)^{-\eta}\,(e_0/k) = A\,p_0^{-\eta} e_0 \cdot k^{\eta}\cdot k^{-1} = E_0\,k^{\eta - 1}. The sign of \eta - 1 decides whether k^{\eta-1} is below, equal to or above 1. The realized saving is 1 - E/E_0 = 1 - k^{\eta - 1}, and R is one minus the ratio of the realized saving to the expected one. ∎

Example 7.2 — The same efficiency gain, three outcomes An inference stack becomes k = 4 times more efficient.

  • With \eta = 0.5, total energy becomes 4^{-0.5} = 0.5 times the initial one: the expected saving was 75\%, the realized one is 50\%, so a third of the gain is absorbed (R = 1/3).
  • With \eta = 1, nothing is saved.
  • With \eta = 1.2, total energy is multiplied by 4^{0.2} \approx 1.32: the “green” optimization increases consumption by about a third.

Two cautions keep the model honest. First, the elasticity of AI services is unknown, is not constant, and varies between uses; the proposition is a way to reason, not a forecast. Second, energy is only part of the unit cost (hardware, staff and margins count too): if it is a fraction \varphi of the cost, the price only falls to p_0(1 - \varphi + \varphi/k) and the rebound is weaker — exercise 9 quantifies this.

Proposition 7.3 — Audit grid for a “green AI” claim

Audit question Red flag
What scope? “our model” without inference, without manufacturing, without data
What intensity, what source, what time? annual national average for a localized data center; “contractual” intensity
Compared to what? “−80%” without reference or protocol (vs what? at equal accuracy?)
Reproducible figures? no code, no config, no hardware specified
Measured real benefit? carbon gain “enabled” by the AI not quantified (this is the hardest — and the most important)

The final question — “does AI reduce more emissions than it causes?” — is legitimate, open, and beyond the reach of a simple measurement: it requires a full life-cycle model. The module provides the tools to pose it honestly, not to answer it with a slogan.

Professional positioning The “responsible AI” engineer is neither an activist nor an accountant: they are someone who knows how to (i) model a trade-off (ch. 1), (ii) optimize under resources (ch. 2, 4, 5), (iii) reduce the cost of models (ch. 3), (iv) measure with a protocol (ch. 6), (v) state the limits of their figures, rebound effects included (ch. 7). This complete chain — that is the module’s bet — is exactly what the “AI sustainability” teams of major players are looking for.

8. Course research notes — ORAILIX (Vanier, Matin)

Team update: on the 2025–2026 sheet, the CSC_52073_EP course unit “Optimisation and Responsible AI” had two coordinator-instructors, Hossein Nick Zinat Matin and Sonia Vanier (occurrence coordinator: S. Vanier). In 2026–2027 the course is CSC_51076_EP, taught in Period 1; Sonia Vanier is listed by École Polytechnique and Hossein Nick Zinat Matin on a Télécom Paris listing. The works presented below are those of Sonia Vanier’s ORAILIX team.

Sonia Vanier (LIX, École Polytechnique) — operations research and decision support

Sonia Vanier is a professor at École Polytechnique (LIX, CNRS, Institut Polytechnique de Paris), where she leads the ORAILIX team (founded in 2024): a crossing of operations research and machine learning for industrial decision support, including an “Optimization for Mobility” chair — exactly the territory of chapters 4 and 5 of this module. Verified representative publications:

Bibliographic honesty (as in ch. 7): the complete list of her publications, notably the most recent ones on the ML–optimization bridges within ORAILIX, is to be confirmed on her page (orailix.com) and on her DBLP profile (“Sonia Haddad-Vanier”); the elements above were verified at the time of writing.

Exercises

  1. ★ Pareto front by hand. Objectives F_1(x)=(x-1)^2+1, F_2(x)=(x+1)^2+1, x \in [-3,3].

    1. Plot the attainable set in the (F_1,F_2) plane and the front.

    2. Show that x=-2 and x=2 are dominated.

    3. For w=(1,1), solve the scalarization and verify that it gives x=0.

    4. On the objectives F_1(x)=x, F_2(x)=1-x^2 of prop. 1.3, show that x=0.5 is Pareto-optimal but is not the minimizer of any weighted scalarization w>0.

    Solution: (c) F_w = 2x^2+4 minimal at 0; (d) F_w is concave in x, hence minimal at the endpoints, see prop. 1.3.

  2. ★ Quantization error propagation. A two-layer network, \mathrm{Lip}_1 = 3, \mathrm{Lip}_2 = 2, 8-bit quantization over a weight domain [-0.5, 0.5].

    1. Compute the step with proposition 3.3 and check that \Delta_1 = \Delta_2 = 1/255 \approx 2^{-8}.

    2. Apply proposition 3.3 and bound the output error.

    3. Redo at 4 bits (\Delta = 1/15); for a stack of L identical layers with \mathrm{Lip} = 2, from what depth L does the bound exceed 0.1? Conclude on the necessity of QAT for int4 deep networks.

    Solution: (b) \frac{\Delta}{2}(\mathrm{Lip}_2 + 1) = \frac{3}{510} \approx 0.006 ; and for (c) the bound is \frac{\Delta}{2}(2^L - 1) = \frac{2^L - 1}{30}, which exceeds 0.1 as soon as 2^L > 4, i.e. from L = 3 on.

  3. ★ Branch and bound by hand. Binary knapsack: capacity C = 10, items (v,w) \in \{(7,6), (5,5), (4,4), (2,1)\}. (a) Solve the greedy relaxation at the root. (b) Branch on the most fractional variable, draw the complete tree, indicate for each node: bound (relaxation), pruned or explored, and why. (c) Compare with the PuLP solution (ch. 4); (d) how many nodes if one branches on the least fractional variable? Conclusion on branching heuristics.

  4. ★★ Chebyshev. Still on F_1(x)=x, F_2(x)=1-x^2, x \in [0,1] (ideal point z^\star=(0,0)).

    1. Verify that every point is Pareto-optimal.

    2. Show that g_w(x) = \max\{w_1 F_1(x),\, w_2 F_2(x)\} attains its minimum at the equilibrium w_1 x = w_2(1-x^2) (one grows, the other decreases).

    3. Deduce that every point of the front is produced by some w>0 — a complete contrast with prop. 1.3 — and compute w_1/w_2 to obtain x = 0.5.

    Solution: (c) at equilibrium w_1/w_2 = (1-x^2)/x = 3/2 for x=0.5.

  5. ★★ Carbon scheduling. Take up example 2.3 with an additional constraint: deadline at +24 h. (a) Solve by hand with the exchange argument of theorem 2.2. (b) Write the dual of the “knapsack” \min \sum c_t x_t, \sum x_t = T, 0 \leq x_t \leq 1 and interpret the dual variable (price of an hour of delay). (c) What becomes the optimum if the job can be sequenced in pieces of one hour minimum? Hint: nothing changes — why?

  6. ★★ Distillation lab. Teacher: a ~1M-parameter CNN on MNIST (98.5% expected); student: an MLP with ~20k. (a) Train the student alone (baseline ~97%). (b) Distill with def. 3.1 (T \in \{1,2,4\}, \lambda \in \{0.3, 0.7\}). (c) Measure inference energy per batch (protocol of ch. 6) and the number of parameters; plot the (energy, accuracy) point of the two models on the Pareto plot of example 1.6 (ch. 1). Partial solution (PyTorch):

    import torch, torch.nn as nn, torch.nn.functional as F
    def distill_loss(zs, zt, y, T=4.0, lam=0.7):   # def. 3.1
        kd = F.kl_div(F.log_softmax(zs/T, 1), F.softmax(zt/T, 1),
                      reduction="batchmean") * T*T
        return (1-lam)*F.cross_entropy(zs, y) + lam*kd
    # loop: zs = student(x); with torch.no_grad(): zt = teacher(x)
  7. ★★ Framed measurement. With CodeCarbon (ch. 6), measure the energy of the same training (logistic regression on MNIST, 10 epochs) (a) on your machine, (b) with the offline tracker set to France (country_iso_code="FRA"), then Germany ("DEU"), then with a world-average intensity of about 475 gCO2eq/kWh entered by hand. (c) Produce the protocol sheet of ch. 6: boundary, hardware, intensity source, uncertainty (prop. 6.4). (d) Sensitivity: replace the hourly intensity with the annual average and quantify the gap. Deliverable: 10 lines, two figures, one range.

  8. ★★ Carbon-constrained knapsack (ε-constraint). Take the four items of exercise 3 (capacity 10, (v,w) \in \{(7,6), (5,5), (4,4), (2,1)\}) and give them carbon costs k = (5, 1, 2, 1).

    1. Solve the unconstrained problem and show that it has two optimal solutions of value 11.

    2. Add the constraint \sum_i k_i x_i \leq \varepsilon and solve it for \varepsilon = 0, 1, \dots, 7 (by enumeration, then with PuLP as in ch. 4).

    3. Draw the front in the (carbon, value) plane.

    4. Which points of the front does the weighted problem \max \sum_i (v_i - \lambda k_i) x_i find as \lambda \geq 0 varies?

    Solution (a). \{1,3\} (carbon 7) and \{2,3,4\} (carbon 4) both reach 11 — the same value for 43\% less carbon, a saving that a single-objective solver may or may not return.

    Solution (b–c). The front is (0,0), (1,5), (2,7), (3,9), (4,11).

    Solution (d). The four non-zero points (1,5), (2,7), (3,9), (4,11) lie on one line of slope 2, so all four tie at \lambda = 2.

    • For 0 < \lambda < 2 the weighted problem returns (4,11); at \lambda = 0 it may also return the dominated (7,11) of (a).
    • For 2 < \lambda < 5 it returns (1,5); at \lambda = 5 it ties (1,5) with (0,0).
    • For \lambda > 5 it returns (0,0).

    The points (2,7), (3,9) only appear as ties at \lambda = 2 — the \varepsilon-constraint finds them without ambiguity.

  9. ★★ Rebound arithmetic. Use proposition 7.1.

    1. An efficiency gain k = 3 meets an elasticity \eta = 0.6: compute E/E_0 and the rebound fraction R.

    2. For which elasticity is the gain entirely cancelled?

    3. Energy is now only a share \varphi = 0.3 of the unit cost, so that p = p_0(1 - \varphi + \varphi/k): redo (a).

    4. Which policy instrument of ch. 1 makes the saving independent of the elasticity \eta?

    Solution (a–b). (a) E/E_0 = 3^{-0.4} \approx 0.64 and R \approx 0.47; (b) \eta = 1.

    Solution (c). p = 0.8\,p_0, Q/Q_0 = 0.8^{-0.6} \approx 1.14, E/E_0 \approx 1.14/3 \approx 0.38 and R \approx 0.07.

    Solution (d). An absolute cap, i.e. an \varepsilon-constraint on total energy or carbon.

  10. ★★★ Audit. Find a public “green AI” claim (corporate report, lab blog). Apply grid 7.3 to it: scope, intensity, reference, reproducibility, real benefit; write a one-page audit note, with at least one quantified test redone by yourself (e.g. recompute the emission with the protocol sheet of ch. 6). Grading grid: technical accuracy, factuality (no unsourced claim), and nuance — distinguish what is false, imprecise, and merely incomplete.

Projects and assessment

Official assessment. The fiche can quote only the last published sheet (SynapseS 2025–2026, CSC_52073_EP): “Numerical grade out of 20 (literal conversion / American grade); resit allowed (max of the two grades); course unit earned if final grade ≥ 10”, with detailed modalities not communicated. No assessment is quoted for the 2026–2027 code CSC_51076_EP, and the unit is not in the LLGA lists, so no LLGA rule applies. Everything below is a proposal sized for a 36 h course: solo subjects of 15–20 h, group subjects of 25–30 h per member, a two-hour written exam and a rubric.

The projects exercise two master objectives above all: O7 (hands-on and industry practice — measured kWh, real solvers, real traces) and O8 (trustworthy and responsible AI — honest accounting, error bars, rebound and greenwashing). The LP and ILP subjects also train O1 (optimization and duality).

Three subjects reach other LLGA modules: the fine-tune subject adds O3 through Large Language Models, 4.3; the serving subject continues Deep Learning (P2 variant), ch. 5–6, and the green ops of ML Ops and LLM Engineering, ch. 10; the feeder subject adds O4 (graph-structured data).

Solo projects

  1. [Solo · ≈ 20 h] Pareto front of a small-LLM fine-tune: accuracy, kWh and latency. Which LoRA rank, weight precision and model size are Pareto-rational for one task, and which of them can no weighted sum of the objectives ever select?
    • Implement: LoRA and QLoRA fine-tunes (Large Language Models, 4.3) of SmolLM2-135M and SmolLM2-360M, or Qwen2.5-0.5B, on a 10 000-sentence subset of SST-2 (GLUE) on a free-tier GPU, so that the 72 runs fit the budget; sweep the rank r \in \{4, 8, 16, 32\} and the precision of the frozen base (16-bit, int8, 4-bit NF4), with 3 seeds per configuration.
    • Measure: validation accuracy, training and inference energy with CodeCarbon under the protocol sheet of ch. 6, latency per query, and an uncertainty range for every energy figure (prop. 6.4).
    • Analyse: the non-dominated set; its supported points (on the convex hull of the front), the only ones a weighted sum can return (theorem 1.2, prop. 1.3), against the others; a selection by \varepsilon-constraint (def. 1.4) at a stated kWh budget; the training–inference break-even (def. 6.6) at 10^4 and 10^6 queries a day.
    • Deliverables: code, 4–6 page report with the protocol sheet, 10-minute talk. Chapters: ch. 1, 3, 6.
    • Success criterion: every point carries error bars from the seeds and from prop. 6.4; the report names the Pareto points that no weighting reaches (or shows there are none) and the differences that lie within noise (ch. 1, common mistake 2).
  2. [Solo · ≈ 20 h] Distil, quantize, prune: a frugal text classifier with honest accounting. A paper study of Tang, Lu, Liu, Mou, Vechtomova and Lin, “Distilling task-specific knowledge from BERT into simple neural networks”, arXiv:1903.12136, 2019. How many parameters and joules per query does compression save on one task, and after how many queries does it repay the teacher?
    • Implement: a BERT-base teacher fine-tuned on SST-2; two students — the paper’s BiLSTM and a 4-layer compact BERT (Turc et al., 2019, google/bert_uncased_L-4_H-256_A-4) — distilled with def. 3.1 for T \in \{1, 2, 4, 8\} and \lambda \in \{0.3, 0.7, 0.9\}; then int8 post-training quantization and structured head pruning (def. 3.4).
    • Measure: accuracy, parameters, memory, throughput and energy per query on a CPU (RAPL through CodeCarbon) at batch sizes 1 and 64; test whether the memory-bound reasoning of example 3.5 predicts the int8 speedup at batch 1.
    • Account: the energy of the teacher’s fine-tuning and of every distillation run, discarded ones included (ch. 3, common mistake 3), and the number of queries that repays it (def. 6.6).
    • Deliverables: code, 4–6 page report, 10-minute talk. Chapters: ch. 1, 3, 6.
    • Success criterion: both students sit on the (energy per query, accuracy) plot of example 1.6 with error bars over 3 seeds; their compression ratios and accuracy gaps are compared with the paper, whose teacher is the larger BERT-large (335M parameters), and with the range of the ch. 3 table.
  3. [Solo · ≈ 15 h] Auditing a published footprint: BLOOM. A paper study of Luccioni, Viguier and Ligozat, “Estimating the carbon footprint of BLOOM, a 176B parameter language model”, JMLR 24(253), 2023, which reports 24.7 t CO2eq for the dynamic power of the final training and 50.5 t when every process, from equipment manufacturing to operation, is counted.
    • Recompute: each term of their total from the energy, PUE, intensity and embodied factors they report, with def. 6.1 and 6.2.
    • Stress-test: the same training on a gas-heavy grid and at a marginal intensity (ch. 7, pitfall 1), with the boundary choices of example 6.3 (GPU only, server, facility), and with an uncertainty range (prop. 6.4).
    • Audit: apply the grid of prop. 7.3 and the protocol sheet of ch. 6; add a rebound scenario for the deployment (prop. 7.1) over a stated range of elasticities.
    • Deliverables: a 3-page audit note, a notebook with every number, 10-minute talk. Chapters: ch. 6, 7.
    • Success criterion: every recomputed figure matches the paper up to rounding, or the gap is explained; each claim of the note is labelled false, imprecise or incomplete, as in exercise 10.

Group projects

  1. [Group of 3 · ≈ 30 h each] Carbon-aware scheduler for a lab GPU cluster. How much carbon does a scheduler that knows tomorrow’s intensity forecast save on a real job mix without missing a deadline, and how much of the saving survives forecast errors? The design is compared with the production system of Radovanovic et al. (2022, references).
    • Data: job arrivals, durations and GPU counts from the Microsoft Philly traces (Jeon et al., “Analysis of large-scale multi-tenant GPU clusters for DNN training workloads”, USENIX ATC 2019; github.com/msr-fiddle/philly-traces), rescaled to a 32-GPU lab; hourly intensity for France from RTE’s éCO2mix and for a second zone from the Electricity Maps data portal.
    • Implement: the ILP of the ch. 2 note (durations, deadlines, precedence, GPU capacity) with PuLP and HiGHS on a rolling 48 h horizon; intensity forecasts by gradient boosting (Machine Learning, ch. 6); baselines: immediate launch and the cleanest-hours rule of theorem 2.2; the robust variant of case study 5.2 for forecast error.
    • Price: fix the integer choices, solve the LP that remains and read the dual of each hour’s capacity as a carbon price per GPU-hour shown to users (example 2.3, example 4.4).
    • Split of work: A: data and forecasts; B: the ILP, the solver and its optimality gaps; C: the robust variant, the dual prices and the evaluation.
    • Deliverables: repository, 6-page report, 15-minute talk. Chapters: ch. 2, 4, 5, 6.
    • Success criterion: on held-out weeks, the saving against immediate launch is reported with real forecast errors and next to a clairvoyant schedule; no deadline is missed; every ILP is solved to an optimality gap below 1 %.
  2. [Group of 3 · ≈ 30 h each] Coordinated EV charging on a distribution feeder. Extend case study 5.2 from one transformer to a feeder graph: which lines are the bottlenecks, what is an upgrade worth in kg CO2eq, and what do uncertain departures cost?
    • Data: charging sessions (arrival, departure, energy delivered) from ACN-Data (Lee, Li and Low, “ACN-Data: analysis and applications of an open EV charging dataset”, ACM e-Energy 2019); the IEEE 33-bus radial test feeder (Baran and Wu, 1989) as the graph, with vehicles attached to its nodes; hourly intensity from éCO2mix or Electricity Maps.
    • Implement: the LP of case study 5.2 with one capacity per line of the feeder (active power only: the flow on a line is the sum of the loads downstream of it); a two-stage stochastic variant whose scenarios resample departures from ACN-Data, with unmet energy as a penalized recourse; the fast-charging ILP variant (x \leq Mz, fixed cost \kappa z).
    • Price: line and transformer upgrades from the duals (example 5.3), each checked by re-solving with one more kW; the schedule under average and under marginal intensity (ch. 7, pitfall 1).
    • Split of work: A: data, scenarios and the feeder graph; B: the LP and ILP models; C: duals, sensitivity analysis and the report.
    • Deliverables: repository, 6-page report, 15-minute talk. Chapters: ch. 4, 5, 7.
    • Success criterion: every need is met in every scenario or its shortfall is priced; the saving against uncontrolled charging (full power on arrival) is reported for both intensity conventions; any dual price that disagrees with its re-solve is explained by a change of active constraints.
  3. [Group of 2 · ≈ 25 h each] Joules per token: serving a small LLM frugally. How do weight precision and batch size move the energy per generated token, the latency and the quality of a small open LLM, and does the memory-bandwidth bound of example 3.5 predict the measurements?
    • Implement: generation with Qwen2.5-1.5B-Instruct (or SmolLM2-1.7B-Instruct) in 16-bit, int8 and 4-bit weights with Hugging Face Transformers or vLLM on one free-tier GPU, batch sizes 1 to 32; energy from NVML through CodeCarbon, sampled during decoding only.
    • Compare: the measured tokens per second at batch 1 with the bound bandwidth ÷ bytes of weights (example 3.5; Deep Learning (P2 variant), def. 5.1, and the roofline of its ch. 6); quality on a fixed 200-question subset of GSM8K.
    • Analyse: the three-objective front (joules per token, P99 latency, accuracy); the break-even of def. 6.6 for a stated traffic; the green-ops reporting of ML Ops and LLM Engineering, ch. 10.
    • Split of work: A: serving, quantization and latency; B: energy measurement, uncertainty and quality evaluation.
    • Deliverables: repository, 5-page report, 15-minute talk. Chapters: ch. 1, 3, 6.
    • Success criterion: every energy figure follows the protocol sheet of ch. 6 with a range; the batch-1 throughput lies within a factor 2 of the bandwidth bound, or the gap is explained (dequantization kernels, KV cache); the front says which precision wins at each latency budget.

Written exam (proposal)

Two hours, one handwritten A4 sheet allowed, a basic calculator allowed; four independent questions on the proved results of the course.

  1. Question (5 points). Weighted scalarization and the hollow front (ch. 1).

      1. Let w \neq 0 be non-negative, and let x_w minimize F_w = \sum_i w_i F_i. Prove that x_w is weakly Pareto-optimal, and Pareto-optimal if w > 0.
      1. Give a two-solution example where w = (1, 0) admits a dominated minimizer.
      1. For F_1(x) = x and F_2(x) = 1 - x^2 on [0, 1], which points do weighted sums with w > 0 return? Which scalarization returns x = 0.5?

    Expected:

      1. Theorem 1.2. If x' dominates x_w, every weighted term weakly decreases and, for w > 0, the term of the strictly better objective decreases strictly: F_w(x') < F_w(x_w). If x' is strictly better on every objective, any positive weight, which exists since w \neq 0, gives the same strict inequality.
      1. F(a) = (0, 1) and F(b) = (0, 0): both minimize F_1, and a is dominated by b.
      1. F_w is concave in x, so its minimum over [0,1] is at an endpoint: weighted sums return only x = 0 and x = 1 (prop. 1.3).
    • The \varepsilon-constraint \min\{x : 1 - x^2 \leq \varepsilon\} returns x = \sqrt{1-\varepsilon}, hence x = 0.5 for \varepsilon = 0.75 (example 1.5). Chebyshev also reaches it, with w_1/w_2 = 3/2 (exercise 4).
  2. Question (6 points). A deferrable job of 3 hours at constant power P = 0.5 kW can run in any of the next six hours, of intensities c = (300, 120, 80, 60, 200, 400) gCO2eq/kWh; it may be split into pieces of any length.

      1. Give the minimal emission, the emission of an immediate launch and the relative gain (theorem 2.2).
      1. The PUE is 1.2; the relative uncertainties are 10\% on the IT energy, 5\% on the PUE and 20\% on the intensities. Report the optimal footprint with a one-standard-deviation range.
      1. Write the LP of (a) with 0 \leq x_t \leq 1 and \sum_t x_t = T. What does one more hour of work cost when 3 < T < 4? Which values can the multiplier of the equality constraint take at T = 3?

    Expected:

      1. The three cleanest hours are 60, 80 and 120 g/kWh, so the optimum is 0.5 \times 260 = 130 g; launching now costs 0.5 \times 500 = 250 g; the gain is 48\%.
      1. With the PUE, 130 \times 1.2 = 156 g; prop. 6.4 gives r_C = \sqrt{0.01 + 0.0025 + 0.04} \approx 0.23, so about 156 g \pm 23\%, roughly 120 to 192 g.
      1. Minimize P \sum_t c_t x_t. The extra work goes to the fourth cleanest hour (200 g/kWh) and costs 0.5 \times 200 = 100 g per hour of work: the multiplier is P c_{(4)}.
    • At T = 3 the LP is degenerate: every value of [P c_{(3)}, P c_{(4)}] = [60, 100] g per hour is an optimal multiplier — the left and right derivatives of the optimal value.
  3. Question (5 points). Uniform quantization (ch. 3).

      1. A value x \in [x_{\min}, x_{\max}] is coded on b bits with step \Delta = (x_{\max} - x_{\min})/(2^b - 1) and rebuilt from the nearest level. Prove that |\hat x - x| \leq \Delta/2.
      1. A network has L layers with Lipschitz constants \mathrm{Lip}_\ell, and quantizing layer \ell shifts its output by at most \Delta_\ell/2. Prove the output bound of prop. 3.3 by induction.
      1. Three layers with \mathrm{Lip} = 2 and weights in [-1, 1]: evaluate the bound at 4 and at 8 bits.

    Expected:

      1. The levels are \Delta apart and cover the range, so the nearest one is at most half a cell away; clipping only brings values back inside.
      1. With \varepsilon_\ell the error after layer \ell, \varepsilon_{\ell+1} \leq \mathrm{Lip}_{\ell+1}\,\varepsilon_\ell + \Delta_{\ell+1}/2, \qquad \varepsilon_1 = \Delta_1/2, and unrolling multiplies each \Delta_\ell/2 by the constants of the later layers.
      1. The bound is (\Delta/2)(4 + 2 + 1) = 7\Delta/2: with \Delta = 2/15 at 4 bits it is 7/15 \approx 0.47, with \Delta = 2/255 at 8 bits it is 7/255 \approx 0.027 — 17 times smaller, which is why QAT takes over at 4 bits.
  4. Question (4 points). Rebound (ch. 7). Demand follows Q = A p^{-\eta}, the unit cost is proportional to the energy per unit of service, and an efficiency gain divides that energy by k > 1.

      1. Prove that total energy becomes E_0 k^{\eta - 1}.
      1. For k = 2 and \eta = 0.5, compute the expected saving, the realized saving and the rebound fraction R.
      1. Which constraint of ch. 1 guarantees a saving whatever \eta, and why?

    Expected:

      1. E = A (p_0/k)^{-\eta} (e_0/k) = E_0 k^{\eta} k^{-1}, as in prop. 7.1.
      1. Expected 1 - 1/2 = 50\%; realized 1 - 2^{-0.5} \approx 29.3\%; R = 1 - 0.293/0.5 \approx 0.41.
      1. An absolute cap on total energy or carbon, i.e. an \varepsilon-constraint: it bounds the quantity that matters, whereas efficiency only bounds the energy per unit of service.

Total: 5 + 6 + 5 + 4 = 20 points.

Grading rubric (proposal)

Criterion Weight What earns the marks
Formulation and proofs 25 % Objectives and constraints are separated before any code; LP and ILP models are written in full; proofs are complete
Measurement and error bars 25 % Every kWh and kg CO2eq follows the protocol sheet of ch. 6, with its boundary, its intensity source and a range (prop. 6.4)
Trade-off analysis 20 % Pareto fronts, ε-constraints and dual prices are reported in their units and read as decisions, with the value judgement stated
Honesty of claims 10 % Training and one-off costs are counted; rebound and the average-or-marginal question are discussed; no claim goes beyond the data (grid of prop. 7.3)
Report and talk 10 % Clear figures, assumptions next to conclusions, negative results reported, time limit respected
Reproducibility and teamwork 10 % One command reruns the results from fixed seeds; data, model and paper versions are cited; for groups, a visible split of the work

References