2. Let $a_{1}=1, a_{n+1}=2 a_{n}+n^{2}$, then the general term formula $a_{n}$ $=$ $\qquad$
$$
2.7 \times 2^{n-1}-n^{2}-2 n-3 .
$$

Let $a_{n}=b_{n}+s n^{2}+t n+k$ (where $s$, $t$, and $k$ are constants to be determined). Then
$$
\begin{array}{l}
b_{n+1}+s(n+1)^{2}+t(n+1)+k \\
=2 b_{n}+2 s n^{2}+2 t n+2 k+n^{2},
\end{array}
$$

which simplifies to
$$
\begin{array}{l}
b_{n+1}=2 b_{n}+(s+1) n^{2}+(t-2 s) n+k-t-s . \\
\text { Let } \left\{\begin{array} { l } 
{ s + 1 = 0 , } \\
{ t - 2 s = 0 . } \\
{ k - t - s = 0 . }
\end{array} \text { Solving, we get } \left\{\begin{array}{l}
s=-1, \\
t=-2, \\
k=-3 .
\end{array}\right.\right. \\
\text { Then } \left\{\begin{array}{l}
b_{1}=7, \\
b_{n+1}=2 b_{n}=2^{2} b_{n-1}=\cdots=7 \times 2^{n} .
\end{array}\right.
\end{array}
$$

Therefore, $b_{n}=7 \times 2^{n-1}$.
Hence, $a_{n}=7 \times 2^{n-1}-n^{2}-2 n-3$.