4. Let $a>0, a \neq 1$. If the graph of the inverse function of $y=a^{x}$ passes through the point $\left(\frac{\sqrt{2}}{2},-\frac{1}{4}\right)$, then $a=(\quad)$.
(A) 16
(B) 4
(C) 2
(D) $\sqrt{2}$
4. B.

From the problem, we know that the graph of the function $y=a^{x}$ passes through the point $\left(-\frac{1}{4}, \frac{\sqrt{2}}{2}\right)$, i.e., $a^{-\frac{1}{4}}=\frac{\sqrt{2}}{2}$.