What have you defined in train()?
If you are creating a new model, you should also create a new optimizer.
I don’t understand the issue completely.
If you use the for loop you’ll get several different models.
Now if you unroll the loop and train several models, you get a completely different result?
model1 = define_model()
train()

model2 = define_model()
train()
...