Suppose we have a set of $N_T$ maturities $\tau_t$ and a set of $N_k$ strikes $K_k$ .For each maturity-strike combination $(\tau_t,K_k)$ we have a market price (for example) $Caplet(\tau_t,K_k)=C_{tk}$ and a corresponding model price $Caplet(\tau_t,K_k,\Lambda)=C^\Lambda_{tk}$ in which $\Lambda$ is Hull-Whit's Parameters. The first category minimize the error between
quoted and model prices The error is usually defined as the squared difference between the quoted and model prices, or the absolute value of the difference; relative errors can also be used. For example, parameter estimates obtained using the mean error sum of squares (MSE) loss function are obtained by minimizing
$$\frac{1}{N}\sum\limits_{t=1}^{{{N}_{T}}}{\sum\limits_{k=1}^{{{N}_{K}}}{{{w}_{t,k}}}}{{({{C}_{t,k}}-C_{t,k}^{\Lambda })}^{2}}\ ,\ \ N={{N}_{T}}\times {{N}_{K}}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,(1)$$
$\omega_{tk}$ is weight parameter.
The second category are those that minimize the error between
quoted and model implied volatilities. Again, the error is usually defined as the squared difference, absolute difference, or relative difference, between quoted and model implied volatilities:
$$\frac{1}{N}\sum\limits_{t=1}^{{{N}_{T}}}{\sum\limits_{k=1}^{{{N}_{K}}}{{{w}_{t,k}}}}{{(I{{V}_{t,k}}-IV_{t,k}^{\Lambda })}^{2}}\ \ ,\ \ N={{N}_{T}}\times {{N}_{K}}\,\,\,\,\,\,\,\,\,\,\,\,\,(2)$$
The main disadvantage of Equation (2) is that it is numerically intensive.Indeed, at each iteration of the optimization, we must first obtain every Caplet Price and then apply a root-finding algorithm such as the bisection algorithm to extract the implied volatility $IV_{t,k}^{\Lambda }$ from $C_{t,k}^{\Lambda }$.
I hope it will be useful for you.