Given a finite group G and a field K, the faithful dimension of G over K is defined to be the smallest integer n such that G embeds into GL n (K). We address the problem of determining the faithful dimension of a p-group of the form G q := exp(g ⊗ Z F q ) associated to g q := g ⊗ Z F q in the Lazard correspondence, where g is a nilpotent Z-Lie algebra which is finitely generated as an abelian group. We show that in general the faithful dimension of 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 N by sets from the Boolean algebra generated by arithmetic progressions, such on each part the faithful dimension of 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.