They carry the heat away and reduce the risk of premature detonation, often caused by the hot exhaust valves (intakes are generally cooled by the incoming air)
The Sodium liquifies, which takes out a lot of heat but it also allows the valve to cool more effectively by running more heat up the shaft to the valves bed where it is cooled.