stellar / rs-soroban-env

Rust environment for Soroban contracts.
Apache License 2.0
60 stars 40 forks source link

Improve cost model fitting for better lower-range accuracy #1293

Closed jayz22 closed 9 months ago

jayz22 commented 9 months ago

What

This PR was originated from the fact that previously the VarDeser cost's constant term was unrealistically high.

It improves the numerical approach towards model generation by constraining it to the smallest input in the range. Thus it avoids fitting a model that tries to produce a marginally better fitness at the expense of lower-range accuracy.

It also removes the dependency of the HostCostMeasurement's input size on the linear parameter's scale factor (COST_MODEL_LIN_TERM_SCALE_BITS), which previously put a numerical constrain on the smallest input size and minimal gaps.

raw calibration outputs

Why

[TODO: Why this change is being made. Include any context required to understand the why.]

Known limitations

[TODO or N/A]