  Given a finitely generated module $M$ over a commutative local ring (or a
standard graded $k$-algebra) $(R,\m,k) $ we detect its complexity in terms of
numerical invariants coming from suitable $\m$-stable filtrations $\mathbb{M}$
on $M$. We study the Castelnuovo-Mumford regularity of $gr_{\mathbb{M}}(M) $
and the linearity defect of $M,$ denoted $\ld_R(M),$ through a deep
investigation based on the theory of standard bases. If $M$ is a graded
$R$-module, then $\reg_R(gr_{\mathbb{M}}(M)) <\infty$ implies
$\reg_R(M)<\infty$ and the converse holds provided $M$ is of homogenous type.
An analogous result can be proved in the local case in terms of the linearity
defect. Motivated by a positive answer in the graded case, we present for local
rings a partial answer to a question raised by Herzog and Iyengar of whether
$\ld_R(k)<\infty$ implies $R$ is Koszul.
