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