We study the geometry underlying the difference between non-negative polynomials and sums of squares (SOS). The hypersurfaces that discriminate these two cones for ternary sextics and quaternary quartics are shown to be Noether–Lefschetz loci of K3 surfaces. The projective duals of these hypersurfaces are defined by rank constraints on Hankel matrices. We compute their degrees using numerical algebraic geometry, thereby verifying results due to Maulik and Pandharipande. The non-SOS extreme rays of the two cones of non-negative forms are parametrized, respectively, by the Severi variety of plane rational sextics and by the variety of quartic symmetroids.