There are specific mineral records that covary strongly with CO2 levels over that 400,000 year period. However, these mineral records go back millions of years - therefore, we can use the known relationship to predict how CO2 levels have changed in the past. These are known as "proxies" in paleoclimatology, and can be used to estimate past CO2 levels, O2 levels, temperature, and other attributes of Earth's climate. When multiple independent proxy estimates agree with each other, we can somewhat safely assume we are not too off-target. This field is constantly getting updated, but these proxies are usually in decently good agreement with each other. I think that the paper below is a good overview of the science involved. I'm not an expert in the field but this paper is from 2006 and likely now the field has added some more accurate proxy paleo-CO2 reconstructions.
http://droyer.web.wesleyan.edu/PhanCO2%28GCA%29.pdf