Files changed (1) hide show
  1. README.md +61 -8
README.md CHANGED
@@ -51,8 +51,8 @@ model-index:
51
 
52
  # DAGGER-12B-SFT-GRPO
53
 
54
- <a href="https://arxiv.org/abs/XXXX.XXXXX" target="_blank">
55
- <img alt="arXiv" src="https://img.shields.io/badge/arXiv-XXXX.XXXXX-b31b1b" style="display: inline-block; vertical-align: middle;"/>
56
  </a>
57
  <a href="https://github.com/dipta007/dagger" target="_blank">
58
  <img alt="GitHub" src="https://img.shields.io/badge/GitHub-Code-black" style="display: inline-block; vertical-align: middle;"/>
@@ -135,16 +135,61 @@ model = AutoModelForCausalLM.from_pretrained(
135
  device_map="auto"
136
  )
137
 
138
- # Prepare input
139
- question = "মিনার কাছে ১০০টি কলম আছে। প্রতিটি কলমের দাম ৫ টাকা। মিনা সব কলম বিক্রি করলে কত টাকা পাবে?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  messages = [
142
- {"role": "system", "content": "You are an expert Bangla Math Reasoner. Solve by constructing a Computational Graph in JSON format."},
143
- {"role": "user", "content": question}
144
  ]
145
 
146
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
147
- inputs = tokenizer([text], return_tensors="pt").to(model.device)
148
 
149
  # Generate
150
  outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.7, top_p=0.8)
@@ -279,7 +324,15 @@ R(g, y) = 0.5 * I_fmt + 0.5 * I_exec + I_acc(exec(g), y)
279
  ## Citation
280
 
281
  ```bibtex
282
- will be updated
 
 
 
 
 
 
 
 
283
  ```
284
 
285
  ## Acknowledgments
 
51
 
52
  # DAGGER-12B-SFT-GRPO
53
 
54
+ <a href="https://arxiv.org/abs/2601.06853" target="_blank">
55
+ <img alt="arXiv" src="https://img.shields.io/badge/arXiv-2601.06853-b31b1b" style="display: inline-block; vertical-align: middle;"/>
56
  </a>
57
  <a href="https://github.com/dipta007/dagger" target="_blank">
58
  <img alt="GitHub" src="https://img.shields.io/badge/GitHub-Code-black" style="display: inline-block; vertical-align: middle;"/>
 
135
  device_map="auto"
136
  )
137
 
138
+ USER_PROMPT_TEMPLATE = """You are an expert Bengali Math Reasoner. Your task is to solve mathematical problems by constructing a "Computational Graph".
139
+
140
+ ### Graph Rules:
141
+ - `id`: Unique identifier (e.g., "n1", "n2").
142
+ - `val`: The raw number extracted from text (for input nodes).
143
+ - `op`: The operation (`add`, `sub`, `mul`, `div`, `round`, `sqrt`, `floor`, `sum`, `mean`, `ratio_split`). Use `const` for input numbers.
144
+ - `args`: List of input node IDs.
145
+ - `distractor`: Boolean (`true` / `false`). Set to `true` if the node is NOT used in the final calculation path.
146
+ - `label`: Label for the node.
147
+
148
+ ### Available Operations:
149
+ - Input: `const` (Use this for all numbers found in text or constants).
150
+ - Arithmetic: `add`, `sub`, `mul`, `div`, `abs` (absolute difference).
151
+ - Logic/Stats: `sum`, `mean`, `min` (minimum), `max` (maximum).
152
+ - Rounding: `round` (nearest int), `floor` (round down), `ceil` (round up).
153
+ - Advanced: `sqrt`, `pow`, `mod` (remainder), `gcd`, `lcm`.
154
+ - Output: `identity` ("final_result" points to the answer node)
155
+
156
+ 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.
157
+
158
+ ### Example:
159
+ Question:
160
+ মিনার কাছে ১২২১৯৫ টা কলম আছে। রাজুর কাছে ২৫০৮৪ টা কলম আছে। মিনা রাজুর কাছে ১১২৬ টি কলম চাইল। রাজু ১০০০ টি কলম দিতে রাজি হল, কিন্তু পরে আর দিলেনা। প্রতিটি কলমের দাম ৪৫.৬ টাকা। মিনা যদি কলমগুলো বিক্রি করতে চায়, সে কত টাকা পাবে?
161
+
162
+ Output:
163
+ ```json
164
+ {{
165
+ "nodes": [
166
+ {{"id": "n1", "op": "const", "val": 122195, "distractor": false, "label": "মিনার কলম"}},
167
+ {{"id": "n2", "op": "const", "val": 25084, "distractor": true, "label": "রাজুর কলম"}},
168
+ {{"id": "n3", "op": "const", "val": 1126, "distractor": true, "label": "মিনা রাজুর কাছে চাইল"}},
169
+ {{"id": "n4", "op": "const", "val": 1000, "distractor": true, "label": "রাজু দিতে রাজি হল"}},
170
+ {{"id": "n5", "op": "const", "val": 45.6, "distractor": false, "label": "প্রতিটি কলমের দাম"}},
171
+ {{"id": "total_money", "op": "mul", "args": ["n1", "n5"], "distractor": false, "label": "মিনার মোট টাকা"}},
172
+ {{"id": "final_result", "op": "identity", "args": ["total_money"], "distractor": false, "label": "চূড়ান্ত উত্তর"}}
173
+ ]
174
+ }}```
175
+
176
+ ### Your Task:
177
+
178
+ Question:
179
+ {question}
180
+
181
+ Output:
182
+ """
183
+
184
+ question = "রজারের 5টি টেনিস বল আছে। সে আরও 2 ক্যান টেনিস বল কিনেছে। প্রতিটি ক্যানে 3টি করে টেনিস বল আছে। তার কাছে এখন কতগুলি টেনিস বল আছে?"
185
+ prompt = USER_PROMPT_TEMPLATE.format(question=question)
186
 
187
  messages = [
188
+ {"role": "user", "content": prompt}
 
189
  ]
190
 
191
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
192
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
193
 
194
  # Generate
195
  outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.7, top_p=0.8)
 
324
  ## Citation
325
 
326
  ```bibtex
327
+ @misc{nazi2026dagdaggerdistractorawaregraphgeneration,
328
+ title={{\dag}DAGGER: Distractor-Aware Graph Generation for Executable Reasoning in Math Problems},
329
+ author={Zabir Al Nazi and Shubhashis Roy Dipta and Sudipta Kar},
330
+ year={2026},
331
+ eprint={2601.06853},
332
+ archivePrefix={arXiv},
333
+ primaryClass={cs.CL},
334
+ url={https://arxiv.org/abs/2601.06853},
335
+ }
336
  ```
337
 
338
  ## Acknowledgments