Reduce memory consumption in CMAwM - #223
Conversation
|
The CI run fails for "run python examples/safecma.py", but this is not related to the changes in this PR. |
|
@y0z |
8d1bd81 to
6ba9547
Compare
|
@y0z (cc: @c-bata ) Compared with the previous dense implementation, I confirmed that there is no material change in the essential algorithmic behavior, including the trajectory of the distribution parameters under typical float64 inputs. Therefore, I plan to merge this PR as is. As a minor compatibility note, when Since the expected use of float32 inputs seems limited, I do not consider this issue significant enough to require changes. However, before merging, could you please confirm whether preserving the previous behavior for float32 inputs is necessary? If not, I plan to merge the PR as is. |
|
Thank you for your response. |
|
Thank you for confirming. I will proceed with merging this PR as is. |
Background
This change was motivated by optuna/optuna#5762, which reported that using
CmaEsSamplerwith margin could significantly increase the Optuna journal file size. In the reported example, ten parameters over[-30, 30]with a step size of0.001produced a journal file of about 40 MB after only 12 trials.The dense discrete-value tables stored in
CMAwMcontribute to the size of the serialized optimizer state. This PR replaces them with a compact arithmetic representation.Summary
Results
For 10 dimensions over [-30, 30] with a step size of 0.001 (60,001 discrete values per dimension):
The new implementation was verified against the previous dense implementation, and all tests pass.
Verification
I compared the new arithmetic representation against the previous dense implementation using a standalone verification and benchmark script: https://gist.github.com/y0z/2a65eb996dccd7f220f1986c250c819a.
The implementations produced equivalent sampling and update results.