lichess.org/blog/U4sjakQAAEAAhH9d/how-training-puzzles-are-generatedA line that gains adequate material in a reasonable amount of time is a solution.
A line is complete when no more material can be gained; the player is no longer in check; there is no threat of being mated, and no more material can be captured.
Alternate solutions are lines that also gain material in adequate time, and are within 10% of the top move's evaluation.
Moves that are within 20% of the top move's evaluation are given re-attempts.
___________________________________________________________________________________________
The computer line (2...b3 3. Ra1 Qg6 4. e4 Nxe4 5. Bxh6 with a perpetual to follow) actually has White sacrificing the material (and more) back already on moves 4 and 5, so as far as the generator knows, Nf6+ doesn't even win material.
Note that the number of moves it takes to win the material isn't a factor as long as it's within "a reasonable amount of time" (though if you can win a rook in 2 moves vs. 6, it's entirely possible that the former will gain more material by move 6 and therefore evaluate much higher).