kups.relaxation.transforms.lbfgs
¶
Per-system L-BFGS preconditioner with ASE-style initial Hessian.
Unlike :func:kups.relaxation.optax.scale_by_ase_lbfgs, this version takes
an index_prefix pytree at init time mapping each parameter element to a
system. Every reduction in the L-BFGS two-loop recursion (the
s · q and y · r inner products) is taken per-system, the per-slot
weights ρᵢ = 1/(yᵢ · sᵢ) become per-system scalars stored in a
Table[K, Array] of shape (n_systems, memory_size), and the
resulting inverse-Hessian approximation is therefore block-diagonal across
systems. Running batched independent systems through this transform is
bit-identical to running them one at a time.
ScaleByAseLbfgs
¶
Bases: Optimizer[Params, ScaleByAseLbfgsState]
L-BFGS preconditioner with per-system block-diagonal Hessian.
With a trivial index_prefix (one system) this reduces to the same
algorithm as :func:kups.relaxation.optax.scale_by_ase_lbfgs:
the initial inverse Hessian is (1/alpha) * I (ASE convention) and
the recursion buffers memory_size past (diff_params, diff_updates)
pairs. With multiple systems, every system maintains its own
independent inverse-Hessian approximation and its own ρᵢ weights.
Attributes:
| Name | Type | Description |
|---|---|---|
memory_size |
int
|
Number of past difference pairs to store. |
alpha |
float
|
Initial inverse Hessian is |
Source code in src/kups/relaxation/transforms/lbfgs.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
ScaleByAseLbfgsState
¶
State for the per-system ASE-flavor L-BFGS preconditioner.
Attributes:
| Name | Type | Description |
|---|---|---|
count |
Array
|
Total update steps taken so far (scalar int32). |
params |
PyTree
|
Last seen parameters, pytree matching |
updates |
PyTree
|
Last seen gradients/updates. |
diff_params_memory |
PyTree
|
Stacked past parameter differences, shape
|
diff_updates_memory |
PyTree
|
Stacked past update differences, same shape. |
weights_memory |
Table[Any, Array]
|
Per-system per-slot |
index_prefix |
PyTree
|
Tree prefix of the parameter pytree whose leaves are
|