# Evaluation step very slow

**URL:** <https://discuss.huggingface.co/t/evaluation-step-very-slow/73981>\
**Category:** 🤗Transformers\
**Created:** [February 20, 2024, 1:37pm UTC](https://discuss.huggingface.co/t/evaluation-step-very-slow/73981 "2024-02-20T13:37:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![theodp](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/theodp/32/24060_2.png) [@theodp](https://discuss.huggingface.co/u/theodp)\
**Post date:** [February 20, 2024, 1:37pm UTC](https://discuss.huggingface.co/t/evaluation-step-very-slow/73981/1 "2024-02-20T13:37:35Z")

</div>

Hello 🤗

I am fine-tuning 🧠 a foundation model on Language Modeling (Next token prediction task).

As you can see with my code bellow, evaluation is performed every 5 steps :

```auto
    train_args = transformers.TrainingArguments(
                    output_dir=output_dir,
                    warmup_steps=1,
                    per_device_train_batch_size=2,
                    gradient_accumulation_steps=1,
                    max_steps=max_steps,
                    learning_rate=2.5e-5, 
                    evaluation_strategy = "steps",   
                    eval_steps = 5,
                )

  trainer = transformers.Trainer(
      model = model,
      train_dataset = train,
      eval_dataset = eval,
      args = args,
      data_collator = data_collator,
  )

  trainer.train()

```

The training time for each step is normal, but evaluation step is very long 🐢 !

Would you have any idea why it is so long ?

Thank you 🤗

---

<div class="post-metadata">

**Author:** ![El-chapoo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/el-chapoo/32/23658_2.png) [@El-chapoo](https://discuss.huggingface.co/u/El-chapoo)\
**Post date:** [February 21, 2024, 5:00pm UTC](https://discuss.huggingface.co/t/evaluation-step-very-slow/73981/2 "2024-02-21T17:00:07Z")

</div>

if you visit hugging face training arguments the default batch size for training and eval is 8 you should override it by passing per device eval batch size to 2

---

<div class="post-metadata">

**Author:** ![Dth1111](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dth1111/32/51613_2.png) [@Dth1111](https://discuss.huggingface.co/u/Dth1111)\
**Post date:** [July 24, 2025, 8:14am UTC](https://discuss.huggingface.co/t/evaluation-step-very-slow/73981/3 "2025-07-24T08:14:11Z")

</div>

Thanks, this saved me.
