It is well know that the integral versions of the Hodge and Tate conjectures can fail. I once heard an off hand comment however that they should only fail by a "bounded amount". My question is what this means and whether this can be made more precise.

Let $\pi: X \to B$ be a smooth projective morphism of smooth varieties over $\mathbb{C}$. Assume that the (usual rational) Hodge conjecture holds for the fibre $B_x$ over every point $x \in B(\mathbb{C})$. Does there exist an integer $d$ such that for any integral Hodge class $h$ on $B_x(\mathbb{C})$, the class $dh$ is represented by an algebraic cycle for all $x \in B(\mathbb{C})$?

Of course the point of this question is whether $d$ can be chosen uniformly with respect to the family.

As a brief remark, it is quite easy to prove this when $B={\mbox{Spec}}\ \mathbb{C}$. Indeed, by assumption the algebraic classes form a subgroup of finite index inside the Hodge classes!

I am also similarly interested in the analogous question for the integral Tate conjecture for families of varieties over number fields and finite fields.