For a free Dirac fermion of mass $m$ in four dimensions coupled to an external gauge potential $A^\mu(x)$, classical equations of motion for the fermion lead to the equation for the divergence of the axial current $j^\mu_5=\bar{\psi}\gamma^\mu\gamma^5\psi$:

\begin{equation}

\partial_\mu j^\mu_5+2im\bar{\psi}\gamma^5\psi=0

\end{equation}

The corresponding operator equation in the quantum theory receives a correction, the anomaly

\begin{equation}

\partial_\mu j^\mu_5+2im\bar{\psi}\gamma^5\psi=Q

\end{equation}

\begin{equation}

Q=\frac{1}{16\pi^2}\epsilon^{\mu\nu\rho\sigma}F_{\mu\nu}F_{\rho\sigma}

\end{equation}

For theory with many fermions with various masses $M_i$ and chiral charges $q_i$, interacting with gauge potentials with complicated non-diagonal chiral couplings to the fermions $A^\mu_{ij}$, generation is

\begin{equation}

\partial_\mu J^\mu_5+2iM\bar{\psi}\gamma^5\psi=\frac{1}{2}Q

\end{equation}

$Q$ is trace of the chiral charge with the external gauge fields

\begin{equation}

Q=\frac{1}{16\pi^2}tr[q F\cdot\tilde{F}]

\end{equation}

My question is, what it means by taking trace, and why the generation should look like this, why equation gets extra $\frac{1}{2}$ factor before. From my naive understanding, write all masses and charges into column vectors, and the equation becomes equations with $i$ components. Why is the anomaly charge the same for all equtions. Are there some simple examples to understand this?