Prev: L20, Next: L22, Zoom: Link

Wisc NetID for In-class Quiz: @wisc.edu
4-digit Passcode: (anything is okay, use the same one for all lectures or use based on your id) 
Save submission to file? File name: (leave it blank to not save anything)


Slide:  



# Coordination Games

📗 Symmetric (simultaneous-move) games can have asymmetric Nash equilibria, but since the players are symmetric (identical), they might not know how to coordinate.
➩ Agreement before the game.
➩ Focal points (default actions).
➩ Randomized (mixed strategy).
In-class Discussion
📗 [1 points] There are three parking lots A, B, C with capacities \(15, 10, 5\). If a lot is below capacity, everyone in that lot gets \(+10\), and if a lot is above capacity, everyone in that lot gets \(-5\). Which parking lot would you choose?
A
B
C
[Note] Use the space to explain the reason you picked the action:

[L21Q1]
 
Other students' answers:

In-class Discussion
📗 [1 points] There are three parking lots A, B, C with capacities \(15, 10, 5\). If a lot is below capacity, everyone in that lot gets \(+10\), and if a lot is above capacity, everyone in that lot gets \(-5\). Which parking lot would you choose?
A
B
C
[Note] Use the space to explain the reason you picked the action:

[L21Q2]
 
Other students' answers:

In-class Discussion
📗 [1 points] There are three parking lots A, B, C with capacities \(15, 10, 5\). If a lot is below capacity, everyone in that lot gets \(+10\), and if a lot is above capacity, everyone in that lot gets \(-5\). Which parking lot would you choose?
A
B
C
[Note] Use the space to explain the reason you picked the action:

[L21Q3]
 
Other students' answers:

In-class Discussion
📗 [1 points] Suppose two countries plan an attack, but only country A knows whether we are in the good state or the bad state. They communicate through emails (A tells B the state, B confirms, A confirms B's confirmation, ...), but emails independently fail to deliver with small probability \(\varepsilon = 0.01\). How many emails received successfully will results in (Attack, Attack) in the good state?
Good state Attack No
Attack 10, 10 -100, 0
No -100, 0 0, 0

Bad state Attack No
Attack -100, -100 -100, 0
No -100, 0 0, 0

📗 Answer: .
[Note] Use the space to explain the reason you picked the action:

[L21Q4]
 
Other students' answers:




# Mixed Strategy

📗 A mixed strategy is when a player randomizes between multiple actions: Wikipedia.
📗 A pure strategy is when a player uses only one action with probability 1.
📗 A mixed strategy Nash equilibrium is a Nash equilibrium for the game in which mixed strategies are allowed (called mixed extension of the original game).
➩ If the mixed strategies are mutual best responses, then they form a mixed strategy Nash equilibrium (see Math Note for the mathematical definition).
Math Note
📗 For a two-player general-sum game with rewards \(r\) (both players are maximizing), an action profile \(\left(a_{1}, a_{2}\right)\) is a pure strategy Nash equilibrium if \(r_{1}\left(a_{1}, a_{2}\right) \geq r_{1}\left(a', a_{2}\right)\) for every \(a'\) valid action of player \(1\); and \(r_{2}\left(a_{1}, a_{2}\right) \geq r_{2}\left(a_{1}, a'\right)\) for every \(a'\) valid action of player \(2\). 
📗 An mixed strategy profile \(\left(\pi_{1}, \pi_{2}\right)\), where \(\pi_{i}\left(a\right)\) is the probability that player \(i\) chooses action \(a\), is a mixed strategy Nash equilibrium if \(\mathbb{E}\left[r_{1}\left(\pi_{1}, \pi_{2}\right)\right] \geq \mathbb{E}\left[r_{1}\left(\pi', \pi_{2}\right)\right]\) for every \(\pi'\) mixed strategy of player \(1\); and if \(\mathbb{E}\left[r_{2}\left(\pi_{1}, \pi_{2}\right)\right] \geq \mathbb{E}\left[r_{2}\left(\pi_{1}, \pi'\right)\right]\) for every \(\pi'\) mixed strategy of player \(2\).
➩ Here, the expectation is over the randomness of the mixed strategies, or \(\mathbb{E}\left[r_{i}\left(\pi_{1}, \pi_{2}\right)\right] = \displaystyle\sum_{a_{1}, a_{2}} r_{i}\left(a_{1}, a_{2}\right) \pi_{1}\left(a_{1}\right) \pi_{2}\left(a_{2}\right)\), where the sum is over all valid \(\left(a_{1}, a_{2}\right)\) actions of players \(1\) and \(2\).
➩ This condition is usually difficult to check: another equivalent condition is: \(\left(\pi_{1}, \pi_{2}\right)\) is a mixed strategy Nash equilibrium if \(\mathbb{E}\left[r_{1}\left(\pi_{1}, \pi_{2}\right)\right] \geq \mathbb{E}\left[r_{1}\left(a', \pi_{2}\right)\right]\) for every \(a'\) valid action of player \(1\); and if \(\mathbb{E}\left[r_{2}\left(\pi_{1}, \pi_{2}\right)\right] \geq \mathbb{E}\left[r_{2}\left(\pi_{1}, a'\right)\right]\) for every \(a'\) valid action of player \(2\).
Example
📗 For rock paper scissor game, there is no pure Nash equilibrium, but there is one mixed Nash equilibrium where every player uses each action with probability \(\dfrac{1}{3}\): Link.
📗 The game matrix is:
\(a_{1} \setminus a_{2}\) Rock Paper Scissors
Rock \(0\) \(-1\) \(1\)
Paper \(1\) \(0\) \(-1\)
Scissors \(-1\) \(1\) \(0\)

Nash Equilibrium:
[Note] Use the space to explain the steps or just take notes:

[L21Q5]
 
In-class Quiz ID:
📗 [4 points] Given the following game payoff table, suppose the row player uses a pure strategy, and column player uses a mixed strategy playing L with probability \(q\). What is the smallest and largest value of \(q\) in a mixed strategy Nash equilibrium?
Row \ Col L R
U
D

Note: the following is a diagram of the best responses (make sure you understand what they are and how to draw them). The red curve is the best response for the column player and the blue curve is the best response for the row player.

📗 Answer (comma separated vector): .
[Note] Use the space to explain the steps or just take notes:

[L21Q6]
 
In-class Quiz ID:
📗 [4 points] Given the following BoS (Battle of Sexes) game, what is the row (Romeo) player's (expected) value (i.e. payoff) in the mixed strategy Nash equilibrium?
Romeo \ Juliet Bach Stravinsky
Bach
Stravinsky

📗 Answer: .
[Note] Use the space to explain the steps or just take notes:

[L21Q7]
 
Example
📗 Run vs Pass game: YouTube.



# Nash Theorem

📗 Every finite game has a (possibly mixed) Nash equilibrium: Wikipedia.

# Best Response Dynamics vs Fictitious Play

📗 Best response dynamics starts with random action, and one player at a time use the best response to the other player's actions from the previous iteration.
➩ Time-averages converge to a mixed strategy Nash for zero-sum games.
➩ No result on convergence for general-sum games except for special classes of games such as potential games.
📗 Fictitious play algorithm uses best response to the mixed strategy to the other players' actions in the whole history.
In-class Quiz ID:
📗 [1 points] Given the game , in step \(t\) = , the row player uses action , column player uses action , and fraction of times (including \(t\)) the row player uses each action is , and column player uses is , compute the next step of best response dynamics (row player first) and fictitious play in step \(t + 1\). The actions are \(\left\{0, 1, 2\right\}\) for both players. 

📗 Answer (matrix with multiple lines, each line is a comma separated vector): .
[Note] Use the space to explain the steps or just take notes:

[L21Q8]
 



# Generative Adversarial Networks

📗 Generative adversarial networks (GAN) use two neural networks: Link, Wikipedia.
➩ The generator (deconvolutional neural network): input is noise, output is fake images (or text).
➩ The discriminator (convolutional neural network): input the fake or real image, output is binary class whether the image is real.
➩ The two networks are trained together, or competing in a zero-sum game: the generator tries to maximize the discriminator loss, and the discriminator tries to minimize the same loss: Wikipedia.
➩ The solution to the zero-sum game, Nash equilibrium, is the solution to \(\displaystyle\min_{w^{\left(G\right)}} \displaystyle\max_{w^{\left(D\right)}} C\left(w^{\left(G\right)}, w^{\left(D\right)}\right)\), where \(C\) is the loss of the discriminator.
📗 Example (deepfake) faces generated by GAN: Link, Link, Wikipedia.
In-class Discussion
📗 [1 points] Let the reward function of the two players be \(u_{i}\left(x_{i}, x_{-i}\right) = a x_{i} x_{-i} + \dfrac{b}{2} x_{i}^{2} + \dfrac{b}{2} x_{-i}^{2}\) where \(\left(x_{i}, x_{-i}\right)\) are actions taken by the two players. Move the sliders to change the values of \((a, b)\) so that (simultaneous) gradient ascent-descent will lead to a stable Nash.
a: 0
b: 0


Note: the gradient steps are \(x' = x - \alpha \left(a y + b x\right)\) and \(y' = y - \alpha \left(a x - b y\right)\) with learning rate \(\alpha\).
[L21Q9]
 

# Variational Auto-encoder

📗 Variational auto-encoder is another generative model that maps input into a lowest dimensional latent space (encoder) that can be used to reconstruct the original input (decoder), similar to PCA: Wikipedia, Wikipedia.
➩ An auto-encoder with encoder \(z = E\left(x\right)\) and decoder \(\hat{x} = D\left(z\right)\) minimizes the reconstruction loss \(\left\|x - \hat{x}\right\|^{2}\) = \(\left\|x - D\left(E\left(x\right)\right)\right\|^{2}\).
➩ Unlike regular auto-encoder, for VAE, the latent space (encoder) is forced to look Gaussian \(N\left(0, I\right)\), so it is possible to sample in the latent space, so the encoder is \(\left(\mu, \sigma\right) = E\left(x\right)\) with \(z = \mu + \sigma \varepsilon\) with \(\varepsilon \sim N\left(0, I\right)\): Link
➩ The loss function is regularized by the similarity between the encoding vector \(z\) and a Gaussian distribution: \(\left\|x - \hat{x}\right\| + \lambda KL\left(z, N\left(0, I\right)\right)\), where KL is the Kullback Leibler divergence (relative entropy) between two distributions, \(KL\left(P, Q\right) = \displaystyle\sum_{z} P\left(z\right) \log \dfrac{P\left(z\right)}{Q\left(z\right)}\).
📗 In VAE, \(\left(\mu, \sigma\right) = E\left(x\right)\) is used instead of \(z = E\left(x\right)\) and \(z = \mu + \sigma \varepsilon\) is generated with \(\varepsilon \sim N\left(0, I\right)\) so that every step in the neural network is differentiable (gradient descent can be used). Random sampling operation is not differentiable.
In-class Discussion
📗 [1 points] Click on the diagram on the left to regularize the auto-encoder so that the encoding follows a Gaussian distribution. Click to restart.


[L21Q10]
 



# Diffusion Model

📗 Diffusion model is a generative model that gradually add or remove noise (adding noise is similar to encoder, removing noise is similar to decoder): Wikipedia.
➩ Forward process (add noise): start with original image \(x_{0}\), at each step \(x_{t} = \sqrt{1 - \beta_{t}} x_{t-1} + \sqrt{\beta_{t}} \varepsilon\) where \(\varepsilon \sim N\left(0, I\right)\).
➩ Reverse process (remove noise): network inputs \(\left(x_{t}, t\right)\) and outputs \(\hat{\varepsilon}\) with loss \(\left\|\varepsilon - \hat{\varepsilon}\right\|^{2}\) during training. The the original image can be recovered as \(x_{t} - \hat{\varepsilon}\).
➩ The neural network training is similar to CNN training in supervised learning minimizing the loss by gradient descent.
📗 When generating images, sample \(x_{T} \sim N\left(0, I\right)\), predict \(x_{T-1} = x_{T} - \hat{\varepsilon}\left(x_{T}, T\right)\), and repeat until \(x_{0}\) which recovers the original image.
➩ Conditional diffusion conditions the noise removal process on some condition \(y\), for example, text prompt converted to an embedding vector. In this case, the network takes in \(\left(x_{t}, t, y\right)\) and predicts \(\hat{\varepsilon}\) as a function of \(y\).
Math Note
📗 Noise does not need to be added step by step, the following are equivalent:
➩ \(x_{t} = \sqrt{1 - \beta_{t}} x_{t-1} + \sqrt{\beta_{t}} \varepsilon\)
➩ \(x_{t} = \sqrt{\displaystyle\prod_{s=1}^{t} \left(1 - \beta_{t}\right)} x_{0} + \sqrt{1 - \displaystyle\prod_{s=1}^{t} \left(1 - \beta_{t}\right)} \varepsilon\)
In-class Discussion
📗 [1 points] Upload an image and try diffusion with different parameters: \(\beta\) = and \(t\) = . Image:
. Click on the image to reverse the diffusion process.


[L21Q11]
 

# Stable Diffusion

📗 Running diffusion on pixels is expensive: an (variational) auto-encoder can be used to reduce the dimensions.
➩ Given encoder \(z = E\left(x\right)\) and decoder \(x = D\left(z\right)\), the diffusion networks are applied to \(z_{t} = \sqrt{1 - \beta_{t}} z_{t-1} + \sqrt{\beta_{t}} \varepsilon\).
➩ When generating images, diffusion model turns prompt (text embedding vector) to image in the latent space (image embedding vector), then VAE converts it back to pixels of an image.
📗 During training, VAE is trained first and frozen, then the diffusion model is trained using the output of the VAE encoder.




# Questions?

📗 If you have questions, please (i) Ask during or after the lecture or the break, (ii) Piazza: Link, (iii) Office hours and discussion sessions. Please do NOT use Canvas mail and use email only to the course instructor (not TAs) for grading issues.
Additional In-class Discussion
📗 Sometimes a question not in the notes will be asked during the lecture, you can submit your answer here:

[Notes] (not visible to other students):
[L21Q12]

Submit your answer to see other students answers (click the submit button to refresh): 

Additional In-class Quiz
📗 Sometimes a question not in the notes will be asked during the lecture, you can submit your answer here:
A.
B.
C.
D.
E.
[Notes] (not visible to other students):
[L21Q13]

Submit your answer to see other students answers (click the submit button to refresh): 






# In-class Quiz Instructions

📗 To get full points on the in-class quizzes for a lecture:
➩ Submit relevant answers to the questions discussed during the lecture: incorrect answers are okay.
➩ Some questions require [notes] to earn the point.
➩ Some questions require special ID (given during the lecture) to earn the point.
➩ Do not submit answers to questions that are not discussed during the lectures. Each such submission will result in a deduction of one point.
➩ The grade on Canvas Assignment W21 is computed as number of points divided by the number of questions asked (and multiplied by 4, out of 4) and updated on Canvas every weekend.
📗 Notes and code adapted from the course taught by Professors Jerry Zhu, Blerina Gkotse, Yudong Chen, Yingyu Liang, Charles Dyer. Some content are generated using Copilot .

Prev: L20, Next: L22





Last Updated: November 25, 2026 at 3:04 AM