tensorflow / tensorflow/recommenders

About using label smoothing

Open
#489 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
300
PR merge metrics
No merged PRs in 30d

Description

Hello,

while training my retrieval model I used categorical cross entropy with label smoothing as my loss function in order not to punish high scores on (user, item) pairs that might be false negatives. When trying to combine it with the candidate_ids to remove accidental hits I got very high loss values.

By looking at your code I realized that this is due to the fact that RemoveAccidentalHits sets these "hits" to the lowest possible value (as log(x) tends to minus infinity as x tends to 0). However, when using label smoothing the way to remove these accidental hits is not by setting these values to be close to minus infinity but to the logarithm of label_smoothing/n_samples

I made a quick fix by myself but maybe you should consider this question.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names RemoveAccidentalHits but no file or test. Start by tracing that component and how candidate_ids interact with categorical cross entropy and label smoothing. Confirm the expected accidental-hit behavior and add the corresponding regression coverage; the issue does not provide a concrete acceptance criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.