deepseek-ai / deepseek-ai/DeepSeek-Coder

Are EOS tokens masked during pre-training? If so, how does FIM mode know how to connect to the `text_after`?

Open
#163 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
24.3k
Forks
2.9k
PR merge metrics
No merged PRs in 30d

Description

As far as we can tell in the fine tuning scripts, and from other issues, because PAD = EOS in this model, and all PAD tokens are masked out, the model is never trained to predict the EOS token.

If the base model is pretrained in this fashion, for FIM, this means that the model should have problems connecting the middle generation to the text_after, and indeed we see in our experiments that in a majority of cases, the model eventually ends up in an infinite loop, outputting the same line of code repeatedly.

However, sometimes the model does accurately predict to stop with an EOS token.

I'm wondering: how can both these behaviors be explained?

  • How is the masking handled during pretraining for FIM examples? Is the first EOS token unmasked so that the model can learn to predict EOS?
  • If the answer to the above is no, then how is the model still able to correctly output EOS in some cases when prompted with FIM examples?

Contributor guide

No contributing guide indexed for this repository

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

Start by reading the fine tuning scripts and tracing how PAD and EOS tokens are masked in FIM examples. Compare that behavior with the reported infinite-loop experiments; done means explaining how masking, text_after connection, and occasional EOS predictions can coexist.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.