This is too long for a comment. You need some sort of hypothesis to get the existence of a versal deformation space for morphisms $f$. The most common hypothesis is that $X$ is proper over your field $k$. In that case, Schlessinger gives a versal formal deformation over Spf of a power series $k$-algebra, $k[[x_1,\dots,x_n]]/I$, where $I$ is an ideal in $\langle x_1,\dots,x_n \rangle^2$. The integer $n$ equals the dimension that you denote $\text{ext}^1(\mathbb{L}_f,\mathcal{O}_X)$, i.e., $\text{dim}_k \mathbb{E}\text{xt}^1_{\mathcal{O}_X}(\mathbb{L}_f,\mathcal{O}_X)$. If $f_1,\dots,f_r$ is a minimal set of generators of $I$, then $I/\langle x_1,\dots,x_n\rangle I$ is a free $k$-vector space with basis $\overline{f}_1,\dots,\overline{f}_n$. Use Krull's Intersection Theorem to see that for sufficiently large integers $e$, the quotient $k$-vector space $$\frac{\langle x_1,\dots,x_n \rangle^{e+1}+ I}{\langle x_1,\dots,x_n \rangle^{e+1}+ \left( \langle x_1,\dots,x_n \rangle I\right) }$$ also has basis $\overline{f}_1,\dots,\overline{f}_r$. Now consider the formal deformation over Spec of the quotient $k$-algebra $k[[x_1,\dots,x_n]]/\left(\langle x_1,\dots,x_n \rangle^{e+1}+ I\right)$ of $k[[x_1,\dots,x_n]]/\left(\langle x_1,\dots,x_n \rangle^{e+1} + \left( \langle x_1,\dots,x_n \rangle I \right)\right)$ that does not extend to a deformation over any intermediate quotient. The deformation theory result you note then gives an injection of $k$-vector spaces from the $r$-dimensional quotient vector space above to the $k$-vector space dual of $\mathbb{E}\text{xt}^2_{\mathcal{O}_X}(\mathbb{L}_f,\mathcal{O}_X)$. Thus, $r$ is less than or equal to the $k$-vector space dimension $\text{ext}^2(\mathbb{L}_f,\mathcal{O}_X)$ of this $k$-vector space (it can be strictly less, e.g., for deformations of an Abelian variety of dimension $>1$ over $Y=\text{Spec}\ k$). By the Krull Hauptidealsatz, the dimension of $k[[x_1,\dots,x_n]]/I$ is at least $n-r$.