EduKTM
EduKTM copied to clipboard
[BUGFIX] Fix inplace masking for AKT to prevent data leakage
Summary
Fixes #52 - Change masked_fill to masked_fill_ (in-place operation) on line 273 to prevent data leakage from future time steps in the AKT attention mechanism.
Problem
The non-in-place version masked_fill() creates a new tensor without modifying the original. Since the result was not assigned back to the scores variable, the masking had no effect, potentially allowing the model to peek at future responses during training.
Solution
Use the in-place variant masked_fill_() which properly modifies the tensor to enforce temporal masking.
Changes
-
EduKTM/AKT/AKTNet.py:273:scores.masked_fill→scores.masked_fill_