Skip to main content

Number Token Loss - A regression-alike loss to improve numerical reasoning in language models

Project description

NTLoss - a regression-like loss for LLMs

Paper Landing Demo CI License PyPI Docs Downloads

ntloss is a PyPI package of the "Number Token Loss" for language models. A regression-like loss that improves LLM performance on math tasks. Follows Regress, Don't Guess, ICML 2025


📖 Overview

This repo maintains the code for the ntloss PyPI package

🏃‍♂️ Quick Start

Simply install ntloss into your existing project

uv add ntloss
pip install ntloss # if you are oldschool

Use like this:

from ntloss import NTLoss as NTL
ntl = NTL(tokenizer=tokenizer)
loss = ntl(logits, labels)

NOTE: ntloss is currently in alpha phase and pre-release. Feedback & PRs are very welcome.

📝 Citation

If you use ntloss, please cite our paper:

@inproceedings{zausinger2025regress,
  title   = {Regress, Don't Guess – A Regression-like Loss on Number Tokens for Language Models},
  author  = {Jonas Zausinger and Lars Pennig and Anamarija Kozina and Sean Sdahl
             and Julian Sikora and Adrian Dendorfer and Timofey Kuznetsov
             and Mohamad Hagog and Nina Wiedemann and Kacper Chlodny
             and Vincent Limbach and Anna Ketteler and Thorben Prein
             and Vishwa Mohan Singh and Michael Danziger and Jannis Born},
  booktitle = {Proc. of the 42nd International Conference on Machine Learning (ICML)},
  year    = {2025},
  url     = {https://ibm.biz/ntl-main}
}

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

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

ntloss-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

ntloss-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file ntloss-0.1.0.tar.gz.

File metadata

  • Download URL: ntloss-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.11

File hashes

Hashes for ntloss-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51ac86b78b3090ca3bcb5b3f6cff789bede1a7fa438c97d120a89a26556b46c9
MD5 04e2e96196c76941d68652048cfc67ad
BLAKE2b-256 f2af4260afeb47b2bdfe5a7866e3e33091295267e415e5bab85c1b27686e88b7

See more details on using hashes here.

File details

Details for the file ntloss-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ntloss-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.11

File hashes

Hashes for ntloss-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b621007e119b02b5e8716d5043257e6699b840fdd286bade48a0d8dd5c4d906
MD5 cb3fdb6b2105c415293005021a00a206
BLAKE2b-256 abb895bc049e07225c8ecc15b8889d681f704d816945dd2c92f1669a1f3d6481

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