The objective of the refinement process is to find equilibrium constant values that give the best fit to the experimental data. This is usually achieved by minimising an objective function, , by the method of non-linear least-squares. First the residuals are defined as
Then the most general objective function is given by
The matrix of weights, , should be, ideally, the inverse of the variance-covariance matrix of the observations. It is rare for this to be known. However, when it is, the expectation value of U is one, which means that the data are fitted within experimental error. Most often only the diagonal elements are known, in which case the objective function simplifies to
with  when . Unit weights, , are often used but, in that case, the expectation value of  is the root mean square of the experimental errors.
The minimization may be performed using the Gauss–Newton method. Firstly the objective function is linearised by approximating it as a first-order Taylor series expansion about an initial parameter set, .
The increments  are added to the corresponding initial parameters such that  is less than . At the minimum the derivatives , which are simply related to the elements of the Jacobian matrix, 
where  is the th parameter of the refinement, are equal to zero. One or more equilibrium constants may be parameters of the refinement. However, the measured quantities (see above) represented by  are not expressed in terms of the equilibrium constants, but in terms of the species concentrations, which are implicit functions of these parameters. Therefore, the Jacobian elements must be obtained using implicit differentiation.
The parameter increments  are calculated by solving the normal equations, derived from the conditions that  at the minimum.
The increments  are added iteratively to the parameters
where  is an iteration number. The species concentrations and  values are recalculated at every data point. The iterations are continued until no significant reduction in  is achieved, that is, until a convergence criterion is satisfied. If, however, the updated parameters do not result in a decrease of the objective function, that is, if divergence occurs, the increment calculation must be modified. The simplest modification is to use a fraction, , of calculated increment, so-called shift-cutting.
In this case, the direction of the shift vector, , is unchanged. With the more powerful Levenberg–Marquardt algorithm, on the other hand, the shift vector is rotated towards the direction of steepest descent, by modifying the normal equations, 
where  is the Marquardt parameter and  is an identity matrix. Other methods of handling divergence have been proposed.
A particular issue arises with NMR and spectrophotometric data. For the latter, the observed quantity is absorbance, , and the Beer–Lambert law can be written as
It can be seen that, assuming that the concentrations, c, are known, that absorbance, , at a given wavelength, , and path length , is a linear function of the molar absorbptivities, . With 1 cm path-length, in matrix notation
There are two approaches to the calculation of the unknown molar absorptivities
:(1) The  values are considered parameters of the minimization and the Jacobian is constructed on that basis. However, the  values themselves are calculated at each step of the refinement by linear least-squares:
:using the refined values of the equilibrium constants to obtain the speciation. The matrix
:is an example of a pseudo-inverse.
:Golub and Pereyra showed how the pseudo-inverse can be differentiated so that parameter increments for both molar absorptivities and equilibrium constants can be calculated by solving the normal equations.
:(2) The Beer–Lambert law is written as
:The unknown molar absorbances of all "coloured" species  are found by using the non-iterative method of linear least-squares, one wavelength at a time. The calculations are performed once every refinement cycle, using the stability constant values obtaining at that refinement cycle to calculate species' concentration values in the matrix .