File size: 4,429 Bytes
7e7d945
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
base_model: unsloth/gemma-3-27b-it
library_name: peft
license: gemma
---

# LOGIC-27B

LOGIC Framework (Lay Out Problem, Options, Groundwork, Inference, Conclusion)

Example Output
```xml
<layOutProblem>
Explain the problem or question in detail.
</layOutProblem>

<options>
List different strategies or paths you might take to solve the problem.
</options>

<groundwork>
Note important facts, formulas, or references needed. Establish constraints.
</groundwork>

<inference>
Perform detailed reasoning or computations. Validate steps or check for errors.
</inference>

<conclusion>
Present the clear answer or outcome.
</conclusion>
```

Why Use LOGIC?
Emphasizes exploring multiple options.
Encourages building a strong groundwork of facts or constraints.
Includes inference to handle the step-by-step thinking process.
Ends with a conclusion that ties it all together.



### Model Details
- **Model Name:** Bifröst-27B
- **Base Architecture:** gemma3
- **Application:** Reasoning using LOGIC Framework
- **Release Date:** 16-March-2025

```python
system_prompt = \
f"""You are given a problem.
You are LOGIC
Always follow the format
layOutProblem
options
groundwork
inference
conclusion

Explain the problem or question in detail.
Place it between <layOutProblem> and </layOutProblem>

List different strategies or paths you might take to solve the problem.
Place it between <options> and </options>

Note important facts, formulas, or references needed. Establish constraints.
Place it between <groundwork> and </groundwork>

Think about the problem and provide your working out.
Place it between <inference> and </inference>.

Then, provide your solution between <conclusion> and </conclusion>

"""
system_prompt
```

Example Prompt
```python
system_prompt = \
messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user",   "content": "A triangle has sides 13, 14, and 15. Find the radius of its circumcircle."},
]

text = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt = True,
    tokenize = False,
)
from transformers import TextStreamer
_ = model.generate(
    **tokenizer(text, return_tensors = "pt").to("cuda"),
    max_new_tokens = 1024,
    temperature = 1.0, top_p = 0.95, top_k = 64,
    streamer = TextStreamer(tokenizer, skip_prompt = True),
)
system_prompt
```

Example Output
```xml
<layOutProblem>
The problem asks us to find the radius of the circumcircle of a triangle with sides of length 13, 14, and 15. The circumcircle is the circle that passes through all three vertices of the triangle. The radius of the circumcircle is often denoted by *R*. We are given the lengths of the three sides of the triangle, and we need to determine the radius of the circle that circumscribes it.
</layOutProblem>

<options>
1. **Use the formula R = abc / 4K**, where a, b, and c are the side lengths and K is the area of the triangle. This requires us to first calculate the area of the triangle. We can use Heron's formula to find the area.
2. **Use the Law of Sines:**  a/sin(A) = b/sin(B) = c/sin(C) = 2R. This requires us to find one of the angles of the triangle, which can be done using the Law of Cosines.
3. **Coordinate Geometry:** Place the triangle on a coordinate plane and find the circumcenter, then calculate the distance from the circumcenter to any vertex. This is generally more complex.
</options>

<groundwork>
* **Heron's Formula:**  For a triangle with sides a, b, and c, the area K is given by K = sqrt(s(s-a)(s-b)(s-c)), where s is the semi-perimeter, s = (a+b+c)/2.
* **Law of Cosines:** c² = a² + b² - 2ab*cos(C)
* **Law of Sines:** a/sin(A) = b/sin(B) = c/sin(C) = 2R
* **Circumradius Formula:** R = abc / 4K
* **Side lengths:** a = 13, b = 14, c = 15
* **Constraint:** The radius must be a positive real number.
</groundwork>

<inference>
Let's use the formula R = abc / 4K. First, we need to find the area K using Heron's formula.
The semi-perimeter s = (13 + 14 + 15) / 2 = 42 / 2 = 21.
Now, we can calculate the area K:
K = sqrt(21(21-13)(21-14)(21-15)) = sqrt(21 * 8 * 7 * 6) = sqrt(3 * 7 * 2³ * 7 * 2 * 3) = sqrt(2⁴ * 3² * 7²) = 2² * 3 * 7 = 4 * 21 = 84.
Now we can find the circumradius R:
R = (13 * 14 * 15) / (4 * 84) = (13 * 14 * 15) / 336 = (13 * 2 * 7 * 3 * 5) / (2⁴ * 3 * 7) = (13 * 5) / 8 = 65 / 8 = 8.125

</inference>

<conclusion>
The radius of the circumcircle is 65/8 or 8.125.
</conclusion><end_of_turn>
```