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