NVIDIA-Merlin / Transformers4Rec

Transformers4Rec is a flexible and efficient library for sequential and session-based recommendation and works with PyTorch.
https://nvidia-merlin.github.io/Transformers4Rec/main
Apache License 2.0
1.08k stars 142 forks source link

Fix the CLM performance mismatch between evaluation and manual inference #723

Closed sararb closed 1 year ago

sararb commented 1 year ago

Fixes #719

Goals :soccer:

The current CLM strategy is as follows image The main issues of the current implementation are:

Implementation Details :construction:

Fix the evaluation on last item by not masking the past information eval_/next-item/recall_at_10 = 0.2980385422706604 Recall@10 of manually masked test data = 0.29812381188527975



### Testing Details :mag:
- Changed `test_mask_only_last_item_for_eval` to get target mask information from `lm.masked_targets` 
- Changed `test_sequential_tabular_features_ignore_masking` as the inference mode of CLM is changing the inputs by replacing `0` padded positions with  [MASK] embeddings

## Future work 
- The [MASK] embeddings is not used to generate the next-item prediction scores and this raises a question about whether we should remove it and just use `0`-embedding to represent padded positions. 
==> We need to re-run T4Rec paper experiments without [MASK] variable and check how the evaluation results are impacted. 
github-actions[bot] commented 1 year ago

Documentation preview

https://nvidia-merlin.github.io/Transformers4Rec/review/pr-723