12. The maximum value of the function $S=\sqrt{x^{4}-5 x^{2}-8 x+25}-\sqrt{x^{4}-3 x^{2}+4}$ is
12. $\sqrt{17}$
$S=\sqrt{(x-4)^{2}+\left(x^{2}-3\right)^{2}}-\sqrt{x^{2}+\left(x^{2}-2\right)^{2}}$, its geometric meaning is the maximum value of the difference in distances from a moving point $M(x, y)$ on the parabola $y=x^{2}$ to the fixed points $A(4,3), B(0,2)$. It is easy to know that $S=|M A|-|M B| \leqslant|A B|=\sqrt{17}$, and the equality can be achieved, so the maximum value of $S$ is $\sqrt{17}$.