Lightning-AI / Lightning-AI/litgpt

Question about tie_embeddings

Open
#1,727 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted question
Dominant language
Python
Stars
13.7k
Forks
1.5k
Avg merge
15h 37m
Merged PRs (30d)
1

Description

I have a couple of questions about tie_embeddings but I don't have enough experience with lightning. I'm sorry if I'm mistaken.

  1. In litgpt/pretrain.py, model.transformer.wte.weight = model.lm_head.weight is applied when tie_embeddings is true.
    In my observation, after training, lm_head.weight have tuned parameters while transformer.wte.weight is kept unchanged in the checkpoint file.
    However, in litgpt/scripts/convert_lit_checkpoint.py, transformer.wte.weight is saved while lm_head.weight is skipped.
    So, I'm suspecting conversion to huggingface format is incorrect.

  2. How to enable tie_embedding for finetune_full? Using the same way as pretrain is not effective?

  3. Is it better to move tie_embedding from train config to model config? There are many chances to mistake setting of tie_embeddings such as finetuning non-tied pretrained as tied, and vice versa.

Thank you for everything.

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

Start by reading litgpt/pretrain.py and litgpt/scripts/convert_lit_checkpoint.py to trace how tied weights are assigned and which checkpoint key is converted. Then inspect the finetune_full entry point and related train/model configuration handling. Done means establishing whether conversion preserves tied embeddings and documenting or implementing consistent behavior for pretraining and finetuning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
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.