A Proximal One-step Geometric Orthoptimizer in Pytorch
Project description
A Proximal One-step Geometric Orthoptimizer
This a PyTorch implementation of the POGO algorithm proposed in An Embarrassingly Simple Way to Optimize Orthogonal Matrices at Scale. This is a lightweight and easy-to-use library containing the optimizer as a normal Pytorch Optimizer, and two base optimizers to choose for from now: SGD and Vector Adam.
Beware: You should pass only orthogonal parameters to POGO and initialize them as such. See below!
Installation
You can install pogo from pip by simply running
pip install pogo-torch
Or, if you are using uv, you can add it to your project with
uv add pogo-torch
Alternatively, you can install it directly from the repository:
pip install git+https://github.com/adrianjav/pogo
Getting started
POGO is implemented as a Pytorch optimizer, so it should be quite intuitive to use. Moreover, the default parameters should work for most use cases. If that were not the case, feel free to check the docstrings and ultimately open an issue.
To initialize your parameters as orthogonal, you can either use torch.init.orthogonal_ (but make sure it does what you intend given the shape of your parameters) or use any other initialization method and then project them to be orthogonal. For example:
X = ... # My parameter
U, S, VT = torch.linalg.svd(X, full_matrices=False)
X.data = U @ VT
Then, you can use POGO as any other optimizer:
from pogo import base, POGO
model = ... # Ensure that your parameters are initialized as orthogonal!
optimizer = POGO(model.parameters(), base.VectorAdam(), learning_rate)
for epoch in range(num_epochs):
optimizer.zero_grad()
...
loss.backward()
optimizer.step()
By default, POGO expects matrices of the form [num_matrices, p, n] with $p < n$ and such that torch.bmm(X, X) yields num_matrices identity matries of size $p \times p$. If that does not fit your needs (e.g. you have more than one leading axis, or you need colum-orthogonal matrices), then please do check POGO's flatten_fn and rows parameters.
Citation
@article{javaloy2026pogo,
title = {An Embarrassingly Simple Way to Optimize Orthogonal Matrices at Scale},
author = {Javaloy, Adri{\'a}n and Vergari, Antonio},
year = 2025,
journal = {ArXiv preprint},
volume = {TODO},
url = {https://arxiv.org/abs/TODO}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pogo_torch-1.0.0.tar.gz.
File metadata
- Download URL: pogo_torch-1.0.0.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fcd8c7d2fdc40a89223a4955f1c52299a03766fd729f62d466f7eb890d19c45
|
|
| MD5 |
32e8cc39dc446e59c781c8544b828f05
|
|
| BLAKE2b-256 |
b7420c0b820d4e9bad4c37ce3b23a04810dfff0e9c192a29646a37ec80ebf156
|
Provenance
The following attestation bundles were made for pogo_torch-1.0.0.tar.gz:
Publisher:
publish.yml on adrianjav/pogo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pogo_torch-1.0.0.tar.gz -
Subject digest:
8fcd8c7d2fdc40a89223a4955f1c52299a03766fd729f62d466f7eb890d19c45 - Sigstore transparency entry: 957047145
- Sigstore integration time:
-
Permalink:
adrianjav/pogo@9442f695816f181220eafe6e496091af7b0ac8ec -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adrianjav
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9442f695816f181220eafe6e496091af7b0ac8ec -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pogo_torch-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pogo_torch-1.0.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3730db67dbe349b3309873590dfb9744ad9f7152e3a1a28b52b47d05ff334c6
|
|
| MD5 |
4d4484197a1692cdfc3a6c828864ab3e
|
|
| BLAKE2b-256 |
6c9eaf89379f51f20defa7ad5c03ad68cb2838df8372ce780ec83b3d1b2ac50c
|
Provenance
The following attestation bundles were made for pogo_torch-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on adrianjav/pogo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pogo_torch-1.0.0-py3-none-any.whl -
Subject digest:
b3730db67dbe349b3309873590dfb9744ad9f7152e3a1a28b52b47d05ff334c6 - Sigstore transparency entry: 957047190
- Sigstore integration time:
-
Permalink:
adrianjav/pogo@9442f695816f181220eafe6e496091af7b0ac8ec -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adrianjav
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9442f695816f181220eafe6e496091af7b0ac8ec -
Trigger Event:
workflow_dispatch
-
Statement type: