TorchYAND: A Matrix-Free PyTorch Implementation for Higher-Moment Portfolio Optimization

Hi everyone,

I’ve been experimenting with implementing optimization algorithms in PyTorch as a side project.

TorchYAND is a PyTorch implementation of the YAND-MVSK algorithm for higher-moment portfolio optimization.

Some features:

  • Matrix-free derivatives and Hessian-vector products

  • Batched preconditioned conjugate gradient (PCG)

  • Simplex-constrained portfolio optimization

  • CPU/CUDA support and numerical validation

I’ve also been exploring torch.compile for GPU acceleration. In one Tesla T4 experiment, a compiled PCG approach reduced end-to-end solve time from 22.9s to 9.6s (~2.38x), although this remains an experimental optimization.

GitHub: GitHub - JohnnyZPiggy/TorchYAND: PyTorch implementation of YAND-MVSK higher-moment portfolio optimization · GitHub

I’d be happy to hear any feedback or suggestions, especially on numerical methods and GPU performance!