Text Generation
Transformers
GGUF
English
nvidia
math
reasoning
post-training
qwen
imatrix
conversational
Instructions to use gabriellarson/NFT-32B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gabriellarson/NFT-32B-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gabriellarson/NFT-32B-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("gabriellarson/NFT-32B-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use gabriellarson/NFT-32B-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf gabriellarson/NFT-32B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf gabriellarson/NFT-32B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf gabriellarson/NFT-32B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf gabriellarson/NFT-32B-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf gabriellarson/NFT-32B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf gabriellarson/NFT-32B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf gabriellarson/NFT-32B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf gabriellarson/NFT-32B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/gabriellarson/NFT-32B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use gabriellarson/NFT-32B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gabriellarson/NFT-32B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gabriellarson/NFT-32B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/gabriellarson/NFT-32B-GGUF:Q4_K_M
- SGLang
How to use gabriellarson/NFT-32B-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "gabriellarson/NFT-32B-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gabriellarson/NFT-32B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "gabriellarson/NFT-32B-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gabriellarson/NFT-32B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use gabriellarson/NFT-32B-GGUF with Ollama:
ollama run hf.co/gabriellarson/NFT-32B-GGUF:Q4_K_M
- Unsloth Studio
How to use gabriellarson/NFT-32B-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for gabriellarson/NFT-32B-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for gabriellarson/NFT-32B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for gabriellarson/NFT-32B-GGUF to start chatting
- Pi
How to use gabriellarson/NFT-32B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gabriellarson/NFT-32B-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "gabriellarson/NFT-32B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use gabriellarson/NFT-32B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gabriellarson/NFT-32B-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default gabriellarson/NFT-32B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use gabriellarson/NFT-32B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gabriellarson/NFT-32B-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "gabriellarson/NFT-32B-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use gabriellarson/NFT-32B-GGUF with Docker Model Runner:
docker model run hf.co/gabriellarson/NFT-32B-GGUF:Q4_K_M
- Lemonade
How to use gabriellarson/NFT-32B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull gabriellarson/NFT-32B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.NFT-32B-GGUF-Q4_K_M
List all available models
lemonade list
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- BytedTsinghua-SIA/DAPO-Math-17k
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
base_model:
|
| 7 |
+
- nvidia/NFT-32B
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
license: other
|
| 10 |
+
license_name: nvidia-non-commercial-license
|
| 11 |
+
license_link: https://huggingface.co/nvidia/NFT-32B/blob/main/LICENSE
|
| 12 |
+
library_name: transformers
|
| 13 |
+
tags:
|
| 14 |
+
- nvidia
|
| 15 |
+
- math
|
| 16 |
+
- reasoning
|
| 17 |
+
- post-training
|
| 18 |
+
- qwen
|
| 19 |
+
---
|
| 20 |
+
# Negative-aware Fine-Tuning: Bridging Supervised Learning and Reinforcement Learning in Math Reasoning
|
| 21 |
+
|
| 22 |
+
> [!Warning]
|
| 23 |
+
> <div align="center">
|
| 24 |
+
> <b>
|
| 25 |
+
> 🚨 NFT-32B is specifically designed for mathematical reasoning tasks. We do not recommend using this model for general conversation or non-mathematical tasks.
|
| 26 |
+
> </b>
|
| 27 |
+
> </div>
|
| 28 |
+
|
| 29 |
+
**Tsinghua University, NVIDIA, Stanford University**
|
| 30 |
+
|
| 31 |
+
[Huayu Chen](https://github.com/chendrag), [Kaiwen Zheng](https://github.com/kaiwenzheng), [Qinsheng Zhang](https://github.com/qzhang), [Ganqu Cui](https://github.com/ganqucui), [Yin Cui](https://research.nvidia.com/person/yin-cui), [Haotian Ye](https://github.com/haotianye), [Tsung-Yi Lin](https://research.nvidia.com/person/tsung-yi-lin), [Ming-Yu Liu](https://research.nvidia.com/person/ming-yu-liu), [Jun Zhu](https://ml.cs.tsinghua.edu.cn/~jun/index.shtml), [Haoxiang Wang](https://research.nvidia.com/person/haoxiang-wang)
|
| 32 |
+
|
| 33 |
+
[[Paper](https://arxiv.org/abs/2505.18116)] | [[Blog](https://research.nvidia.com/labs/dir/Negative-aware-Fine-Tuning/)] | [[Code](https://github.com/nvidia/NFT)] | [[Dataset](https://huggingface.co/datasets/BytedTsinghua-SIA/DAPO-Math-17k)] | [[Models](https://huggingface.co/collections/nvidia/nft-models)] | [[Citation](#citation)]
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
|
| 37 |
+
## Model Overview
|
| 38 |
+
|
| 39 |
+
### Description
|
| 40 |
+
|
| 41 |
+
NFT-32B is a math reasoning model finetuned from [Qwen2.5-32B](https://huggingface.co/Qwen/Qwen2.5-32B) using the Negative-aware Fine-Tuning (NFT) algorithm. NFT is a supervised learning approach that enables LLMs to reflect on their failures and improve autonomously with no external teachers. Unlike traditional supervised methods that discard incorrect answers, NFT constructs an implicit negative policy to model and learn from these failures, achieving performance comparable to leading RL algorithms like GRPO and DAPO.
|
| 42 |
+
|
| 43 |
+
This larger 32B model demonstrates strong scaling properties, achieving substantial improvements in mathematical reasoning while maintaining the efficiency of supervised learning methods.
|
| 44 |
+
|
| 45 |
+
This model is for research and development only.
|
| 46 |
+
|
| 47 |
+
### Model Developer
|
| 48 |
+
|
| 49 |
+
NVIDIA, Tsinghua University, Stanford University
|
| 50 |
+
|
| 51 |
+
### License
|
| 52 |
+
|
| 53 |
+
[NVIDIA Non-Commercial License](https://huggingface.co/nvidia/NFT-32B/blob/main/LICENSE)
|
| 54 |
+
|
| 55 |
+
This model is released under the NVIDIA Non-Commercial License. The model is for research and development only.
|
| 56 |
+
|
| 57 |
+
### Deployment Geography
|
| 58 |
+
|
| 59 |
+
Global
|
| 60 |
+
|
| 61 |
+
### Release Date
|
| 62 |
+
|
| 63 |
+
Huggingface 06/27/2025
|
| 64 |
+
|
| 65 |
+
- NFT-7B: https://huggingface.co/nvidia/NFT-7B/
|
| 66 |
+
- NFT-32B: https://huggingface.co/nvidia/NFT-32B/
|
| 67 |
+
|
| 68 |
+
### Use Case
|
| 69 |
+
|
| 70 |
+
Mathematical reasoning and problem-solving, including:
|
| 71 |
+
- Competition-level mathematics (AIME, AMC, Olympiad)
|
| 72 |
+
- General mathematical reasoning (MATH500, Minerva Math)
|
| 73 |
+
- Step-by-step mathematical solution generation
|
| 74 |
+
|
| 75 |
+
## Model Architecture
|
| 76 |
+
|
| 77 |
+
**Architecture Type:** Transformer decoder-only language model
|
| 78 |
+
|
| 79 |
+
**Network Architecture:** Qwen2.5 with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
|
| 80 |
+
|
| 81 |
+
NFT-32B is post-trained based on [Qwen2.5-32B](https://huggingface.co/Qwen/Qwen2.5-32B) and follows the same model architecture:
|
| 82 |
+
- Number of Parameters: 32.5B
|
| 83 |
+
- Number of Parameters (Non-Embedding): 31.0B
|
| 84 |
+
- Number of Layers: 64
|
| 85 |
+
- Number of Attention Heads (GQA): 40 for Q and 8 for KV
|
| 86 |
+
|
| 87 |
+
## Input
|
| 88 |
+
|
| 89 |
+
**Input Type(s):** Text
|
| 90 |
+
|
| 91 |
+
**Input Format:** String
|
| 92 |
+
|
| 93 |
+
**Input Parameters:** One-dimensional (1D)
|
| 94 |
+
|
| 95 |
+
**Other Properties Related to Input:**
|
| 96 |
+
- Context length up to 131,072 tokens
|
| 97 |
+
- Mathematical problems should be clearly stated
|
| 98 |
+
- Supports LaTeX notation for mathematical expressions
|
| 99 |
+
|
| 100 |
+
## Output
|
| 101 |
+
|
| 102 |
+
**Output Type(s):** Text
|
| 103 |
+
|
| 104 |
+
**Output Format:** String
|
| 105 |
+
|
| 106 |
+
**Output Parameters:** One-dimensional (1D)
|
| 107 |
+
|
| 108 |
+
**Other Properties Related to Output:**
|
| 109 |
+
- Step-by-step mathematical reasoning
|
| 110 |
+
- Final answers should be enclosed in `\boxed{}`
|
| 111 |
+
- Supports LaTeX notation for mathematical expressions
|
| 112 |
+
- Can generate up to 8,192 tokens
|
| 113 |
+
|
| 114 |
+
## Software Integration
|
| 115 |
+
|
| 116 |
+
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA’s hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
|
| 117 |
+
|
| 118 |
+
**Runtime Engine(s):**
|
| 119 |
+
- Transformers (4.37.0+)
|
| 120 |
+
- vLLM
|
| 121 |
+
- TensorRT-LLM
|
| 122 |
+
|
| 123 |
+
**Supported Hardware Microarchitecture Compatibility:**
|
| 124 |
+
- NVIDIA Ampere
|
| 125 |
+
- NVIDIA Hopper
|
| 126 |
+
- NVIDIA Blackwell
|
| 127 |
+
|
| 128 |
+
**Operating System(s):**
|
| 129 |
+
- Linux
|
| 130 |
+
|
| 131 |
+
**Model version:** v1.0
|
| 132 |
+
|
| 133 |
+
## Training Method
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
|
| 137 |
+
The NFT training pipeline consists of three main components:
|
| 138 |
+
|
| 139 |
+
1. **Data Collection:** The model generates answers to math questions, which are split into positive (correct) and negative (incorrect) datasets based on answer correctness.
|
| 140 |
+
|
| 141 |
+
2. **Implicit Negative Policy:** NFT constructs an implicit negative policy to model negative answers, parameterized with the same positive policy targeted for optimization, enabling direct policy optimization on all generations.
|
| 142 |
+
|
| 143 |
+
3. **Policy Optimization:** Both positive and negative answers are used to optimize the LLM policy via supervised learning with the NFT objective:
|
| 144 |
+
|
| 145 |
+
```
|
| 146 |
+
L_NFT(θ) = r[-log(π_θ⁺(a|q) / π(a|q))] + (1-r)[-log((1 - r_q * (π_θ⁺(a|q) / π(a|q))) / (1-r_q))]
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
|
| 151 |
+
## Training Datasets
|
| 152 |
+
|
| 153 |
+
**Dataset:** [DAPO-Math-17k](https://huggingface.co/datasets/BytedTsinghua-SIA/DAPO-Math-17k)
|
| 154 |
+
|
| 155 |
+
**Dataset Size:** 17k (math problems)
|
| 156 |
+
|
| 157 |
+
**Data Collection Method:** Automated
|
| 158 |
+
|
| 159 |
+
**Labeling Method by dataset**: Automated
|
| 160 |
+
|
| 161 |
+
The whole dataset is used for training. We directly evaluate the model on several other math evaluation datasets.
|
| 162 |
+
|
| 163 |
+
## Evaluation Datasets
|
| 164 |
+
|
| 165 |
+
NFT-32B is evaluated on 6 mathematical reasoning benchmarks:
|
| 166 |
+
- **AIME 2024 (30 problems) & 2025 (30 problems):** American Invitational Mathematics Examination
|
| 167 |
+
- **AMC 2023 (40 problems):** American Mathematics Competitions
|
| 168 |
+
- **MATH500 (500 problems):** A subset of the MATH dataset
|
| 169 |
+
- **OlympiadBench (675 problems):** International Mathematical Olympiad problems
|
| 170 |
+
- **Minerva Math (272 problems):** Google's mathematical reasoning benchmark
|
| 171 |
+
|
| 172 |
+
**Data Collection Method:** Human
|
| 173 |
+
|
| 174 |
+
**Labeling Method by dataset**: Human
|
| 175 |
+
|
| 176 |
+
## Performance
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
|
| 180 |
+
NFT-32B achieves state-of-the-art performance among supervised learning methods for mathematical reasoning:
|
| 181 |
+
|
| 182 |
+
| Benchmark | NFT-32B | Qwen2.5-32B | Improvement |
|
| 183 |
+
|-----------|---------|-------------|-------------|
|
| 184 |
+
| AIME24 (avg@32) | 37.8% | 4.1% | +33.7% |
|
| 185 |
+
| AIME25 (avg@32) | 31.5% | 1.0% | +30.5% |
|
| 186 |
+
| MATH500 | 88.4% | 68.6% | +19.8% |
|
| 187 |
+
| AMC23 (avg@32) | 93.8% | 45.0% | +48.8% |
|
| 188 |
+
| OlympiadBench | 55.0% | 31.1% | +23.9% |
|
| 189 |
+
| Minerva Math | 48.9% | 27.9% | +21.0% |
|
| 190 |
+
| **Average** | **59.2%** | **29.6%** | **+29.6%** |
|
| 191 |
+
|
| 192 |
+
Notably, NFT-32B performs similarly to DAPO (59.2% vs 59.9%) while using a simpler supervised learning approach.
|
| 193 |
+
|
| 194 |
+

|
| 195 |
+
|
| 196 |
+
## Usage
|
| 197 |
+
|
| 198 |
+
> [!Important]
|
| 199 |
+
> **NFT-32B** is optimized for mathematical reasoning tasks. For best results, use clear mathematical prompts and request step-by-step reasoning.
|
| 200 |
+
|
| 201 |
+
The model can be used with the Hugging Face Transformers library:
|
| 202 |
+
|
| 203 |
+
```python
|
| 204 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 205 |
+
model_name = "nvidia/NFT-32B"
|
| 206 |
+
device = "cuda" # the device to load the model onto
|
| 207 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 208 |
+
model_name,
|
| 209 |
+
torch_dtype="auto",
|
| 210 |
+
device_map="auto"
|
| 211 |
+
)
|
| 212 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 213 |
+
# Example math problem
|
| 214 |
+
problem = "Find the value of $x$ that satisfies the equation $\\sqrt{x+7} = x-5$."
|
| 215 |
+
# Format the prompt to encourage step-by-step reasoning
|
| 216 |
+
prompt = f"{problem}\nPlease reason step by step, and put your final answer within \\boxed{{}}."
|
| 217 |
+
messages = [
|
| 218 |
+
{"role": "user", "content": prompt}
|
| 219 |
+
]
|
| 220 |
+
text = tokenizer.apply_chat_template(
|
| 221 |
+
messages,
|
| 222 |
+
tokenize=False,
|
| 223 |
+
add_generation_prompt=True
|
| 224 |
+
)
|
| 225 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
| 226 |
+
# Generate response
|
| 227 |
+
generated_ids = model.generate(
|
| 228 |
+
**model_inputs,
|
| 229 |
+
max_new_tokens=512,
|
| 230 |
+
temperature=0 # Use 0 for deterministic output
|
| 231 |
+
)
|
| 232 |
+
generated_ids = [
|
| 233 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 234 |
+
]
|
| 235 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 236 |
+
print(response)
|
| 237 |
+
```
|
| 238 |
+
|
| 239 |
+
### Usage Recommendations
|
| 240 |
+
|
| 241 |
+
1. **Temperature:** Use temperature=0 for deterministic outputs, or 0.1-0.3 for slight variation
|
| 242 |
+
2. **Sampling:** For best results on competition problems, consider using multiple samples with majority voting
|
| 243 |
+
3. **Format:** Include instructions for step-by-step reasoning directly in the user prompt
|
| 244 |
+
4. **Final Answer:** Instruct the model to put the final answer in `\boxed{}`
|
| 245 |
+
5. **Long Context:** This model supports up to 131K tokens context, making it suitable for complex multi-step problems
|
| 246 |
+
6. **Language:** This model is primarily trained on English mathematical problems
|
| 247 |
+
|
| 248 |
+
## Requirements
|
| 249 |
+
|
| 250 |
+
The code of Qwen2.5 has been integrated into Hugging Face `transformers`, and we recommend using the latest version:
|
| 251 |
+
- `transformers>=4.37.0`
|
| 252 |
+
|
| 253 |
+
## Citation
|
| 254 |
+
If you find our project helpful, please consider citing
|
| 255 |
+
```bibtex
|
| 256 |
+
@article{chen2025bridging,
|
| 257 |
+
title = {Bridging Supervised Learning and Reinforcement Learning in Math Reasoning},
|
| 258 |
+
author = {Huayu Chen, Kaiwen Zheng, Qinsheng Zhang, Ganqu Cui, Yin Cui, Haotian Ye, Tsung-Yi Lin, Ming-Yu Liu, Jun Zhu, Haoxiang Wang},
|
| 259 |
+
journal = {arXiv preprint arXiv:2505.18116},
|
| 260 |
+
year = {2025}
|
| 261 |
+
}
|
| 262 |
+
```
|
| 263 |
+
|
| 264 |
+
## Known Limitations
|
| 265 |
+
|
| 266 |
+
1. **Domain Specificity:** This model is specifically trained for mathematical reasoning and may not perform well on general conversation or non-mathematical tasks
|
| 267 |
+
2. **Calculation Errors:** While the model shows strong reasoning abilities, it may still make arithmetic errors in complex calculations
|
| 268 |
+
3. **Context Understanding:** The model may struggle with problems requiring real-world context or domain knowledge outside mathematics
|
| 269 |
+
4. **Resource Requirements:** The 32B model requires significant GPU memory for inference
|
| 270 |
+
|
| 271 |
+
## Bias Considerations
|
| 272 |
+
|
| 273 |
+
The model is trained on mathematical problems which are inherently objective. However, the training data may reflect biases in problem selection, difficulty distribution, and mathematical notation preferences from the source datasets.
|
| 274 |
+
|
| 275 |
+
## Inference:
|
| 276 |
+
- **Acceleration Engine:** TensorRT-LLM, vLLM, SGLang
|
| 277 |
+
- **Test Hardware:** NVIDIA H100
|
| 278 |
+
|
| 279 |
+
## Ethical Considerations
|
| 280 |
+
|
| 281 |
+
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
|
| 282 |
+
|
| 283 |
+
Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
|