Skip to main content

UltraMem

Project description

UltraMem

Implementation of UltraMem, improved Product Key Memory design, from Bytedance AI labs

Install

$ pip install ultra-mem

Usage

import torch
from ultra_mem import UltraMem

ultra_mem = UltraMem(
    dim = 512,
    core_heads = 2,
    topk = 32,
)

tokens = torch.randn(1, 1024, 512)

out, mem_indices, aux_loss = ultra_mem(tokens) # (1, 1024, 512), (2, 1, 1024, 32), ()

Char-level LM

$ uv run train.py

Citations

@misc{huang2025ultrasparsememorynetwork,
    title   = {Ultra-Sparse Memory Network}, 
    author  = {Zihao Huang and Qiyang Min and Hongzhi Huang and Defa Zhu and Yutao Zeng and Ran Guo and Xun Zhou},
    year    = {2025},
    eprint  = {2411.12364},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2411.12364}, 
}
@inproceedings{anonymous2025continual,
    title   = {Continual Learning via Sparse Memory Finetuning},
    author  = {Anonymous},
    booktitle = {Submitted to The Fourteenth International Conference on Learning Representations},
    year    = {2025},
    url     = {https://openreview.net/forum?id=LGo7U1m24L},
    note    = {under review}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ultra_mem-0.1.1.tar.gz (36.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ultra_mem-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file ultra_mem-0.1.1.tar.gz.

File metadata

  • Download URL: ultra_mem-0.1.1.tar.gz
  • Upload date:
  • Size: 36.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for ultra_mem-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0588d4786523a23b8b9f1bcf8a0c36099f7f2fb63c6ba4b4547dc6fed28587f6
MD5 61c5b035c4ceea94b15d436dac32357a
BLAKE2b-256 691c362b0866443a4e9c419b12e1cacf5521aee54292d229f08171c186186962

See more details on using hashes here.

File details

Details for the file ultra_mem-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ultra_mem-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for ultra_mem-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 770fbd51a6c7c72aa544d76fd15a91b0e366eaafcaff3e1ab19dcf2d45dcdf64
MD5 10072dc0cbfa6ea1f26c5ae5dce60ea7
BLAKE2b-256 d50ad28a9ecb9d7ce461cc3b2f83b88784b4932008bdad01faab8952293ef232

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page