12. The geometric sequence $\left\{a_{n} \mid\right.$ satisfies $\lim _{n \rightarrow+\infty} \sum_{i=1}^{n} a_{4}=4, \lim _{n \rightarrow+\infty} \sum_{i=1}^{n} a_{i}^{2}=8$, then the common ratio $q=$
12. $\frac{1}{3}$

From the problem, we have
$$
\begin{array}{c}
\frac{a_{1}}{1-q}=4 \\
\frac{a_{1}^{2}}{1-q^{2}}=8
\end{array}
$$
$$
\text { (1) }^{2} \div(2) \text { gives } \frac{1-q^{2}}{(1-q)^{2}}=2 \text {, i.e., } \frac{1+q}{1-q}=2 \text {. }
$$

Therefore, $q=\frac{1}{3}$.