4. Let $\alpha, \beta, \gamma \in \mathbf{R}$. Then
$$
M=\sin ^{2}(\alpha-\beta)+\sin ^{2}(\beta-\gamma)+\sin ^{2}(\gamma-\alpha)
$$

The maximum value of $M$ is $\qquad$ .
4. $\frac{9}{4}$.
$$
\begin{aligned}
M= & \sin ^{2}(\alpha-\beta)+\sin ^{2}(\beta-\gamma)+\sin ^{2}(\gamma-\alpha) \\
= & \frac{1-\cos 2(\alpha-\beta)}{2}+\frac{1-\cos 2(\beta-\gamma)}{2}+ \\
& \frac{1-\cos 2(\gamma-\alpha)}{2} \\
= & \frac{3}{2}-\frac{1}{2}[\cos 2(\alpha-\beta)+ \\
& \cos 2(\beta-\gamma)+\cos 2(\gamma-\alpha)] \\
= & \frac{3}{2}-\frac{1}{2}(\cos 2 \alpha \cdot \cos 2 \beta+\cos 2 \beta \cdot \cos 2 \gamma+ \\
& \cos 2 \gamma \cdot \cos 2 \alpha+\sin 2 \alpha \cdot \sin 2 \beta+ \\
& \sin 2 \beta \cdot \sin 2 \gamma+\sin 2 \gamma \cdot \sin 2 \alpha) \\
= & \frac{3}{2}-\frac{1}{4}\left[(\cos 2 \alpha+\cos 2 \beta+\cos 2 \gamma)^{2}+\right. \\
& \left.\quad(\sin 2 \alpha+\sin 2 \beta+\sin 2 \gamma)^{2}-3\right] \\
\leqslant & \frac{3}{2}+\frac{3}{4}=\frac{9}{4} .
\end{aligned}
$$

When and only when $\left\{\begin{array}{l}\cos 2 \alpha+\cos 2 \beta+\cos 2 \gamma=0, \\ \sin 2 \alpha+\sin 2 \beta+\sin 2 \gamma=0\end{array}\right.$,
the above inequality can achieve equality.
Thus, $M_{\max }=\frac{9}{4}$.