# Saving model with best loss in NeuralPDE

**URL:** <https://discourse.julialang.org/t/saving-model-with-best-loss-in-neuralpde/117087>\
**Category:** General Usage\
**Created:** [July 16, 2024, 7:45am UTC](https://discourse.julialang.org/t/saving-model-with-best-loss-in-neuralpde/117087 "2024-07-16T07:45:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gradureau](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gradureau](https://discourse.julialang.org/u/gradureau)\
**Post date:** [July 16, 2024, 7:45am UTC](https://discourse.julialang.org/t/saving-model-with-best-loss-in-neuralpde/117087/1 "2024-07-16T07:45:57Z")

</div>

Hey everyone,

I am trying to use NeuralPDE to solve equations and I’ve been trying to use the QuasiRandomTraining method, with Adam optimizer. Now the learning curve is quite chaotic, so I would wish to save the best model encountered during the training instead of the last. Is there a way to do this?

Thank you for your answers!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 17, 2024, 8:04am UTC](https://discourse.julialang.org/t/saving-model-with-best-loss-in-neuralpde/117087/2 "2024-07-17T08:04:37Z")

</div>

> [@gradureau](#):
>
> I am trying to use NeuralPDE to solve equations and I’ve been trying to use the QuasiRandomTraining method, with Adam optimizer. Now the learning curve is quite chaotic, so I would wish to save the best model encountered during the training instead of the last. Is there a way to do this?

IIRC Optimization already is setup to best save by default. @Vaibhavdixit02 what’s the option on that?

---

<div class="post-metadata">

**Author:** ![Vaibhavdixit02](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vaibhavdixit02/32/2916_2.png) [@Vaibhavdixit02](https://discourse.julialang.org/u/Vaibhavdixit02)\
**Post date:** [July 23, 2024, 1:08pm UTC](https://discourse.julialang.org/t/saving-model-with-best-loss-in-neuralpde/117087/3 "2024-07-23T13:08:47Z")

</div>

It’s a kwarg to `solve` function `save_best` and is true by default
