Using flexible Poisson regressions, we analyse a huge micro‐level lifetime dataset from a Dutch pension fund, including categorical, continuous and spatial risk factors collected on participants in the fund. The availability of granular lifetime data allows us to quantify the longevity gap between the national population and the fund on the one hand, and between participants within the fund on the other hand. We identify the most important risk factors using statistical criteria that measure the in‐ and out‐of‐sample performance of the regression models. We evaluate the financial performance of the models by introducing a novel type of backtest, which selects the risk factors that contribute most to an accurate prediction of future pension liabilities. For this portfolio, the most relevant risk factors (next to age and gender) are the salary, the time spent in disability and working at irregular hours. The resulting personalized mortality risk profiles show substantial differences between the remaining life expectancies for the most‐favourable and least‐favourable risk profiles. Our method to estimate these longevity gaps will help policymakers to assess wanted and unwanted consequences of longevity risk sharing in pension schemes.