Ab initio techniques are used to calculate the effective work function (Weff) of a TiN/HfO2/SiO2/Si stack representing a metal-oxide-semiconductor (MOS) transistor gate taking into account first order many body effects. The required band offsets were calculated at each interface varying its composition. Finally the transitivity of LDA calculated bulk band lineups were used and completed by MBPT bulk corrections for the terminating materials (Si and TiN) of the MOS stack. With these corrections the ab initio calculations predict a Weff of a TiN metal gate on HfO2 to be close to 5.0 eV.