12. Definition: The length of the interval $\left[x_{1}, x_{2}\right]\left(x_{1}<x_{2}\right)$ is $x_{2}-x_{1}$. Given that the domain of the function $y=\left|\log _{\frac{1}{2}} x\right|$ is $[a, b]$, and the range is $[0,2]$. Then the difference between the maximum and minimum values of the length of the interval $[a, b]$ is $\qquad$.
12.3.

The graphs of the functions $y=$ $\left|\log _{\frac{1}{2}} x\right|$ and $y=2$ are shown in Figure 7.
From $y=0$, we get $x=1$;
From $y=2$, we get $x=\frac{1}{4}$ or $x=4$.

When $a=\frac{1}{4}, b=1$, $(b-a)_{\text {min }}=\frac{3}{4}$;
When $a=\frac{1}{4}, b=4$, $(b-a)_{\max }=\frac{15}{4}$.
Therefore, $(b-a)_{\max }-(b-a)_{\min }=3$.