Is there a function $f$ such that for any presentation $$G=\langle x_1,\ldots,x_n \mid r_1,\ldots,r_k\rangle\quad \text{with}\quad |r_i|\leq 3$$

$k\leq f(n)$ implies that $G$ has non-abelian free subgroups.

Of course $f=0$ works trivially, I am asking for bigger functions.