Text Generation
Transformers
Safetensors
English
qwen3
rule-based reasoning
conversational
text-generation-inference
Instructions to use RuleReasoner/RuleReasoner-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RuleReasoner/RuleReasoner-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RuleReasoner/RuleReasoner-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RuleReasoner/RuleReasoner-4B") model = AutoModelForCausalLM.from_pretrained("RuleReasoner/RuleReasoner-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use RuleReasoner/RuleReasoner-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RuleReasoner/RuleReasoner-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RuleReasoner/RuleReasoner-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RuleReasoner/RuleReasoner-4B
- SGLang
How to use RuleReasoner/RuleReasoner-4B 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 "RuleReasoner/RuleReasoner-4B" \ --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": "RuleReasoner/RuleReasoner-4B", "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 "RuleReasoner/RuleReasoner-4B" \ --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": "RuleReasoner/RuleReasoner-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RuleReasoner/RuleReasoner-4B with Docker Model Runner:
docker model run hf.co/RuleReasoner/RuleReasoner-4B
Improve pipeline tag and add link to code (#1)
Browse files- Improve pipeline tag and add link to code (2e0f0e953f2614545753958cfe4be46db0c83b3c)
Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>
README.md
CHANGED
|
@@ -1,20 +1,22 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
datasets:
|
| 4 |
- RuleReasoner/rule-reasoning
|
| 5 |
language:
|
| 6 |
- en
|
|
|
|
|
|
|
| 7 |
metrics:
|
| 8 |
- accuracy
|
| 9 |
-
|
| 10 |
-
- Qwen/Qwen3-4B-Base
|
| 11 |
-
new_version: RuleReasoner/RuleReasoner-4B
|
| 12 |
-
pipeline_tag: question-answering
|
| 13 |
-
library_name: transformers
|
| 14 |
tags:
|
| 15 |
- rule-based reasoning
|
|
|
|
| 16 |
---
|
|
|
|
| 17 |
If you use the model in your research, please cite the original papers as below.
|
|
|
|
| 18 |
```latex
|
| 19 |
@article{liu2025rulereasoner,
|
| 20 |
title={RuleReasoner: Reinforced Rule-based Reasoning via Domain-aware Dynamic Sampling},
|
|
@@ -25,4 +27,6 @@ If you use the model in your research, please cite the original papers as below.
|
|
| 25 |
primaryClass={cs.CL},
|
| 26 |
url={https://arxiv.org/abs/2506.08672},
|
| 27 |
}
|
| 28 |
-
```
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Qwen/Qwen3-4B-Base
|
| 4 |
datasets:
|
| 5 |
- RuleReasoner/rule-reasoning
|
| 6 |
language:
|
| 7 |
- en
|
| 8 |
+
library_name: transformers
|
| 9 |
+
license: mit
|
| 10 |
metrics:
|
| 11 |
- accuracy
|
| 12 |
+
pipeline_tag: text-generation
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
tags:
|
| 14 |
- rule-based reasoning
|
| 15 |
+
new_version: RuleReasoner/RuleReasoner-4B
|
| 16 |
---
|
| 17 |
+
|
| 18 |
If you use the model in your research, please cite the original papers as below.
|
| 19 |
+
|
| 20 |
```latex
|
| 21 |
@article{liu2025rulereasoner,
|
| 22 |
title={RuleReasoner: Reinforced Rule-based Reasoning via Domain-aware Dynamic Sampling},
|
|
|
|
| 27 |
primaryClass={cs.CL},
|
| 28 |
url={https://arxiv.org/abs/2506.08672},
|
| 29 |
}
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
Code: https://github.com/bigai-nlco/RuleReasoner
|