Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to sample from batch OT if batch size used for compute OT is large than training batch? #135

Open
Luciennnnnnn opened this issue Sep 15, 2024 · 3 comments

Comments

@Luciennnnnnn
Copy link

Hi, how to sample from batch OT if batch size used for compute OT is large than training batch? For example, I use batch size 128 to compute batch OT, then should I sample 32 from this OT for training repeat 4 times or I sample from it only once?

@atong01
Copy link
Owner

atong01 commented Sep 16, 2024

Hi!

Both are mathematically valid. I have personally opted for the latter as it is easier to implement, and is fine as long as the OT is very fast relative to the model. I suspect that the former might be slightly better in some circumstances, but I don't think it should matter too much. To me it is the same question as to whether you should train your neural network by randomly sampling examples at each step, or pre-shuffle an epoch of data and run through the entire thing. Both can give satisfactory results.

@Luciennnnnnn
Copy link
Author

Hi @atong01, thank you for your prompt response!

I believe the key consideration between these two options is data loading efficiency. The latter approach may significantly increase loading time. I'm curious why you suspect the former might be slightly better? From my perspective, if we employ replaceable sampling, both methods should yield similar results.

@atong01
Copy link
Owner

atong01 commented Sep 20, 2024

Yes, very possible. In this case I was assuming loading time was not a bottleneck. If it is than the former should be preferred. Definitely similar results. I think you would only see differences in big datasets with a small number of epochs (where you may miss some datapoints by chance with replaceable sampling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants