4. 181 Find all integer pairs $(a, b)$, where $a \geqslant 1, b \geqslant 1$, and satisfy the equation $a^{b^{2}}=b^{a}$
［Solution］ If $a=1$, then from the equation we get $b=1$.
If $b=1$, then from the equation we get $a=1$.
If $a, b$ are both not less than 2, at this point, we let
$$t=\frac{b^{2}}{a}$$

Then from the equation in the problem, we get
$$\dot{a}^{a t}=(a t)^{\frac{a}{2}},$$

which means $\square$
$$\begin{array}{l}
a^{2 t}=a t \\
t=a^{2 t-1}
\end{array}$$

Obviously, $t>0$. If $2 t-1 \geqslant 1$, then
$$t=a^{2 t-1} \geqslant(1+1)^{2 t-1} \geqslant 1+(2 t-1)=2 t>t$$

Contradiction. Therefore, $2 t-1<1$ and $t<1$. Since $t=\frac{b^{2}}{a}$, $t$ is a rational number. From the equation in the problem, we get
$$\begin{array}{c}
a^{\frac{a}{k}}=b^{a} \\
a=b^{k} \\
b^{2} k=b^{k} \\
k=b^{k-2}
\end{array}$$

which means $\square$

If $k \leqslant 2$, then $k=b^{k-2} \leqslant 1$, which contradicts the previously proven $k>1$. Therefore, $k>2$. Let
$$k=\frac{p}{q}, p, q \in N,(p, q)=1, p>2 q$$

From equation (1), we get
$$\left(\frac{p}{q}\right)^{q}=k^{q}=b^{p-2 q}$$

Since the right side of the above equation is an integer, we have $q=1$, thus $k$ is a natural number greater than 2, i.e.,
$$k \geqslant 3 \text {. }$$

If $b=2$, then from equation (1) we get
$$k=2^{k-2},$$

It is easy to see that $k \neq 3$ at this time, thus $k \geqslant 4$. On the other hand, from equation (1) we know
$$\begin{aligned}
k & =(1+1)^{k-2} \geqslant C_{k-2}^{0}+C_{k-2}^{1}+C_{k-2}^{2} \\
& =1+(k-2)+\frac{(k-2)(k-3)}{2} \\
& =1+\frac{(k-1)(k-2)}{2} \geqslant 1+(k-1)=k
\end{aligned}$$

Since the equality in the above equation holds if and only if $k=4$, we have $k=4$,
$$a=b^{k}=2^{4}=16$$

If $b \geqslant 3$, then
$$k=b^{k-2} \geqslant(1+2)^{k-2} \geqslant 1+2(k-2)=2 k-3$$

which means $\square$
$$k \leqslant 3 \text {. }$$

Therefore, at this time, we must have $k=3$, substituting into (1) we get
$$\begin{aligned}
b & =3 \\
a & =b^{k}=3^{3}=27
\end{aligned}$$

In summary, all positive integer pairs $(a, b)$ that satisfy the equation in the problem are $(a, b)=(1,1),(16, 2), (27,3)$.