<div align="center">
# `NTLoss` - a regression-like loss for LLMs
[](https://arxiv.org/abs/2411.02083)
[](https://tum-ai.github.io/number-token-loss/)
[](https://huggingface.co/spaces/jannisborn/NumberTokenLoss)
[](https://github.com/AI4SD/number-token-loss/actions/workflows/ci.yaml)
[](LICENSE)
[](https://badge.fury.io/py/ntloss)
[](https://pepy.tech/project/ntloss)
*`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](https://arxiv.org/abs/2411.02083)*
</div>
---
## 📖 Overview
This repo maintains the code for the `ntloss` [PyPI package](https://pypi.org/project/ntloss/)
- 📄 **Paper source code**: [Regress, Don't Guess – A Regression-like Loss on Number Tokens for Language Models](https://github.com/tum-ai/number-token-loss)
- 📄 **Paper**: [Regress, Don't Guess – A Regression-like Loss on Number Tokens for Language Models](https://arxiv.org/abs/2411.02083)
- 🌐 **Project Page**: [https://tum-ai.github.io/number-token-loss/](https://tum-ai.github.io/number-token-loss/)
- 🎮 **Interactive Demo**: [https://huggingface.co/spaces/jannisborn/NumberTokenLoss](https://huggingface.co/spaces/jannisborn/NumberTokenLoss)
## 🏃♂️ Quick Start
Simply install `ntloss` into your existing project
```sh
uv add ntloss
pip install ntloss # if you are oldschool
```
Use like this:
```py
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:
```bibtex
@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://tum-ai.github.io/number-token-loss/}
}
```
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "ntloss",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "Machine Learning, Language Models, Number Token Loss, AI4Math, LLM, LLM Training, Reasoning models",
"author": null,
"author_email": "Jannis Born <jab@zurich.ibm.com>, Lars Pennig <lpennig@t-online.de>, Jonas Zausinger <jonas.zausinger@tum.de>, Sarah de Ruiter <Sarah.Louise.De.Ruiter@ibm.com>",
"download_url": "https://files.pythonhosted.org/packages/b6/03/3bf3fd85bb5a374cfccb7bbfcd8477d10e00a928b3e09427de143ab2c5c4/ntloss-0.0.3.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n\n# `NTLoss` - a regression-like loss for LLMs\n\n\n[](https://arxiv.org/abs/2411.02083)\n[](https://tum-ai.github.io/number-token-loss/)\n[](https://huggingface.co/spaces/jannisborn/NumberTokenLoss)\n[](https://github.com/AI4SD/number-token-loss/actions/workflows/ci.yaml)\n[](LICENSE)\n[](https://badge.fury.io/py/ntloss)\n[](https://pepy.tech/project/ntloss)\n\n*`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](https://arxiv.org/abs/2411.02083)*\n\n\n</div>\n\n---\n\n## \ud83d\udcd6 Overview\nThis repo maintains the code for the `ntloss` [PyPI package](https://pypi.org/project/ntloss/)\n\n- \ud83d\udcc4 **Paper source code**: [Regress, Don't Guess \u2013 A Regression-like Loss on Number Tokens for Language Models](https://github.com/tum-ai/number-token-loss)\n\n- \ud83d\udcc4 **Paper**: [Regress, Don't Guess \u2013 A Regression-like Loss on Number Tokens for Language Models](https://arxiv.org/abs/2411.02083)\n- \ud83c\udf10 **Project Page**: [https://tum-ai.github.io/number-token-loss/](https://tum-ai.github.io/number-token-loss/)\n- \ud83c\udfae **Interactive Demo**: [https://huggingface.co/spaces/jannisborn/NumberTokenLoss](https://huggingface.co/spaces/jannisborn/NumberTokenLoss)\n\n## \ud83c\udfc3\u200d\u2642\ufe0f Quick Start\n\n\nSimply install `ntloss` into your existing project\n```sh\nuv add ntloss\npip install ntloss # if you are oldschool\n```\n\nUse like this:\n```py\nfrom ntloss import NTLoss as NTL\nntl = NTL(tokenizer=tokenizer)\nloss = ntl(logits, labels)\n```\n\nNOTE: `ntloss` is currently in alpha phase and pre-release. Feedback & PRs are very welcome.\n\n\n## \ud83d\udcdd Citation\n\nIf you use `ntloss`, please cite our paper:\n\n```bibtex\n@inproceedings{zausinger2025regress,\n title = {Regress, Don't Guess \u2013 A Regression-like Loss on Number Tokens for Language Models},\n author = {Jonas Zausinger and Lars Pennig and Anamarija Kozina and Sean Sdahl\n and Julian Sikora and Adrian Dendorfer and Timofey Kuznetsov\n and Mohamad Hagog and Nina Wiedemann and Kacper Chlodny\n and Vincent Limbach and Anna Ketteler and Thorben Prein\n and Vishwa Mohan Singh and Michael Danziger and Jannis Born},\n booktitle = {Proc. of the 42nd International Conference on Machine Learning (ICML)},\n year = {2025},\n url = {https://tum-ai.github.io/number-token-loss/}\n}\n```\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Number Token Loss - A regression-alike loss to improve numerical reasoning in language models",
"version": "0.0.3",
"project_urls": {
"Bug Tracker": "https://github.com/AI4SD/number-token-loss/issues",
"Demo": "https://huggingface.co/spaces/jannisborn/NumberTokenLoss",
"Landing Page": "https://tum-ai.github.io/number-token-loss/",
"Paper": "https://arxiv.org/abs/2411.02083",
"Source code": "https://github.com/AI4SD/number-token-loss"
},
"split_keywords": [
"machine learning",
" language models",
" number token loss",
" ai4math",
" llm",
" llm training",
" reasoning models"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "93c59323e686a45bdad802a5ea6ba583021531cefbdc68805494e0b7f1d596d5",
"md5": "10b8ee02485b5449c5401c3952c77c14",
"sha256": "7fa2a23ade0c934e5ad63e766333e809f92b8e7f2d284eb1ddcf5a09567a8d4d"
},
"downloads": -1,
"filename": "ntloss-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "10b8ee02485b5449c5401c3952c77c14",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6516,
"upload_time": "2025-08-08T17:13:27",
"upload_time_iso_8601": "2025-08-08T17:13:27.333155Z",
"url": "https://files.pythonhosted.org/packages/93/c5/9323e686a45bdad802a5ea6ba583021531cefbdc68805494e0b7f1d596d5/ntloss-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b6033bf3fd85bb5a374cfccb7bbfcd8477d10e00a928b3e09427de143ab2c5c4",
"md5": "020377827bbf1d6c27aa4acb9f378f2d",
"sha256": "f2be4a22fbc87848da2d0710499b02fe3e10b9e5f857edcf9a14f38b26475e70"
},
"downloads": -1,
"filename": "ntloss-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "020377827bbf1d6c27aa4acb9f378f2d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 8088,
"upload_time": "2025-08-08T17:13:28",
"upload_time_iso_8601": "2025-08-08T17:13:28.281443Z",
"url": "https://files.pythonhosted.org/packages/b6/03/3bf3fd85bb5a374cfccb7bbfcd8477d10e00a928b3e09427de143ab2c5c4/ntloss-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-08 17:13:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AI4SD",
"github_project": "number-token-loss",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ntloss"
}