Physical meaning of partition function in QFT

The partition function $Z[J]$, both in QM and in CM, is underdetermined: any multiple of $Z[J]$ gives rise to the same dynamics. This means that $Z[0]$ is arbitrary, and is usually set to one: $$ Z[0]\equiv 1 \tag{1} $$ effectively getting rid of vacuum diagrams, that is, we set $H|\Omega\rangle=0$. In other words: the energy of the vacuum is not measurable and can be set to any number we want. We can only measure differences in energies (except in GR), which means that a constant offset of energies is irrelevant.

The matrix element $$ \langle 0,t_f|0,t_i\rangle \tag{2} $$ can be interpreted as the amplitude of ending up with a vacuum state at the time $t_f$ if you start with vacuum at a time $t_i$. Or put it another way, it is the amplitude to get nothing if you initially have nothing. This number is, naturally, one: $$ \langle 0,t_f|0,t_i\rangle\equiv 1 \tag{3} $$ in agreement with $(1)$.


In terms of Feynman diagrams, the partition is represented by the sum over so-called vacuum bubbles - diagrams with no external legs. In formulae and in terms of the interaction picture and the free vacuum $\lvert 0 \rangle$ and the interacting vacuum $\lvert \Omega \rangle$, we have that $$ \lvert \Omega\rangle = \lim_{T\to\infty(1-\mathrm{i}\epsilon)} \left(\mathrm{e}^{-\mathrm{i}E_\Omega T}\langle\Omega \vert 0\rangle\right)^{-1}\mathrm{e}^{-\mathrm{i}H T}\lvert 0 \rangle$$ and hence $$ Z = \langle \Omega \vert \Omega\rangle = \lim_{T\to\infty(1-\mathrm{i}\epsilon)} \lvert \langle \Omega\vert 0 \rangle\rvert^2\mathrm{e}^{\mathrm{i}E_\Omega 2T}$$ Now, if you write $Z$ as $\mathrm{e}^{\sum_i V_i}$ where $V_i$ is the contribution of the vacuum bubbles of order $i$, you see that, schematically, $\sum_i V_i \propto E_\Omega T$, so the partition function is the exponential of the vacuum energy.

Heuristically, it should not be surprising that the logarithm of the partition function is the vacuum energy, since $Z \sim \langle 0 \rvert\mathrm{e}^{-\mathrm{i}\int H} \vert 0 \rangle$ so $\ln(Z) \sim \langle 0\vert T \int H \vert 0 \rangle$.