Suppose $X$ is a smooth projective variety defined over $\mathbb{Q}$, and the pure Hodge structure on $H^{2n}(X)$ is of a very simple form, \begin{equation} \mathbb{Q}(-n)^{b^{2n}} \end{equation} where $b^{2n}$ is just $\text{dim}\,H^{2n}(X)$. Under what conditions is the etale cohomology $H^{2n}_{et}(X,\mathbb{Q}_{\ell})$ also isomorphic to \begin{equation} \mathbb{Q}_{\ell}(-n)^{b^{2n}} \end{equation} as representations of $\text{Gal}(\overline{\mathbb{Q}}/\mathbb{Q})$?

This is however not always true, consider a smooth quadratic surface $S$ of $\mathbb{P}^3_{\mathbb{Q}}$ defined by a quadratic polynomials with determinant say 7. Then the Hodge structure on $H^2(S)\simeq H^2 (\mathbb{P}^1 \times \mathbb{P}^1)$ is $\mathbb{Q}(-1)^{2}$, while $H^{2}_{et}(S,\mathbb{Q}_{\ell})$ is \begin{equation} \mathbb{Q}_{\ell}(-1)^{2} \otimes \chi \end{equation} where $\chi$ is a Dirichlet character.