Skip to content

Evaluation loss becomes constant #1067

Closed

Description

@magjense

Hi!

I am testing out unsloth to fine tune llama 3.1 8B instruct and following your notebook here.

One exception is that I have added an eval set. What is really strange is that the eval loss locks up to a specific value after around 300 steps. I mean down to the last decimal, not just flattening out. The training loss looks fine and as expected.

I have changed many parameters and tried different things but it always happens. Any idea on what can cause this?

image image

Activity

  1. danielhanchen commented on Oct 1, 2024

    @danielhanchen
    Member

    Sorry on the delay - that is very strange - it could be sheer coincidence, or maybe the eval dataset isn't shuffled?

  2. magjense commented on Oct 1, 2024

    @magjense
    Author

    Hi! The eval dataset is shuffled and it happens regardless of what I do. It seems to happen in the first eval after the first epoch, regardless of the underlying data.

  3. danielhanchen commented on Oct 2, 2024

    @danielhanchen
    Member

    Ok will investigate - it might be a bug!!

  4. changed the title [-]Fine tuning llama 3.1 8B instruct - eval loss constant after a while[/-] [+]Evaluation loss becomes constant[/+] on Oct 2, 2024
  5. Itssshikhar commented on Jan 11, 2025

    @Itssshikhar
    Contributor

    Hi!
    I was looking through the code, trying to find a solution to this problem, but it seems that replicating the error is not quite feasible.
    Would be able to tell, where exactly should I look for?

  6. danielhanchen commented on Jan 14, 2025

    @danielhanchen
    Member

    @Itssshikhar It's most likely not a bug - eval losses can be constant in some weird scenarios, but very unlikely

  7. saadkhi commented on Sep 1, 2025

    @saadkhi

    Hey, I want to work on this issue. Can anybody give me quick walkthrough on which files I have to look upon?

    Regards,
    Saad Ali

  8. Itssshikhar commented on Sep 2, 2025

    @Itssshikhar
    Contributor

    Hi @saadkhi. This one might be a dud. Better go for other open issues atm.

  9. Se7enCodes commented on Sep 12, 2026

    @Se7enCodes

    Hi! I'd like to work on this issue. Could you confirm it still exists?

  10. danielhanchen commented on Sep 15, 2026

    @danielhanchen
    Member

    This doesn't reproduce any more! A LoRA finetune evaluating every 5 steps gives six different eval_loss values, so it isn't locking to a constant. If you see the same number repeated to the last decimal it usually means the eval set is being re-tokenized into a constant batch, or the adapter is disabled in that mode, so please reopen with your script if it comes back!

    Please update Unsloth: uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir (if it's not in the current release yet it'll be in the next one). Reopen if it still happens!

  11. Se7enCodes commented on Sep 15, 2026

    @Se7enCodes

    Ok thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions