This lecture covers the cavity method and Approximate Message Passing, exploring their applications in various probabilistic models such as stochastic block model, compressed sensing, and sparse principal component analysis. It delves into the challenges and solutions related to phase transitions and critical phenomena, with a focus on thermodynamic potentials and spinodal transitions.