Electric-field-induced charge separation (polarization) is the most fundamental manifestation of the interaction of light with matter and a phenomenon of great technological relevance. Nonlinear optical polarization1,2produces coherent radiation in spectral ranges inaccessible by lasers and constitutes the key to ultimate-speed signal manipulation. Terahertz techniques3,4,5,6,7,8have provided experimental access to this important observable up to frequencies of several terahertz9,10,11,12,13. Here we demonstrate that attosecond metrology14extends the resolution to petahertz frequencies of visible light. Attosecond polarization spectroscopy allows measurement of the response of the electronic system of silica to strong (more than one volt per ångström) few-cycle optical (about 750 nanometres) fields. Our proof-of-concept study provides time-resolved insight into the attosecond nonlinear polarization and the light-matter energy transfer dynamics behind the optical Kerr effect and multi-photon absorption. Timing the nonlinear polarization relative to the driving laser electric field with sub-30-attosecond accuracy yields direct quantitative access to both the reversible and irreversible energy exchange between visible-infrared light and electrons. Quantitative determination of dissipation within a signal manipulation cycle of only a few femtoseconds duration (by measurement andab initiocalculation) reveals the feasibility of dielectric optical switching at clock rates above 100 terahertz. The observed sub-femtosecond rise of energy transfer from the field to the material (for a peak electric field strength exceeding 2.5 volts per ångström) in turn indicates the viability of petahertz-bandwidth metrology with a solid-state device.