dipta007 zabir-nabil commited on
Commit
a8a9da2
·
verified ·
1 Parent(s): cfe04b0

updated readme (#1)

Browse files

- updated readme (6d8c1817b863039f76f1f085ea8c684f137560bf)


Co-authored-by: Zabir Al Nazi <zabir-nabil@users.noreply.huggingface.co>

Files changed (1) hide show
  1. README.md +64 -8
README.md CHANGED
@@ -25,8 +25,8 @@ datasets:
25
 
26
  # DAGGER-4B-GRPO
27
 
28
- <a href="https://arxiv.org/abs/XXXX.XXXXX" target="_blank">
29
- <img alt="arXiv" src="https://img.shields.io/badge/arXiv-XXXX.XXXXX-b31b1b" style="display: inline-block; vertical-align: middle;"/>
30
  </a>
31
  <a href="https://github.com/dipta007/dagger" target="_blank">
32
  <img alt="GitHub" src="https://img.shields.io/badge/GitHub-Code-black" style="display: inline-block; vertical-align: middle;"/>
@@ -80,18 +80,66 @@ model = AutoModelForCausalLM.from_pretrained(
80
  device_map="auto"
81
  )
82
 
83
- question = "মিনার কাছে ১০০টি কলম আছে। প্রতিটি কলমের দাম টাকা।"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  messages = [
86
- {"role": "system", "content": "You are an expert Bangla Math Reasoner. Solve by constructing a Computational Graph."},
87
- {"role": "user", "content": question}
88
  ]
89
 
90
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
91
- inputs = tokenizer([text], return_tensors="pt").to(model.device)
92
 
93
- outputs = model.generate(**inputs, max_new_tokens=1024)
 
94
  response = tokenizer.decode(outputs[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
 
95
  print(response)
96
  ```
97
 
@@ -133,5 +181,13 @@ For 4B models, always use SFT initialization before GRPO:
133
  ## Citation
134
 
135
  ```bibtex
136
- will be updated
 
 
 
 
 
 
 
 
137
  ```
 
25
 
26
  # DAGGER-4B-GRPO
27
 
28
+ <a href="https://arxiv.org/abs/2601.06853" target="_blank">
29
+ <img alt="arXiv" src="https://img.shields.io/badge/arXiv-2601.06853-b31b1b" style="display: inline-block; vertical-align: middle;"/>
30
  </a>
31
  <a href="https://github.com/dipta007/dagger" target="_blank">
32
  <img alt="GitHub" src="https://img.shields.io/badge/GitHub-Code-black" style="display: inline-block; vertical-align: middle;"/>
 
80
  device_map="auto"
81
  )
82
 
83
+ USER_PROMPT_TEMPLATE = """You are an expert Bengali Math Reasoner. Your task is to solve mathematical problems by constructing a "Computational Graph".
84
+
85
+ ### Graph Rules:
86
+ - `id`: Unique identifier (e.g., "n1", "n2").
87
+ - `val`: The raw number extracted from text (for input nodes).
88
+ - `op`: The operation (`add`, `sub`, `mul`, `div`, `round`, `sqrt`, `floor`, `sum`, `mean`, `ratio_split`). Use `const` for input numbers.
89
+ - `args`: List of input node IDs.
90
+ - `distractor`: Boolean (`true` / `false`). Set to `true` if the node is NOT used in the final calculation path.
91
+ - `label`: Label for the node.
92
+
93
+ ### Available Operations:
94
+ - Input: `const` (Use this for all numbers found in text or constants).
95
+ - Arithmetic: `add`, `sub`, `mul`, `div`, `abs` (absolute difference).
96
+ - Logic/Stats: `sum`, `mean`, `min` (minimum), `max` (maximum).
97
+ - Rounding: `round` (nearest int), `floor` (round down), `ceil` (round up).
98
+ - Advanced: `sqrt`, `pow`, `mod` (remainder), `gcd`, `lcm`.
99
+ - Output: `identity` ("final_result" points to the answer node)
100
+
101
+ Only output a JSON graph representing the solution, nothing else. Nodes must be topologically sorted, and there must be exactly one "final_result" node that represents the final answer. One example is provided below.
102
+
103
+ ### Example:
104
+ Question:
105
+ মিনার কাছে ১২২১৯৫ টা কলম আছে। রাজুর কাছে ২৫০৮৪ টা কলম আছে। মিনা রাজুর কাছে ১১২৬ টি কলম চাইল। রাজু ১০০০ টি কলম দিতে রাজি হল, কিন্তু পরে আর দিলেনা। প্রতিটি কলমের দাম ৪৫.৬ টাকা। মিনা যদি কলমগুলো বিক্রি করতে চায়, সে কত টাকা পাবে?
106
+
107
+ Output:
108
+ ```json
109
+ {{
110
+ "nodes": [
111
+ {{"id": "n1", "op": "const", "val": 122195, "distractor": false, "label": "মিনার কলম"}},
112
+ {{"id": "n2", "op": "const", "val": 25084, "distractor": true, "label": "রাজুর কলম"}},
113
+ {{"id": "n3", "op": "const", "val": 1126, "distractor": true, "label": "মিনা রাজুর কাছে চাইল"}},
114
+ {{"id": "n4", "op": "const", "val": 1000, "distractor": true, "label": "রাজু দিতে রাজি হল"}},
115
+ {{"id": "n5", "op": "const", "val": 45.6, "distractor": false, "label": "প্রতিটি কলমের দাম"}},
116
+ {{"id": "total_money", "op": "mul", "args": ["n1", "n5"], "distractor": false, "label": "মিনার মোট টাকা"}},
117
+ {{"id": "final_result", "op": "identity", "args": ["total_money"], "distractor": false, "label": "চূড়ান্ত উত্তর"}}
118
+ ]
119
+ }}```
120
+
121
+ ### Your Task:
122
+
123
+ Question:
124
+ {question}
125
+
126
+ Output:
127
+ """
128
+
129
+ question = "রজারের 5টি টেনিস বল আছে। সে আরও 2 ক্যান টেনিস বল কিনেছে। প্রতিটি ক্যানে 3টি করে টেনিস বল আছে। তার কাছে এখন কতগুলি টেনিস বল আছে?"
130
+ prompt = USER_PROMPT_TEMPLATE.format(question=question)
131
 
132
  messages = [
133
+ {"role": "user", "content": prompt}
 
134
  ]
135
 
136
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
137
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
138
 
139
+ # Generate
140
+ outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.7, top_p=0.8)
141
  response = tokenizer.decode(outputs[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
142
+
143
  print(response)
144
  ```
145
 
 
181
  ## Citation
182
 
183
  ```bibtex
184
+ @misc{nazi2026dagdaggerdistractorawaregraphgeneration,
185
+ title={{\dag}DAGGER: Distractor-Aware Graph Generation for Executable Reasoning in Math Problems},
186
+ author={Zabir Al Nazi and Shubhashis Roy Dipta and Sudipta Kar},
187
+ year={2026},
188
+ eprint={2601.06853},
189
+ archivePrefix={arXiv},
190
+ primaryClass={cs.CL},
191
+ url={https://arxiv.org/abs/2601.06853},
192
+ }
193
  ```