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 field $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 cohomology group that you denote $\text{ext}^1(\mathbb{L}_f,\mathcal{O}_X)$, and that most mathematicians denote $\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$, that the quotient $k$-vector space $$\frac{\langle x_1,\dots,x_n \rangle^{e+1}\cap I}{\langle x_1,\dots,x_n \rangle^{e+1}\cap \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 $k[[x_1,\dots,x_n]]/\langle x_1,\dots,x_n \rangle^{e+1}\cap I$ that does not extend to a deformation over Spec of $k[[x_1,\dots,x_n]]/\langle x_1,\dots,x_n \rangle^{e+1}\cap \left( \langle x_1,\dots,x_n \rangle I \right)$.
The deformation theory result you note then gives an injection of $k$-vector spaces from the $r$-dimensional quotient vector space to the cohomology group that you denote $\text{ext}^2(\mathbb{L}_f,\mathcal{O}_X)$. Thus, $r$ is less than or equal to the dimension of this group (it can be strictly less, e.g., for deformations of an Abelian variety over a positive characteristic field). By the Krull Hauptidealsatz, the dimension of $k[[x_1,\dots,x_n]]/I$ is at least $n-r$.