# Seeing improvement only with deterministic settings

**URL:** <https://discuss.pytorch.org/t/seeing-improvement-only-with-deterministic-settings/59793>\
**Category:** Uncategorized\
**Created:** [November 1, 2019, 6:18pm UTC](https://discuss.pytorch.org/t/seeing-improvement-only-with-deterministic-settings/59793 "2019-11-01T18:18:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amirhf](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/amirhf/32/5634_2.png) [@amirhf](https://discuss.pytorch.org/u/amirhf)\
**Post date:** [November 1, 2019, 6:18pm UTC](https://discuss.pytorch.org/t/seeing-improvement-only-with-deterministic-settings/59793/1 "2019-11-01T18:18:40Z")

</div>

Hello,

I’m developing a new method in PyTorch and supposedly it should improve my baseline. However, I can only see this improvement when I run my code in deterministic mode (no mater what seed I use with 4 workers), namely when I use the following line:

```auto
if deterministic:
        random.seed(seed)
        torch.manual_seed(seed)
        cudnn.deterministic = True
        cudnn.benchmark = False
        np.random.seed(seed)

```

As soon as I turn off the deterministic mode, the results are only comparable with my baseline. And I mean I see improvement in terms of better loss minimization and in my application better f1 and AUCPR scores.

---

<div class="post-metadata">

**Author:** ![albanD](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alband/32/215_2.png) [@albanD](https://discuss.pytorch.org/u/albanD)\
**Post date:** [November 1, 2019, 9:23pm UTC](https://discuss.pytorch.org/t/seeing-improvement-only-with-deterministic-settings/59793/2 "2019-11-01T21:23:23Z")

</div>

This happens whatever the value of the seed?  
Can you try by just setting the cudnn flags and not the seeds?
