hakuli 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hakuli/__init__.py ADDED
@@ -0,0 +1,9 @@
1
+ """Hakuli: memory-efficient optimizer for full-parameter LLM training.
2
+
3
+ Developed by XAEDRO.
4
+ """
5
+
6
+ from hakuli.optim import Hakuli
7
+
8
+ __all__ = ["Hakuli"]
9
+ __version__ = "1.0.0"
hakuli/optim.py ADDED
@@ -0,0 +1,246 @@
1
+ """Core Hakuli optimizer implementation.
2
+
3
+ Hakuli is an independent, clean-room implementation developed by XAEDRO,
4
+ written from the published algorithmic description of low-rank-moment
5
+ optimizers. No source code from any reference implementation is included.
6
+ See the NOTICE file at the repository root for academic attributions.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import math
12
+ from typing import Callable, Iterable, Optional
13
+
14
+ import torch
15
+ from torch.optim import Optimizer
16
+
17
+ __all__ = ["Hakuli"]
18
+
19
+
20
+ class Hakuli(Optimizer):
21
+ r"""Memory-efficient optimizer for full-parameter LLM training.
22
+
23
+ Hakuli keeps Adam-style first- and second-moment estimates in a low-rank
24
+ auxiliary subspace built from a Gaussian random projection of the
25
+ gradient, then applies a channel-wise (or tensor-wise) rescaling of the
26
+ *full* gradient. Optimizer memory is therefore close to SGD while the
27
+ weights receive full-rank updates. No singular value decomposition is
28
+ performed at any point.
29
+
30
+ For a 2-D parameter :math:`G_t \in \mathbb{R}^{m \times n}` the update is
31
+
32
+ .. math::
33
+
34
+ R_t &= P_t^{\top} G_t \\
35
+ M_t &= \beta_1 M_{t-1} + (1 - \beta_1) R_t \\
36
+ V_t &= \beta_2 V_{t-1} + (1 - \beta_2) R_t^2 \\
37
+ S_t &= \frac{M_t}{\sqrt{V_t} + \epsilon} \\
38
+ s_t &= \frac{\lVert S_t \rVert}{\lVert R_t \rVert}
39
+ \quad \text{(per output channel)} \\
40
+ \hat{G}_t &= \sqrt{\lambda}\, s_t \odot G_t \\
41
+ W_t &= W_{t-1} - \eta_t \hat{U}_t,
42
+ \qquad
43
+ \eta_t = \eta \frac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}
44
+
45
+ where :math:`P_t \in \mathbb{R}^{m \times r}` is resampled from a standard
46
+ Gaussian every ``update_proj_gap`` steps, :math:`r` is ``rank`` and
47
+ :math:`\lambda` is ``scale``. When the parameter is wider than it is tall
48
+ the projection is applied on the right and channel norms are taken along
49
+ rows. Parameters whose smallest dimension does not exceed ``rank``
50
+ (including all 1-D parameters) are updated with the bias-corrected
51
+ Adam-style direction :math:`S_t` directly.
52
+
53
+ A relative norm-growth limiter (``nl_threshold``) caps the update norm at
54
+ ``nl_threshold`` times the previous step's update norm, converting abrupt
55
+ gradient spikes into smooth growth.
56
+
57
+ Args:
58
+ params: Iterable of parameters or parameter-group dictionaries. The
59
+ hyperparameters below can be overridden per group.
60
+ lr: Learning rate (default: ``1e-5``).
61
+ rank: Rank of the auxiliary random subspace (default: ``256``).
62
+ update_proj_gap: Steps between projection resamples (default: ``200``).
63
+ scale: Global multiplier on the structured update, applied as
64
+ ``sqrt(scale)`` (default: ``1.0``).
65
+ scale_type: ``"channel"`` for per-channel rescaling or ``"tensor"``
66
+ for a single scalar per tensor (default: ``"channel"``).
67
+ betas: Moment decay coefficients (default: ``(0.9, 0.999)``).
68
+ eps: Numerical stability term (default: ``1e-8``).
69
+ weight_decay: Decoupled weight decay (default: ``0.0``).
70
+ nl_threshold: Relative cap on update-norm growth between consecutive
71
+ steps (default: ``1.01``).
72
+
73
+ Example:
74
+ >>> import torch
75
+ >>> import torch.nn as nn
76
+ >>> from hakuli import Hakuli
77
+ >>> model = nn.Linear(128, 128)
78
+ >>> optimizer = Hakuli(model.parameters(), lr=1e-4, rank=64)
79
+ >>> optimizer.zero_grad()
80
+ >>> loss = model(torch.randn(8, 128)).pow(2).mean()
81
+ >>> loss.backward()
82
+ >>> optimizer.step()
83
+
84
+ Note:
85
+ Hakuli was designed for fine-tuning large transformers (attention and
86
+ MLP projection matrices, embeddings). Route 1-D parameters and
87
+ normalization layers to the same optimizer or any standard optimizer;
88
+ Hakuli handles both cases transparently.
89
+ """
90
+
91
+ def __init__(
92
+ self,
93
+ params: Iterable[torch.Tensor],
94
+ lr: float = 1e-5,
95
+ rank: int = 256,
96
+ update_proj_gap: int = 200,
97
+ scale: float = 1.0,
98
+ scale_type: str = "channel",
99
+ betas: tuple = (0.9, 0.999),
100
+ eps: float = 1e-8,
101
+ weight_decay: float = 0.0,
102
+ nl_threshold: float = 1.01,
103
+ ) -> None:
104
+ if lr < 0.0:
105
+ raise ValueError(f"Invalid learning rate: {lr}")
106
+ if rank < 0:
107
+ raise ValueError(f"Invalid rank: {rank}")
108
+ if update_proj_gap < 1:
109
+ raise ValueError(f"Invalid update_proj_gap: {update_proj_gap}")
110
+ if scale < 0.0:
111
+ raise ValueError(f"Invalid scale: {scale}")
112
+ if scale_type not in ("channel", "tensor"):
113
+ raise ValueError(
114
+ f"Invalid scale_type: {scale_type!r} (expected 'channel' or 'tensor')"
115
+ )
116
+ if not 0.0 <= betas[0] < 1.0:
117
+ raise ValueError(f"Invalid beta1: {betas[0]}")
118
+ if not 0.0 <= betas[1] < 1.0:
119
+ raise ValueError(f"Invalid beta2: {betas[1]}")
120
+ if eps < 0.0:
121
+ raise ValueError(f"Invalid epsilon: {eps}")
122
+ if weight_decay < 0.0:
123
+ raise ValueError(f"Invalid weight_decay: {weight_decay}")
124
+ if nl_threshold <= 0.0:
125
+ raise ValueError(f"Invalid nl_threshold: {nl_threshold}")
126
+
127
+ defaults = dict(
128
+ lr=lr,
129
+ rank=rank,
130
+ update_proj_gap=update_proj_gap,
131
+ scale=scale,
132
+ scale_type=scale_type,
133
+ betas=betas,
134
+ eps=eps,
135
+ weight_decay=weight_decay,
136
+ nl_threshold=nl_threshold,
137
+ )
138
+ super().__init__(params, defaults)
139
+
140
+ @torch.no_grad()
141
+ def step(self, closure: Optional[Callable[[], torch.Tensor]] = None) -> Optional[torch.Tensor]:
142
+ """Perform a single optimization step.
143
+
144
+ Args:
145
+ closure: Optional callable that re-evaluates the model and
146
+ returns the loss. Executed under ``torch.enable_grad()``.
147
+
148
+ Returns:
149
+ The loss returned by ``closure``, if provided.
150
+ """
151
+ loss = None
152
+ if closure is not None:
153
+ with torch.enable_grad():
154
+ loss = closure()
155
+
156
+ for group in self.param_groups:
157
+ beta1, beta2 = group["betas"]
158
+ rank = group["rank"]
159
+ eps = group["eps"]
160
+ lr = group["lr"]
161
+ scale = group["scale"]
162
+ weight_decay = group["weight_decay"]
163
+ scale_type = group["scale_type"]
164
+ update_proj_gap = group["update_proj_gap"]
165
+ nl_threshold = group["nl_threshold"]
166
+
167
+ for p in group["params"]:
168
+ grad = p.grad
169
+ if grad is None:
170
+ continue
171
+ if grad.is_sparse:
172
+ raise RuntimeError("Hakuli does not support sparse gradients")
173
+
174
+ state = self.state[p]
175
+ state["step"] = state.get("step", 0) + 1
176
+ t = state["step"]
177
+
178
+ projected = grad.dim() == 2 and rank > 0 and min(grad.shape) > rank
179
+
180
+ if projected:
181
+ rows, cols = grad.shape
182
+ if rows >= cols:
183
+ if "proj" not in state or t % update_proj_gap == 0:
184
+ state["proj"] = torch.randn(
185
+ rows, rank, device=grad.device, dtype=torch.bfloat16
186
+ )
187
+ low = torch.mm(state["proj"].t().to(grad.dtype), grad).float()
188
+ channel_dim = 0
189
+ else:
190
+ if "proj" not in state or t % update_proj_gap == 0:
191
+ state["proj"] = torch.randn(
192
+ cols, rank, device=grad.device, dtype=torch.bfloat16
193
+ )
194
+ low = torch.mm(grad, state["proj"].to(grad.dtype)).float()
195
+ channel_dim = 1
196
+
197
+ exp_avg = state.get("exp_avg")
198
+ if exp_avg is None:
199
+ exp_avg = torch.zeros_like(low)
200
+ exp_avg_sq = torch.zeros_like(low)
201
+ else:
202
+ exp_avg_sq = state["exp_avg_sq"]
203
+ exp_avg.mul_(beta1).add_(low, alpha=1.0 - beta1)
204
+ exp_avg_sq.mul_(beta2).addcmul_(low, low, value=1.0 - beta2)
205
+ state["exp_avg"], state["exp_avg_sq"] = exp_avg, exp_avg_sq
206
+
207
+ norm_grad = exp_avg / (exp_avg_sq.sqrt() + eps)
208
+ if scale_type == "channel":
209
+ numer = norm_grad.norm(dim=channel_dim)
210
+ denom = low.norm(dim=channel_dim).clamp(min=1e-8)
211
+ scaling = numer / denom
212
+ if channel_dim == 1:
213
+ scaling = scaling.unsqueeze(1)
214
+ else:
215
+ scaling = norm_grad.norm() / low.norm().clamp(min=1e-8)
216
+ update = grad * scaling.to(grad.dtype)
217
+ else:
218
+ exp_avg = state.get("exp_avg")
219
+ if exp_avg is None:
220
+ exp_avg = torch.zeros_like(grad)
221
+ exp_avg_sq = torch.zeros_like(grad)
222
+ else:
223
+ exp_avg_sq = state["exp_avg_sq"]
224
+ exp_avg.mul_(beta1).add_(grad, alpha=1.0 - beta1)
225
+ exp_avg_sq.mul_(beta2).addcmul_(grad, grad, value=1.0 - beta2)
226
+ state["exp_avg"], state["exp_avg_sq"] = exp_avg, exp_avg_sq
227
+
228
+ update = exp_avg / (exp_avg_sq.sqrt() + eps)
229
+
230
+ update = update * math.sqrt(max(scale, 0.0))
231
+
232
+ update_norm = update.norm().item()
233
+ prev_norm = state.get("prev_norm")
234
+ if prev_norm is not None and prev_norm > 0.0:
235
+ limiter = max(update_norm / (prev_norm + 1e-8), nl_threshold) / nl_threshold
236
+ update = update / limiter
237
+ state["prev_norm"] = update_norm / limiter
238
+ else:
239
+ state["prev_norm"] = update_norm
240
+
241
+ step_size = lr * math.sqrt(1.0 - beta2**t) / max(1.0 - beta1**t, 1e-16)
242
+ if weight_decay > 0:
243
+ p.mul_(1.0 - lr * weight_decay)
244
+ p.add_(update, alpha=-step_size)
245
+
246
+ return loss
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: hakuli
3
+ Version: 1.0.0
4
+ Summary: Hakuli: memory-efficient optimizer for full-parameter LLM training without SVD.
5
+ Author: XAEDRO
6
+ Author-email: Evaristo Cordoba Ancajima <research@xaedro.com>
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/xaedro-ai/hakuli
9
+ Project-URL: Repository, https://github.com/xaedro-ai/hakuli
10
+ Keywords: llm,optimizer,memory-efficient,fine-tuning,training,low-rank
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: NOTICE
26
+ Requires-Dist: torch>=2.1
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # Hakuli
33
+
34
+ **Memory-efficient optimizer for full-parameter LLM training: no SVD, low-rank optimizer state, PyTorch-only.**
35
+
36
+ Hakuli is a memory-efficient optimizer for training and fine-tuning large
37
+ language models on a single consumer GPU. It performs full-parameter (not
38
+ adapter-based) updates while keeping optimizer memory close to SGD, by
39
+ approximating channel-wise gradient scaling with an auxiliary low-rank state
40
+ built from pure random projections. Hakuli performs **no SVD**, not even
41
+ periodically, which removes the periodic SVD stalls of GaLore-style
42
+ projection methods.
43
+
44
+ Hakuli is developed by XAEDRO and is used in the company's internal LLM
45
+ training pipeline.
46
+
47
+ Hakuli is an independent, clean-room implementation of the APOLLO optimization
48
+ method (Zhu et al., MLSys 2025). The algorithm follows the published
49
+ specification; no source code from the reference implementation was used.
50
+ Hakuli is not affiliated with, or endorsed by, the APOLLO authors. See
51
+ [`NOTICE`](NOTICE) for academic attributions.
52
+
53
+ [![CI](https://github.com/xaedro-ai/hakuli/actions/workflows/ci.yml/badge.svg)](https://github.com/xaedro-ai/hakuli/actions/workflows/ci.yml)
54
+ [![PyPI](https://img.shields.io/pypi/v/hakuli.svg)](https://pypi.org/project/hakuli/)
55
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
56
+ [![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](pyproject.toml)
57
+ [![PyTorch](https://img.shields.io/badge/pytorch-2.1%2B-ee4c2c.svg)](https://pytorch.org)
58
+
59
+ ---
60
+
61
+ ## Why Hakuli
62
+
63
+ | | AdamW | GaLore | **Hakuli** |
64
+ |---|---|---|---|
65
+ | Full-parameter training | Yes | Yes | Yes |
66
+ | Optimizer memory (7B, rank 256) | ≈54 GB (LLaMA-7B) | ~9 GB | **~2.4 GB** |
67
+ | Periodic SVD | None | Every `gap` steps | **None** |
68
+ | Dependency footprint | torch | galore-torch | **torch only** |
69
+
70
+ - **No SVD anywhere.** Projection matrices are Gaussian random and resampled on
71
+ a fixed cadence. There is no `O(mn²)` decomposition, no rebuild stalls.
72
+ - **Low-rank auxiliary state.** Moments are tracked in a `rank × n` subspace;
73
+ the update is scaled channel-wise from that state and applied to the full
74
+ gradient. The weights remain full-rank.
75
+ - **Norm-growth limiter.** A relative update-norm limiter (`nl_threshold`,
76
+ default `1.01`) caps update-norm growth between consecutive steps,
77
+ converting abrupt gradient spikes into smooth increases.
78
+ - **Minimal API.** A single `torch.optim.Optimizer` subclass. Works with
79
+ plain PyTorch training loops, gradient accumulation, and per-layer setups.
80
+
81
+ ## Installation
82
+
83
+ Hakuli is dependency-light (PyTorch only). Install from PyPI:
84
+
85
+ ```bash
86
+ pip install hakuli
87
+ ```
88
+
89
+ Or from source:
90
+
91
+ ```bash
92
+ git clone https://github.com/xaedro-ai/hakuli.git
93
+ cd hakuli
94
+ pip install -e .
95
+ ```
96
+
97
+ Requires Python 3.9+ and PyTorch 2.1+. CUDA is recommended but not required.
98
+
99
+ ## Quick start
100
+
101
+ ```python
102
+ import torch
103
+ import torch.nn as nn
104
+ from hakuli import Hakuli
105
+
106
+ model = nn.Sequential(nn.Linear(512, 2048), nn.GELU(), nn.Linear(2048, 512)).cuda()
107
+
108
+ # Hakuli routes 2-D weights through the low-rank path; parameters whose
109
+ # smallest dimension is not larger than `rank` (including 1-D parameters)
110
+ # automatically use its Adam-style fallback.
111
+ lowrank, regular = [], []
112
+ for name, p in model.named_parameters():
113
+ (lowrank if p.ndim == 2 else regular).append(p)
114
+
115
+ optimizer = Hakuli(
116
+ [
117
+ {"params": regular},
118
+ {"params": lowrank, "rank": 256, "scale": 1.0,
119
+ "scale_type": "channel", "update_proj_gap": 200},
120
+ ],
121
+ lr=1e-5,
122
+ )
123
+
124
+ for step, (x, y) in enumerate(loader):
125
+ optimizer.zero_grad()
126
+ loss = criterion(model(x), y)
127
+ loss.backward()
128
+ optimizer.step()
129
+ ```
130
+
131
+ A complete runnable example (small model, CPU) is provided in
132
+ [`examples/train_tiny.py`](examples/train_tiny.py).
133
+
134
+ ### Per-parameter (layer-wise) setups
135
+
136
+ Hakuli is a standard optimizer and can be instantiated per parameter. This is
137
+ the recommended pattern when gradients must be released eagerly:
138
+
139
+ ```python
140
+ optimizers = {id(p): Hakuli([p], lr=1e-5, rank=256) for p in lowrank_params}
141
+
142
+ def hook(p):
143
+ if p.grad is None:
144
+ return
145
+ opt = optimizers[id(p)]
146
+ opt.step()
147
+ opt.zero_grad(set_to_none=True)
148
+
149
+ for p in lowrank_params:
150
+ p.register_post_accumulate_grad_hook(hook)
151
+ ```
152
+
153
+ ## Configuration
154
+
155
+ | Argument | Default | Description |
156
+ |---|---|---|
157
+ | `lr` | `1e-5` | Learning rate. The APOLLO-style scale-corrected step size is applied internally; no external scheduler is required. |
158
+ | `rank` | `256` | Rank of the auxiliary random subspace. 256 is a good default for 1B–7B models. |
159
+ | `scale` | `1.0` | Global multiplier on the structured update (applied under a square root). Tune together with `rank`. |
160
+ | `scale_type` | `"channel"` | `"channel"` (APOLLO-style) or `"tensor"` (extreme low-memory). |
161
+ | `update_proj_gap` | `200` | Steps between random-projection resamples. |
162
+ | `betas` | `(0.9, 0.999)` | Moment decay coefficients. |
163
+ | `eps` | `1e-8` | Numerical stability term. |
164
+ | `weight_decay` | `0.0` | Decoupled weight decay. |
165
+ | `nl_threshold` | `1.01` | Relative cap on update-norm growth between steps. |
166
+
167
+ ## Recommended usage notes
168
+
169
+ - Apply Hakuli to attention and MLP projection matrices plus embeddings; keep
170
+ normalization layers and biases in a conventional optimizer.
171
+ - `rank` 256 with `scale` ~14 (`hidden_size / rank` rule of thumb) is a good
172
+ starting point for 7B-scale fine-tuning.
173
+ - With eager gradient release (per-parameter hooks), peak memory is dominated
174
+ by activations, not optimizer state; combine with activation checkpointing
175
+ for long-context training.
176
+ - Hakuli is orthogonal to precision schemes: it operates on whatever gradient
177
+ dtype your model produces (`bf16` recommended).
178
+
179
+ ## Documentation
180
+
181
+ - [`paper/hakuli-technical-report.pdf`](paper/hakuli-technical-report.pdf):
182
+ compiled technical report.
183
+ - [`paper/`](paper/): report sources — LaTeX (`main.tex`, `references.bib`)
184
+ and Markdown (`paper.md`).
185
+ - [`benchmarks/RESULTS.md`](benchmarks/RESULTS.md): measured memory and
186
+ throughput results.
187
+ - [`docs/design.md`](docs/design.md): algorithm, update rule, memory model.
188
+ - [`docs/faq.md`](docs/faq.md): batch sizes, rank selection, integrations.
189
+
190
+ ## Development
191
+
192
+ ```bash
193
+ pip install -e ".[dev]"
194
+ pytest -q
195
+ ```
196
+
197
+ ## Citation
198
+
199
+ If you use Hakuli in academic work, please cite the underlying research that
200
+ inspired its design:
201
+
202
+ ```bibtex
203
+ @inproceedings{zhu2025apollo,
204
+ title = {{APOLLO}: {SGD}-like Memory, {AdamW}-level Performance},
205
+ author = {Zhu, Hanqing and Zhang, Zhenyu and Cong, Wenyan and Liu, Xi and
206
+ Park, Sem and Chandra, Vikas and Long, Bo and Pan, David Z. and
207
+ Wang, Zhangyang and Lee, Jinwon},
208
+ booktitle = {Conference on Machine Learning and Systems (MLSys)},
209
+ year = {2025}
210
+ }
211
+
212
+ @inproceedings{zhao2024galore,
213
+ title = {{GaLore}: Memory-Efficient {LLM} Training by Gradient Low-Rank Projection},
214
+ author = {Zhao, Jiawei and Zhang, Zhenyu and Chen, Beidi and Wang, Zhangyang and
215
+ Anandkumar, Anima and Tian, Yuandong},
216
+ booktitle = {International Conference on Machine Learning (ICML)},
217
+ year = {2024}
218
+ }
219
+ ```
220
+
221
+ See [`CITATION.cff`](CITATION.cff) for machine-readable metadata.
222
+
223
+ ## License
224
+
225
+ Apache License 2.0. See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).
226
+
227
+ "Hakuli" and "XAEDRO" are trademarks of XAEDRO. Hakuli is an independent
228
+ clean-room implementation; see the NOTICE file for academic attributions.
@@ -0,0 +1,8 @@
1
+ hakuli/__init__.py,sha256=1i94VtwBlcuyxPOSkxXezg3dUf4nTxVqmRheHTq-HJk,174
2
+ hakuli/optim.py,sha256=bdXwm14zlLEfD2gstrZE1ZzpAOhfrHi1VrkALx05VQE,10341
3
+ hakuli-1.0.0.dist-info/licenses/LICENSE,sha256=Z072a2eA8Ta6Rc8xGDaQtQOJ5gTFdJwVdy1FwFk7St8,11336
4
+ hakuli-1.0.0.dist-info/licenses/NOTICE,sha256=5UuSt4JDDxtHPrklyyfSCn7xNxvw7Nl-kqbaXsDBjSU,1403
5
+ hakuli-1.0.0.dist-info/METADATA,sha256=4qXVAvWUpkjMnv3WCTbxg6T-2GVO0zjfjX8UJiU1j00,8651
6
+ hakuli-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
7
+ hakuli-1.0.0.dist-info/top_level.txt,sha256=RPoyN5id62IFTq_4-ZNlHulldbo-YDdeb4XrCUl9_js,7
8
+ hakuli-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 XAEDRO
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,30 @@
1
+ Hakuli
2
+ Copyright 2026 XAEDRO
3
+
4
+ This product is an independent, clean-room implementation of optimization
5
+ concepts described in the following academic publications. No source code
6
+ from these projects is included in this distribution:
7
+
8
+ - GaLore: Memory-Efficient LLM Training by Gradient Low-Rank Projection.
9
+ J. Zhao, Z. Zhang, B. Chen, Z. Wang, A. Anandkumar, Y. Tian.
10
+ ICML 2024. arXiv:2403.03507
11
+
12
+ - APOLLO: SGD-like Memory, AdamW-level Performance.
13
+ H. Zhu, Z. Zhang, W. Cong, X. Liu, S. Park, V. Chandra, B. Long,
14
+ D. Z. Pan, Z. Wang, J. Lee. MLSys 2025. arXiv:2412.05270
15
+
16
+ - Fira: Can We Achieve Full-Rank Training of LLMs Under Low-rank
17
+ Constraint? X. Chen, K. Feng, C. Li, X. Lai, X. Yue, Y. Yuan, G. Wang.
18
+ NeurIPS 2025. arXiv:2410.01623 (norm-growth limiter concept)
19
+
20
+ - Q-GaLore: Quantized GaLore with INT4 Projection and Layer-Adaptive
21
+ Low-Rank Gradients. Z. Zhang, A. Jaiswal, L. Yin, S. Liu, J. Zhao,
22
+ Y. Tian, Z. Wang. arXiv:2407.08296, 2024
23
+
24
+ The citations above are provided for academic attribution of the underlying
25
+ research ideas only. Hakuli is not affiliated with, endorsed by, or derived
26
+ from the source code of any of these projects. Hakuli was implemented from
27
+ published algorithmic descriptions and independently written source code.
28
+
29
+ "XAEDRO" and "Hakuli" are trademarks of XAEDRO. All other trademarks are
30
+ the property of their respective owners.
@@ -0,0 +1 @@
1
+ hakuli