Toolformer keeps an inserted call only if it helps. The model's loss on the following words is computed with and without the call and its result, and the call survives only if the loss drops by a margin tau.
Implement keep_call(loss_without, loss_with, tau), returning whether the call is kept.
Compute the reduction loss_without - loss_with and compare it with tau.
No results yet
Run your code to check it against the examples, or submit to run every test.