EduKTM icon indicating copy to clipboard operation
EduKTM copied to clipboard

[BUGFIX] Fix inplace masking for AKT to prevent data leakage

Open AutoVision-cloud opened this issue 2 months ago • 0 comments

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_fillscores.masked_fill_

AutoVision-cloud avatar Oct 26 '25 13:10 AutoVision-cloud