The formula (3) does not work in general, it only works for fermions. You need to use the fact that $n_\uparrow,n_\downarrow\in\{0,1\}^2$. You therefore just need to check whether you can tune $a$ so that the RHS and LHS coincide for the four possible values. In practice, any function of $f(n_\uparrow,n_\downarrow)$ can be uniquely parametrised in terms of four coefficients $J,h_\uparrow,h_\downarrow,f_0$: $$ f(n_\uparrow,n_\downarrow) = Jn_\uparrow n_\downarrow+h_\uparrow n_\uparrow+h_\downarrow n_\downarrow+f_0 \\ f_0= f(0,0) \quad h_\uparrow = f(1,0)-f(0,0) \quad h_\downarrow = f(0,1)-f(0,0) \quad J = f(1,1)-f(0,1)-f(1,0)+f(0,0) $$ You can apply this to: $$ \begin{align} \ln\left(\frac12\sum_{\sigma=\pm}e^{\lambda\sigma(n_\uparrow-n_\downarrow)}\right) &= \ln[\cosh(\lambda(n_\uparrow-n_\downarrow))] \\ &= \begin{cases} 0 & n_\uparrow=n_\downarrow \\ \ln(\cosh\lambda) & n_\uparrow+n_\downarrow=1 \end{cases} \\ &= -2\ln(\cosh\lambda)n_\uparrow n_\downarrow+\ln(\cosh\lambda) n_\uparrow+\ln(\cosh\lambda) n_\downarrow \\ \end{align} $$ So you identify: $$ -2\ln\cosh\lambda = \Delta\tau U $$$$ -2\ln\cosh\lambda = \Delta\tau U \\ \cosh(\lambda) = e^{\Delta\tau U/2} $$ and recover (1) without the constant term. Note that (2) is not quite correct, due to this unimportant forgotten constant term. However (3) is exact. You can apply the same method. Alternatively, you can replace $\lambda=2a$. The formulas match using the hyperbolic formulas: $$ \tanh(2a) = \frac{2\tanh a}{1-\tanh^2a} $$$$ \begin{align} \cosh(2a) &= e^{\Delta\tau U/2} \\ \cosh(2a) &= \frac{1+\tanh^2a}{1-\tanh^2a} \\ \tanh^2a &= \frac{1-e^{\Delta\tau U/2}}{1+e^{\Delta\tau U/2}}\\ &=\tanh\left(\frac{\Delta\tau U}4\right) \end{align} $$