Spin glasses are models of statistical mechanics encoding disordered interactions between many simple units. One of the fundamental quantities of interest is the free energy of the model, in the limit when the number of units tends to infinity. For a restricted class of models, this limit was predicted by Parisi, and later rigorously proved by Guerra and Talagrand. I will first show how to rephrase this result using an infinite-dimensional Hamilton-Jacobi equation. I will then present partial results suggesting that this new point of view may allow to understand limit free energies for a larger class of models, focusing in particular on the case in which the units are organized over two layers, and only interact across layers.