4. As shown in Figure $3, A B$ is the diameter of a semicircle, points $P$ and $Q$ are on the semicircle, $P E \perp A B$ at $E, Q F \perp A B$ at $F$. If $A P \cdot A Q=E F \cdot A B$, then $\frac{A E}{E F}=$ $\qquad$ .
4. $\frac{\sqrt{5}-1}{2}$.

It is known that $A P^{2}=A E \cdot A B, A Q^{2}=A F \cdot A B$.
Therefore, $(A P \cdot A Q)^{2} A A E \cdot A F \cdot A B^{2}$.
And it is given that $A P \cdot A Q=E F \cdot A B$, thus,
$$
E F^{2}=A E \cdot A F \text {. }
$$

Hence, point $E$ is the golden section of $A F$ $(E F>A E)$.
So, $\frac{A E}{E F}=\frac{E F}{A F}=\frac{\sqrt{5}-1}{2}$.