  Given a finite group $\mathrm{G}$ and a field $K$, the faithful dimension of
$\mathrm{G}$ over $K$ is defined to be the smallest integer $n$ such that
$\mathrm{G}$ embeds into $\mathrm{GL}_n(K)$. In this paper we address the
problem of determining the faithful dimension of a $p$-group of the form
$\mathscr{G}_q:=\exp(\mathfrak{g} \otimes_\mathbb{Z}\mathbb{F}_q)$ associated
to $\mathfrak{g}_q:=\mathfrak{g} \otimes_\mathbb{Z}\mathbb{F}_q$ in the Lazard
correspondence, where $\mathfrak{g}$ is a nilpotent $\mathbb{Z}$-Lie algebra
which is finitely generated as an abelian group. We show that in general the
faithful dimension of $\mathscr{G}_p$ is a piecewise polynomial function of $p$
on a partition of primes into Frobenius sets. Furthermore, we prove that for
$p$ sufficiently large, there exists a partition of $\mathbb{N}$ by sets from
the Boolean algebra generated by arithmetic progressions, such on each part the
faithful dimension of $\mathscr{G}_q$ for $q:=p^f$ is equal to $f g(p^f)$ for a
polynomial $g(T)$. We show that for many naturally arising $p$-groups,
including a vast class of groups defined by partial orders, the faithful
dimension is given by a single formula of the latter form. The arguments rely
on various tools from number theory, model theory, combinatorics and Lie
theory.
