8. Given an arithmetic sequence $\left\{a_{n}\right\}$

with common difference $d$ not equal to 0, and a geometric sequence $\left\{b_{n}\right\}$ with common ratio $q$ being a positive rational number less than 1, if $a_{1}=d, b_{1}=d^{2}$, and
$\frac{a_{1}^{2}+a_{2}^{2}+a_{3}^{2}}{b_{1}+b_{2}+b_{3}}$ is a positive integer, then $q=$ $\qquad$
Given $a_{n}=n d, b_{n}=d^{2} q^{n-1}$, let $q=\frac{t}{s}$, where $(t, s)=1$.

Then $\frac{a_{1}^{2}+a_{2}^{2}+a_{3}^{2}}{b_{1}+b_{2}+b_{3}}=\frac{14 d^{2}}{d^{2}\left(1+q+q^{2}\right)}$
$=\frac{14 s^{2}}{s^{2}+s t+t^{2}} \Rightarrow s^{2}+s t+t^{2} \mid 14$, if $s \geqslant 3$, then $s^{2}+s t+t^{2} \geqslant 13$, a contradiction;

Thus, only $s=2, t=1$. Therefore, $q=\frac{1}{2}$.