pub struct SOFOConfig {Show 14 fields
pub learning_rate: f32,
pub batch_size: usize,
pub forward_passes: usize,
pub curvature_strength: f32,
pub damping: f32,
pub weight_decay: f32,
pub adaptive_curvature: bool,
pub momentum: f32,
pub nesterov: bool,
pub max_condition_number: f32,
pub memory_efficient: bool,
pub parallel_threshold: usize,
pub hvp_epsilon: f32,
pub probe_seed: u64,
}Expand description
Configuration for SOFO optimizer
Fields§
§learning_rate: f32Learning rate (default: 1e-3)
batch_size: usizeBatch size for forward-mode differentiation (default: 32)
forward_passes: usizeNumber of forward passes for curvature estimation (default: 8)
curvature_strength: f32Strength of curvature information (default: 0.1)
damping: f32Damping factor for numerical stability (default: 1e-6)
weight_decay: f32Weight decay (default: 0.0)
adaptive_curvature: boolEnable adaptive curvature estimation (default: true)
momentum: f32Momentum for first-order updates (default: 0.9)
nesterov: boolUse Nesterov acceleration (default: true)
max_condition_number: f32Maximum condition number for curvature matrix (default: 1e6)
memory_efficient: boolEnable memory efficient mode (default: true)
parallel_threshold: usizeParallel computation threshold (default: 1000)
hvp_epsilon: f32Finite-difference step used for the Hessian-vector product (default: 1e-3).
A central difference of gradients trades truncation error (O(ε²)) against
cancellation error (O(δ/ε) for gradient noise δ); 1e-3 is the usual
compromise for f32 parameters.
probe_seed: u64Seed for the Rademacher probe stream (default: 0x5060_F0F0_1234_5678).
Implementations§
Source§impl SOFOConfig
impl SOFOConfig
Sourcepub fn learning_rate(self, lr: f32) -> Self
pub fn learning_rate(self, lr: f32) -> Self
Set the learning rate
Sourcepub fn batch_size(self, batch_size: usize) -> Self
pub fn batch_size(self, batch_size: usize) -> Self
Set the batch size for forward-mode differentiation
Sourcepub fn forward_passes(self, passes: usize) -> Self
pub fn forward_passes(self, passes: usize) -> Self
Set the number of forward passes for curvature estimation
Sourcepub fn curvature_strength(self, strength: f32) -> Self
pub fn curvature_strength(self, strength: f32) -> Self
Set the curvature strength
Sourcepub fn weight_decay(self, decay: f32) -> Self
pub fn weight_decay(self, decay: f32) -> Self
Set weight decay
Sourcepub fn hvp_epsilon(self, eps: f32) -> Self
pub fn hvp_epsilon(self, eps: f32) -> Self
Set the finite-difference step for the Hessian-vector product.
Sourcepub fn probe_seed(self, seed: u64) -> Self
pub fn probe_seed(self, seed: u64) -> Self
Set the seed of the Rademacher probe stream.
Sourcepub fn adaptive_curvature(self, enable: bool) -> Self
pub fn adaptive_curvature(self, enable: bool) -> Self
Build the configuration Enable or disable adaptive per-parameter curvature weighting
Sourcepub fn max_condition_number(self, max_condition_number: f32) -> Self
pub fn max_condition_number(self, max_condition_number: f32) -> Self
Set the maximum condition number tolerated in the curvature estimate
pub fn build(self) -> Self
Trait Implementations§
Source§impl Clone for SOFOConfig
impl Clone for SOFOConfig
Source§fn clone(&self) -> SOFOConfig
fn clone(&self) -> SOFOConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SOFOConfig
impl Debug for SOFOConfig
Auto Trait Implementations§
impl Freeze for SOFOConfig
impl RefUnwindSafe for SOFOConfig
impl Send for SOFOConfig
impl Sync for SOFOConfig
impl Unpin for SOFOConfig
impl UnsafeUnpin for SOFOConfig
impl UnwindSafe for SOFOConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more