joerowell varunrandery Jiminator commited on
Commit
e4daa58
·
0 Parent(s):

Laguna S 2.1 initial release

Browse files

Co-authored-by: varunrandery <varunrandery@users.noreply.huggingface.co>
Co-authored-by: Jiminator <Jiminator@users.noreply.huggingface.co>

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .eval_results/deepswe.yaml +7 -0
  2. .eval_results/swe-bench_multilingual.yaml +7 -0
  3. .eval_results/swe-bench_pro.yaml +7 -0
  4. .gitattributes +35 -0
  5. LICENSE.md +49 -0
  6. README.md +182 -0
  7. chat_template.jinja +93 -0
  8. config.json +262 -0
  9. configuration_laguna.py +249 -0
  10. generation_config.json +25 -0
  11. model-00001-of-00046.safetensors +3 -0
  12. model-00002-of-00046.safetensors +3 -0
  13. model-00003-of-00046.safetensors +3 -0
  14. model-00004-of-00046.safetensors +3 -0
  15. model-00005-of-00046.safetensors +3 -0
  16. model-00006-of-00046.safetensors +3 -0
  17. model-00007-of-00046.safetensors +3 -0
  18. model-00008-of-00046.safetensors +3 -0
  19. model-00009-of-00046.safetensors +3 -0
  20. model-00010-of-00046.safetensors +3 -0
  21. model-00011-of-00046.safetensors +3 -0
  22. model-00012-of-00046.safetensors +3 -0
  23. model-00013-of-00046.safetensors +3 -0
  24. model-00014-of-00046.safetensors +3 -0
  25. model-00015-of-00046.safetensors +3 -0
  26. model-00016-of-00046.safetensors +3 -0
  27. model-00017-of-00046.safetensors +3 -0
  28. model-00018-of-00046.safetensors +3 -0
  29. model-00019-of-00046.safetensors +3 -0
  30. model-00020-of-00046.safetensors +3 -0
  31. model-00021-of-00046.safetensors +3 -0
  32. model-00022-of-00046.safetensors +3 -0
  33. model-00023-of-00046.safetensors +3 -0
  34. model-00024-of-00046.safetensors +3 -0
  35. model-00025-of-00046.safetensors +3 -0
  36. model-00026-of-00046.safetensors +3 -0
  37. model-00027-of-00046.safetensors +3 -0
  38. model-00028-of-00046.safetensors +3 -0
  39. model-00029-of-00046.safetensors +3 -0
  40. model-00030-of-00046.safetensors +3 -0
  41. model-00031-of-00046.safetensors +3 -0
  42. model-00032-of-00046.safetensors +3 -0
  43. model-00033-of-00046.safetensors +3 -0
  44. model-00034-of-00046.safetensors +3 -0
  45. model-00035-of-00046.safetensors +3 -0
  46. model-00036-of-00046.safetensors +3 -0
  47. model-00037-of-00046.safetensors +3 -0
  48. model-00038-of-00046.safetensors +3 -0
  49. model-00039-of-00046.safetensors +3 -0
  50. model-00040-of-00046.safetensors +3 -0
.eval_results/deepswe.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: datacurve/deep-swe
3
+ task_id: deepswe_%_resolved
4
+ value: 40.4
5
+ source:
6
+ url: https://huggingface.co/poolside/Laguna-S-2.1
7
+ name: Model Card
.eval_results/swe-bench_multilingual.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: SWE-bench/SWE-bench_Multilingual
3
+ task_id: swe_bench_%_resolved
4
+ value: 78.5
5
+ source:
6
+ url: https://huggingface.co/poolside/Laguna-S-2.1
7
+ name: Model Card
.eval_results/swe-bench_pro.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: ScaleAI/SWE-bench_Pro
3
+ task_id: SWE_Bench_Pro
4
+ value: 59.4
5
+ source:
6
+ url: https://huggingface.co/poolside/Laguna-S-2.1
7
+ name: Model Card
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
LICENSE.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ OpenMDW License Agreement, version 1.1 (OpenMDW-1.1)
2
+
3
+ By exercising rights granted to you under this agreement, you accept and agree
4
+ to its terms.
5
+
6
+ As used in this agreement, "Model Materials" means the materials provided to
7
+ you under this agreement, consisting of: (1) one or more machine learning
8
+ models (including architecture and parameters); and (2) all related artifacts
9
+ (including associated data, documentation and software) that are provided to
10
+ you hereunder.
11
+
12
+ Subject to your compliance with this agreement, permission is hereby granted,
13
+ free of charge, to deal in the Model Materials without restriction, including
14
+ under all copyright, patent, database, and trade secret rights included or
15
+ embodied therein.
16
+
17
+ If you distribute any portion of the Model Materials, you shall retain in your
18
+ distribution (1) a copy of this agreement, and (2) all copyright notices and
19
+ other notices of origin included in the Model Materials that are applicable to
20
+ your distribution.
21
+
22
+ If you file, maintain, or voluntarily participate in a lawsuit against any
23
+ person or entity asserting that the Model Materials directly or indirectly
24
+ infringe any patent or copyright, then all rights and grants made to you
25
+ hereunder are terminated, unless that lawsuit was in response to a
26
+ corresponding lawsuit first brought against you.
27
+
28
+ This agreement does not impose any restrictions or obligations with respect to
29
+ any use, modification, or sharing of any outputs generated by using the Model
30
+ Materials.
31
+
32
+ THE MODEL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE, NONINFRINGEMENT, ACCURACY, OR THE
35
+ ABSENCE OF LATENT OR OTHER DEFECTS OR ERRORS, WHETHER OR NOT DISCOVERABLE, ALL
36
+ TO THE GREATEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW.
37
+
38
+ YOU ARE SOLELY RESPONSIBLE FOR (1) CLEARING RIGHTS OF OTHER PERSONS THAT MAY
39
+ APPLY TO THE MODEL MATERIALS OR ANY USE THEREOF, INCLUDING WITHOUT LIMITATION
40
+ ANY PERSON'S COPYRIGHTS OR OTHER RIGHTS INCLUDED OR EMBODIED IN THE MODEL
41
+ MATERIALS; (2) OBTAINING ANY NECESSARY CONSENTS, PERMISSIONS OR OTHER RIGHTS
42
+ REQUIRED FOR ANY USE OF THE MODEL MATERIALS; OR (3) PERFORMING ANY DUE
43
+ DILIGENCE OR UNDERTAKING ANY OTHER INVESTIGATIONS INTO THE MODEL MATERIALS OR
44
+ ANYTHING INCORPORATED OR EMBODIED THEREIN.
45
+
46
+ IN NO EVENT SHALL THE PROVIDERS OF THE MODEL MATERIALS BE LIABLE FOR ANY CLAIM,
47
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
48
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MODEL MATERIALS, THE
49
+ USE THEREOF OR OTHER DEALINGS THEREIN.
README.md ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ inference: false
4
+ extra_gated_description: >-
5
+ To learn more about how we process your personal data, please read our <a
6
+ href="https://poolside.ai/legal/privacy">Privacy Policy</a>.
7
+ tags:
8
+ - laguna-s-2.1
9
+ - vllm
10
+ license: openmdw-1.1
11
+ pipeline_tag: text-generation
12
+ ---
13
+
14
+ <p align="center">
15
+ <img alt="poolside-banner" src="https://poolside.ai/assets/laguna/laguna-s-2-1-banner.svg" width="800px">
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://openrouter.ai/poolside/laguna-s-2.1"><strong>Use on OpenRouter</strong></a> ·
20
+ <a href="https://vercel.com/ai-gateway/models/laguna-s-2.1"><strong>Use on Vercel AI Gateway</strong></a> ·
21
+ <a href="https://poolside.ai/blog/introducing-laguna-s-2-1"><strong>Release blog post</strong></a>
22
+ </p>
23
+
24
+ <br>
25
+
26
+ # Laguna S 2.1
27
+
28
+ Laguna S 2.1 is a 118B total parameter Mixture-of-Experts model with 8B activated
29
+ parameters per token, designed for agentic coding and long-horizon work. It sits
30
+ between [Laguna XS 2.1](https://huggingface.co/poolside/Laguna-XS-2.1) (33B-A3B) and
31
+ Laguna M.1 (225B-A23B) in the Laguna series and shares the family recipe: a
32
+ token-choice router with softplus gating over 256 routed experts plus one shared
33
+ expert, grouped-query attention, and interleaved full/sliding-window attention.
34
+
35
+ ## Highlights
36
+
37
+ - **Mixed SWA and global attention layout**: 48 layers in a 1:3 global-to-SWA ratio
38
+ (12 global attention layers, 36 sliding-window layers, window 512), with softplus
39
+ attention gating and per-layer-type rotary scales
40
+ - **1M context**: 1,048,576-token context window
41
+ - **Native reasoning support**: interleaved thinking between tool calls, with
42
+ per-request control via `enable_thinking`
43
+ - **Speculative decoding**: a trained
44
+ [DFlash draft model](https://huggingface.co/poolside/Laguna-S-2.1-DFlash) is available
45
+ for lower-latency serving
46
+ - **Quantized variants**:
47
+ [FP8](https://huggingface.co/poolside/Laguna-S-2.1-FP8),
48
+ [NVFP4](https://huggingface.co/poolside/Laguna-S-2.1-NVFP4),
49
+ [INT4](https://huggingface.co/poolside/Laguna-S-2.1-INT4) and
50
+ [GGUF](https://huggingface.co/poolside/Laguna-S-2.1-GGUF)
51
+ - **OpenMDW-1.1 license**: Use and modify the model and associated materials freely
52
+ for commercial and non-commercial purposes
53
+ ([learn more about OpenMDW](https://openmdw.ai/))
54
+
55
+ ## Model overview
56
+
57
+ - Number of parameters: 118B total, ~8B activated per token
58
+ - Layers: 48 (12 global attention, 36 sliding-window attention)
59
+ - Experts: 256 routed (top-10) plus 1 shared expert
60
+ - Attention: grouped-query, 8 KV heads, head dim 128; per-head softplus output gating
61
+ - Sliding window: 512 tokens
62
+ - Context window: 1,048,576 tokens
63
+ - Vocabulary: 100,352 tokens (Laguna family tokenizer)
64
+ - Modality: text-to-text
65
+ - Reasoning: interleaved thinking with preserved thinking
66
+
67
+ ## Benchmark results
68
+
69
+ <p align="center">
70
+ <img alt="benchmarks" src="https://poolside.ai/assets/laguna/laguna-s-2-1-chart.svg" width="800px">
71
+ </p>
72
+
73
+ | Model | Size | Terminal-Bench 2.1 | SWE-bench Multilingual | SWE-Bench Pro (Public Dataset) | DeepSWE | SWE Atlas (Codebase QnA) | Toolathlon Verified |
74
+ |---|---|---|---|---|---|---|---|
75
+ | **Laguna S 2.1** | 118B-A8B | **70.2%** | **78.5%** | **59.4%** | **40.4%** | **46.2%** | **49.7%** |
76
+ | Tencent Hy3 | 295B-A21B | 71.7% | 75.8% | 57.9% | - | - | - |
77
+ | Inkling | 975B-A41B | 63.8% | - | 54.3% | - | - | 45.5%* |
78
+ | Nemotron 3 Ultra | 550B-A55B | 56.4% | 67.7% | - | - | - | 34.3%* |
79
+ | DeepSeek-V4-Pro Max | 1.6T-A49B | 64.0%* | 76.2% | 55.4% | 9.0%* | 27.2%* | 55.9%* |
80
+ | Kimi K3 | 2800B-A50B | 88.3% | - | - | 69% | - | - |
81
+ | Qwen 3.7 Max | - | 74.5%* | 78.3% | 60.6% | - | - | - |
82
+ | Muse Spark 1.1 | - | 80% | - | 61.5% | 53.3% | 42.2%* | 75.6% |
83
+ | Claude Fable 5 | - | 88% | - | 80.3% | 70% | - | - |
84
+
85
+ Benchmarks as of 21 July 2026. Laguna S 2.1 in **bold**; a dash (-) marks a benchmark a model was not evaluated on. Scores marked * are as reported by third parties: Terminal-Bench 2.1 and DeepSWE via Artificial Analysis, SWE Atlas via Scale AI's official leaderboard, and Toolathlon Verified via its official leaderboard. Full evaluation trajectories: [trajectories.poolside.ai](https://trajectories.poolside.ai).
86
+
87
+ ## Usage
88
+
89
+ Laguna S 2.1 uses the same `laguna` architecture as Laguna XS 2.1, so the same
90
+ engine integrations apply (vLLM, SGLang, Transformers, TRT-LLM, llama.cpp). At 118B
91
+ parameters the BF16 checkpoint needs multiple GPUs (roughly 236GB of weights);
92
+ quantized variants reduce this substantially.
93
+
94
+ ### vLLM
95
+
96
+ ```shell
97
+ vllm serve \
98
+ --model poolside/Laguna-S-2.1 \
99
+ --tensor-parallel-size 4 \
100
+ --tool-call-parser poolside_v1 \
101
+ --reasoning-parser poolside_v1 \
102
+ --enable-auto-tool-choice \
103
+ --served-model-name laguna \
104
+ --default-chat-template-kwargs '{"enable_thinking": true}'
105
+ ```
106
+
107
+ > [!NOTE]
108
+ > **Optional: speculative decoding with DFlash.** Pair with the
109
+ > [Laguna S 2.1 DFlash draft model](https://huggingface.co/poolside/Laguna-S-2.1-DFlash)
110
+ > by adding
111
+ > `--speculative-config '{"model":"poolside/Laguna-S-2.1-DFlash","num_speculative_tokens":7,"method":"dflash"}'`.
112
+
113
+ ### SGLang
114
+
115
+ ```shell
116
+ python -m sglang.launch_server \
117
+ --model-path poolside/Laguna-S-2.1 \
118
+ --tp-size 4 \
119
+ --reasoning-parser poolside_v1 \
120
+ --tool-call-parser poolside_v1 \
121
+ --trust-remote-code
122
+ ```
123
+
124
+ ### TRT-LLM
125
+
126
+ ```shell
127
+ trtllm-serve poolside/Laguna-S-2.1 --trust-remote-code \
128
+ --tool_parser poolside_v1 --reasoning_parser laguna
129
+ ```
130
+
131
+ Note the flag names differ from vLLM's (`--tool_parser`, and the reasoning parser
132
+ is `laguna`, not `poolside_v1`).
133
+
134
+ ### llama.cpp
135
+
136
+ GGUF conversions are available at
137
+ [poolside/Laguna-S-2.1-GGUF](https://huggingface.co/poolside/Laguna-S-2.1-GGUF).
138
+ Serve with poolside's llama.cpp fork, branch
139
+ [`laguna`](https://github.com/poolsideai/llama.cpp/tree/laguna), which carries
140
+ full Laguna support including DFlash speculative decoding. (Base Laguna support
141
+ is also in upstream review:
142
+ [ggml-org/llama.cpp#25165](https://github.com/ggml-org/llama.cpp/pull/25165).)
143
+
144
+ ```shell
145
+ git clone --branch laguna https://github.com/poolsideai/llama.cpp
146
+ cd llama.cpp && cmake -B build && cmake --build build -j
147
+
148
+ ./build/bin/llama-server -m laguna-s-2.1-Q4_K_M.gguf --jinja --port 8000
149
+
150
+ # with DFlash speculative decoding:
151
+ ./build/bin/llama-server -m laguna-s-2.1-Q4_K_M.gguf \
152
+ -md laguna-s-2.1-DFlash-BF16.gguf \
153
+ --spec-type draft-dflash --spec-draft-n-max 15 -fa on --jinja --port 8000
154
+ ```
155
+
156
+ ## Controlling reasoning
157
+
158
+ Laguna S 2.1 has native reasoning support and works best with *preserved thinking*:
159
+ keep `reasoning_content` from prior assistant messages in the message history.
160
+ The model will generally reason before calling tools and between tool calls, and
161
+ may stop reasoning in follow-up steps if prior thinking blocks are dropped.
162
+
163
+ Thinking is controlled per request via the chat template:
164
+
165
+ ```python
166
+ extra_body={"chat_template_kwargs": {"enable_thinking": False}}
167
+ ```
168
+
169
+ or at the server level with
170
+ `--default-chat-template-kwargs '{"enable_thinking": true}'`. For agentic coding
171
+ use cases we recommend enabling thinking and preserving reasoning in the message
172
+ history.
173
+
174
+ ## License
175
+
176
+ This model is licensed under the [OpenMDW-1.1 License](https://huggingface.co/poolside/Laguna-S-2.1/blob/main/LICENSE.md).
177
+
178
+ ## Intended and Responsible Use
179
+
180
+ Laguna S 2.1 is designed for software engineering and agentic coding use cases, and you are responsible for confirming that it is appropriate for your intended application. Laguna S 2.1 is subject to the [OpenMDW-1.1 License](https://huggingface.co/poolside/Laguna-S-2.1/blob/main/LICENSE.md), and should be used consistently with Poolside's [Acceptable Use Policy](https://poolside.ai/legal/acceptable-use-policy). We advise against circumventing Laguna S 2.1 safety guardrails without implementing substantially equivalent mitigations appropriate for your use case.
181
+
182
+ Please report security vulnerabilities or safety concerns to [security@poolside.ai](mailto:security@poolside.ai).
chat_template.jinja ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {#- Iteration on laguna_glm_thinking_v8/chat_template.jinja -#}
2
+ {#- No formatting instructions -#}
3
+ {{- "〈|EOS|〉" -}}
4
+ {%- set enable_thinking = enable_thinking | default(false) -%}
5
+ {%- set add_generation_prompt = add_generation_prompt | default(false) -%}
6
+
7
+ {#- ───── header (system message) ───── -#}
8
+ {#- A caller-supplied system message with empty content opts out of the default below, producing no <system> block — used to train without a system message. -#}
9
+ {%- set system_message = "You are a helpful, conversationally-fluent assistant made by Poolside. You are here to be helpful to users through natural language conversations." -%}
10
+ {%- if messages and messages[0].role == "system" -%}
11
+ {%- set system_message = messages[0].content -%}
12
+ {%- set messages = messages[1:] -%}
13
+ {%- endif -%}
14
+
15
+ {%- set has_sys = system_message and system_message.strip() -%}
16
+ {%- if has_sys or tools or enable_thinking -%}
17
+ {{- "<system>" -}}
18
+
19
+ {%- if has_sys -%}
20
+ {{- system_message.rstrip() -}}
21
+ {%- if tools -%}{{- "\n\n" -}}{%- endif -%}
22
+ {%- endif -%}
23
+
24
+ {%- if tools -%}
25
+ {{- "### Tools\n\n" -}}
26
+ {{- "You may call functions to assist with the user query.\n" -}}
27
+ {{- "All available function signatures are listed below:\n" -}}
28
+ {{- "<available_tools>\n" -}}
29
+ {%- for tool in tools -%}
30
+ {{- (tool | tojson) ~ "\n" -}}
31
+ {%- endfor -%}
32
+ {{- "</available_tools>" -}}
33
+ {%- endif -%}
34
+
35
+ {{- "</system>\n" -}}
36
+ {%- endif -%}
37
+
38
+ {#- ───── main loop ───── -#}
39
+ {%- for message in messages -%}
40
+ {%- set content = message.content if message.content is string else "" -%}
41
+ {%- if message.role == "user" -%}
42
+ {{- "<user>" + content + "</user>\n" -}}
43
+ {%- elif message.role == "assistant" -%}
44
+ {%- generation -%}
45
+ {{- "<assistant>" -}}
46
+ {#- Extract reasoning content from message.reasoning (vLLM field name) or message.reasoning_content -#}
47
+ {%- set reasoning_content = '' -%}
48
+ {%- if message.reasoning is string -%}
49
+ {%- set reasoning_content = message.reasoning -%}
50
+ {%- elif message.reasoning_content is string -%}
51
+ {%- set reasoning_content = message.reasoning_content -%}
52
+ {%- endif -%}
53
+ {#- Display reasoning content for all messages if enable_thinking -#}
54
+ {%- if enable_thinking -%}
55
+ {{- '<think>' + reasoning_content + '</think>' -}}
56
+ {%- else -%}
57
+ {{- '</think>' -}}
58
+ {%- endif -%}
59
+ {#- Display main content (trailing newline only when no tool_calls follow) -#}
60
+ {%- if content -%}
61
+ {{- content -}}
62
+ {%- endif -%}
63
+ {%- if message.tool_calls -%}
64
+ {%- for tool_call in message.tool_calls -%}
65
+ {%- set function_data = tool_call.function -%}
66
+ {{- '<tool_call>' + function_data.name -}}
67
+ {%- set _args = function_data.arguments -%}
68
+ {%- for k, v in _args.items() -%}
69
+ {{- "<arg_key>" ~ k ~ "</arg_key>" -}}
70
+ {{- "<arg_value>" -}}{{- v | tojson(ensure_ascii=False) if v is not string else v -}}{{- "</arg_value>" -}}
71
+ {%- endfor -%}
72
+ {{- "</tool_call>" -}}
73
+ {%- endfor -%}
74
+ {%- endif -%}
75
+ {{- "</assistant>\n" -}}
76
+ {%- endgeneration -%}
77
+ {%- elif message.role == "tool" -%}
78
+ {{- "<tool_response>" + content + "</tool_response>\n" -}}
79
+ {%- elif message.role == "system" -%}
80
+ {#- Render additional system messages (the first one, if any, is handled separately in the header and was sliced off above) -#}
81
+ {{- "<system>" + content + "</system>\n" -}}
82
+ {%- endif -%}
83
+ {%- endfor -%}
84
+ {#- ───── generation prompt ───── -#}
85
+ {%- if add_generation_prompt -%}
86
+ {{- "<assistant>" -}}
87
+ {#- ───── Include reasoning mode directive ───── -#}
88
+ {%- if enable_thinking -%}
89
+ {{- '<think>' -}}
90
+ {%- else -%}
91
+ {{- '</think>' -}}
92
+ {%- endif -%}
93
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LagunaForCausalLM"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_laguna.LagunaConfig",
7
+ "AutoModelForCausalLM": "modeling_laguna.LagunaForCausalLM"
8
+ },
9
+ "model_type": "laguna",
10
+ "vocab_size": 100352,
11
+ "hidden_size": 3072,
12
+ "intermediate_size": 12288,
13
+ "num_hidden_layers": 48,
14
+ "num_attention_heads": 48,
15
+ "num_key_value_heads": 8,
16
+ "head_dim": 128,
17
+ "max_position_embeddings": 1048576,
18
+ "attention_bias": false,
19
+ "attention_dropout": 0.0,
20
+ "rms_norm_eps": 1e-06,
21
+ "num_experts": 256,
22
+ "num_experts_per_tok": 10,
23
+ "moe_intermediate_size": 1024,
24
+ "shared_expert_intermediate_size": 1024,
25
+ "norm_topk_prob": true,
26
+ "router_aux_loss_coef": 0.0,
27
+ "decoder_sparse_step": 1,
28
+ "mlp_only_layers": [
29
+ 0
30
+ ],
31
+ "bos_token_id": 2,
32
+ "eos_token_id": [
33
+ 2,
34
+ 24
35
+ ],
36
+ "pad_token_id": 9,
37
+ "tie_word_embeddings": false,
38
+ "use_cache": true,
39
+ "torch_dtype": "bfloat16",
40
+ "gating": "per-head",
41
+ "sliding_window": 512,
42
+ "rope_parameters": {
43
+ "full_attention": {
44
+ "rope_theta": 500000.0,
45
+ "rope_type": "yarn",
46
+ "factor": 128.0,
47
+ "original_max_position_embeddings": 8192,
48
+ "beta_slow": 1.0,
49
+ "beta_fast": 32.0,
50
+ "attention_factor": 1.4852030263919618,
51
+ "partial_rotary_factor": 0.5
52
+ },
53
+ "sliding_attention": {
54
+ "rope_type": "default",
55
+ "rope_theta": 10000.0,
56
+ "partial_rotary_factor": 1.0
57
+ }
58
+ },
59
+ "layer_types": [
60
+ "full_attention",
61
+ "sliding_attention",
62
+ "sliding_attention",
63
+ "sliding_attention",
64
+ "full_attention",
65
+ "sliding_attention",
66
+ "sliding_attention",
67
+ "sliding_attention",
68
+ "full_attention",
69
+ "sliding_attention",
70
+ "sliding_attention",
71
+ "sliding_attention",
72
+ "full_attention",
73
+ "sliding_attention",
74
+ "sliding_attention",
75
+ "sliding_attention",
76
+ "full_attention",
77
+ "sliding_attention",
78
+ "sliding_attention",
79
+ "sliding_attention",
80
+ "full_attention",
81
+ "sliding_attention",
82
+ "sliding_attention",
83
+ "sliding_attention",
84
+ "full_attention",
85
+ "sliding_attention",
86
+ "sliding_attention",
87
+ "sliding_attention",
88
+ "full_attention",
89
+ "sliding_attention",
90
+ "sliding_attention",
91
+ "sliding_attention",
92
+ "full_attention",
93
+ "sliding_attention",
94
+ "sliding_attention",
95
+ "sliding_attention",
96
+ "full_attention",
97
+ "sliding_attention",
98
+ "sliding_attention",
99
+ "sliding_attention",
100
+ "full_attention",
101
+ "sliding_attention",
102
+ "sliding_attention",
103
+ "sliding_attention",
104
+ "full_attention",
105
+ "sliding_attention",
106
+ "sliding_attention",
107
+ "sliding_attention"
108
+ ],
109
+ "moe_apply_router_weight_on_input": false,
110
+ "mlp_layer_types": [
111
+ "dense",
112
+ "sparse",
113
+ "sparse",
114
+ "sparse",
115
+ "sparse",
116
+ "sparse",
117
+ "sparse",
118
+ "sparse",
119
+ "sparse",
120
+ "sparse",
121
+ "sparse",
122
+ "sparse",
123
+ "sparse",
124
+ "sparse",
125
+ "sparse",
126
+ "sparse",
127
+ "sparse",
128
+ "sparse",
129
+ "sparse",
130
+ "sparse",
131
+ "sparse",
132
+ "sparse",
133
+ "sparse",
134
+ "sparse",
135
+ "sparse",
136
+ "sparse",
137
+ "sparse",
138
+ "sparse",
139
+ "sparse",
140
+ "sparse",
141
+ "sparse",
142
+ "sparse",
143
+ "sparse",
144
+ "sparse",
145
+ "sparse",
146
+ "sparse",
147
+ "sparse",
148
+ "sparse",
149
+ "sparse",
150
+ "sparse",
151
+ "sparse",
152
+ "sparse",
153
+ "sparse",
154
+ "sparse",
155
+ "sparse",
156
+ "sparse",
157
+ "sparse",
158
+ "sparse"
159
+ ],
160
+ "gating_types": [
161
+ "per_head",
162
+ "per_head",
163
+ "per_head",
164
+ "per_head",
165
+ "per_head",
166
+ "per_head",
167
+ "per_head",
168
+ "per_head",
169
+ "per_head",
170
+ "per_head",
171
+ "per_head",
172
+ "per_head",
173
+ "per_head",
174
+ "per_head",
175
+ "per_head",
176
+ "per_head",
177
+ "per_head",
178
+ "per_head",
179
+ "per_head",
180
+ "per_head",
181
+ "per_head",
182
+ "per_head",
183
+ "per_head",
184
+ "per_head",
185
+ "per_head",
186
+ "per_head",
187
+ "per_head",
188
+ "per_head",
189
+ "per_head",
190
+ "per_head",
191
+ "per_head",
192
+ "per_head",
193
+ "per_head",
194
+ "per_head",
195
+ "per_head",
196
+ "per_head",
197
+ "per_head",
198
+ "per_head",
199
+ "per_head",
200
+ "per_head",
201
+ "per_head",
202
+ "per_head",
203
+ "per_head",
204
+ "per_head",
205
+ "per_head",
206
+ "per_head",
207
+ "per_head",
208
+ "per_head"
209
+ ],
210
+ "moe_routed_scaling_factor": 2.5,
211
+ "num_attention_heads_per_layer": [
212
+ 48,
213
+ 72,
214
+ 72,
215
+ 72,
216
+ 48,
217
+ 72,
218
+ 72,
219
+ 72,
220
+ 48,
221
+ 72,
222
+ 72,
223
+ 72,
224
+ 48,
225
+ 72,
226
+ 72,
227
+ 72,
228
+ 48,
229
+ 72,
230
+ 72,
231
+ 72,
232
+ 48,
233
+ 72,
234
+ 72,
235
+ 72,
236
+ 48,
237
+ 72,
238
+ 72,
239
+ 72,
240
+ 48,
241
+ 72,
242
+ 72,
243
+ 72,
244
+ 48,
245
+ 72,
246
+ 72,
247
+ 72,
248
+ 48,
249
+ 72,
250
+ 72,
251
+ 72,
252
+ 48,
253
+ 72,
254
+ 72,
255
+ 72,
256
+ 48,
257
+ 72,
258
+ 72,
259
+ 72
260
+ ],
261
+ "moe_router_logit_softcapping": 0.0
262
+ }
configuration_laguna.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ruff: noqa
2
+ # Copyright 2025 Poolside and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ from transformers.configuration_utils import PreTrainedConfig
16
+ from transformers.modeling_rope_utils import RopeParameters
17
+ from transformers.utils.import_utils import is_causal_conv1d_available, is_flash_linear_attention_available
18
+
19
+
20
+ class LagunaConfig(PreTrainedConfig):
21
+ r"""
22
+ Configuration class for Laguna model.
23
+
24
+ Laguna is Poolside's MoE architecture with:
25
+ - Attention output gating (softplus gate)
26
+ - Sigmoid routing instead of softmax
27
+ - No QKV bias
28
+ - Explicit head_dim parameter
29
+
30
+ Args:
31
+ head_dim (`int`, *optional*, defaults to 128):
32
+ Dimension of attention heads. Laguna uses explicit head_dim rather than
33
+ computing it from hidden_size // num_attention_heads.
34
+ qkv_bias (`bool`, *optional*, defaults to `False`):
35
+ Whether to add bias to QKV projections. Laguna uses no QKV bias.
36
+ attention_bias (`bool`, *optional*, defaults to `False`):
37
+ Whether to add bias to attention output projection. Laguna uses no attention bias.
38
+ gating (`bool` or `str`, *optional*, defaults to `True`):
39
+ Attention output gating mode. When ``True`` or ``"per-element"`` a g_proj
40
+ linear layer with output size ``num_attention_heads * head_dim`` is added
41
+ and ``attn_output = attn_output * softplus(g_proj(x))``. When ``"per-head"``
42
+ g_proj has output size ``num_attention_heads`` and the gate broadcasts across
43
+ ``head_dim``. When ``False`` no gating is applied.
44
+ partial_rotary_factor (`float`, *optional*):
45
+ Fraction of head_dim to apply rotary embeddings to. When set, this value is
46
+ injected into ``rope_parameters`` (and ``swa_rope_parameters``) if not already
47
+ specified there. When ``None`` the default behaviour of the rope implementation
48
+ is used (typically full rotary).
49
+ num_attention_heads_per_layer (`list[int]`, *optional*):
50
+ Optional per-layer override for ``num_attention_heads``. When provided the list
51
+ length must equal ``num_hidden_layers`` and each entry is the head count used by
52
+ that layer. When ``None`` every layer uses ``num_attention_heads``.
53
+ vocab_size (`int`, *optional*, defaults to 100352):
54
+ Vocabulary size of the Laguna model.
55
+ hidden_size (`int`, *optional*, defaults to 2048):
56
+ Dimension of the hidden representations.
57
+ intermediate_size (`int`, *optional*, defaults to 8192):
58
+ Dimension of the MLP representations for dense layers.
59
+ num_hidden_layers (`int`, *optional*, defaults to 48):
60
+ Number of hidden layers in the Transformer.
61
+ num_attention_heads (`int`, *optional*, defaults to 32):
62
+ Number of attention heads.
63
+ num_key_value_heads (`int`, *optional*, defaults to 8):
64
+ Number of key-value heads for GQA.
65
+ max_position_embeddings (`int`, *optional*, defaults to 4096):
66
+ Maximum sequence length.
67
+ rms_norm_eps (`float`, *optional*, defaults to 1e-6):
68
+ Epsilon for RMSNorm layers.
69
+ sliding_window (`int`, *optional*):
70
+ Sliding window attention size. Used by layers whose type in ``layer_types``
71
+ is ``"sliding_attention"``. When ``None``, all layers use full attention.
72
+ layer_types (`list[str]`, *optional*):
73
+ Per-layer attention type. Each element should be ``"sliding_attention"`` or
74
+ ``"full_attention"``. Length must equal ``num_hidden_layers``. When ``None``,
75
+ all layers default to global attention.
76
+ swa_attention_sink_enabled (`bool`, *optional*, defaults to `False`):
77
+ Whether to enable learnable attention sinks on sliding-window attention layers.
78
+ When enabled, a per-head bias parameter is added that allows the model to attend
79
+ to position 0 even when it falls outside the sliding window.
80
+ swa_rope_parameters (`RopeParameters`, *optional*):
81
+ Separate RoPE configuration for sliding-window attention layers. When ``None``,
82
+ SWA layers use the same RoPE as global attention layers.
83
+ num_experts (`int`, *optional*, defaults to 256):
84
+ Number of routed experts.
85
+ num_experts_per_tok (`int`, *optional*, defaults to 16):
86
+ Number of experts selected per token (top-k).
87
+ moe_intermediate_size (`int`, *optional*, defaults to 1024):
88
+ Intermediate size of routed experts.
89
+ shared_expert_intermediate_size (`int`, *optional*, defaults to 1024):
90
+ Intermediate size of the shared expert.
91
+ norm_topk_prob (`bool`, *optional*, defaults to `True`):
92
+ Whether to normalize top-k routing probabilities.
93
+ decoder_sparse_step (`int`, *optional*, defaults to 1):
94
+ Frequency of MoE layers (1 = every layer is MoE after mlp_only_layers).
95
+ mlp_only_layers (`list[int]`, *optional*, defaults to `[0]`):
96
+ Layer indices that use dense MLP instead of MoE.
97
+ router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
98
+ Auxiliary loss coefficient for load balancing.
99
+ moe_routed_scaling_factor (`float`, *optional*, defaults to 1.0):
100
+ Scalar multiplier applied to the routed-expert output before combining with the
101
+ shared-expert output.
102
+ moe_apply_router_weight_on_input (`bool`, *optional*, defaults to `False`):
103
+ When ``True`` the top-k routing weights are multiplied into each expert's input
104
+ rather than its output. Matches the numerical form used by the trained checkpoint.
105
+ moe_router_logit_softcapping (`float`, *optional*, defaults to 0.0):
106
+ Optional soft-capping value ``c`` applied to router logits as
107
+ ``x = tanh(x / c) * c`` before sigmoid + top-k. Disabled when ``0``.
108
+ rope_parameters (`RopeParameters`, *optional*):
109
+ RoPE configuration. Defaults to rope_theta=500000.0.
110
+ """
111
+
112
+ model_type = "laguna"
113
+ keys_to_ignore_at_inference = ["past_key_values"]
114
+ # PreTrainedConfig in transformers v5 no longer auto-declares these; subclasses
115
+ # opt in by providing class-level annotations with defaults.
116
+ pad_token_id: int | None = None
117
+ bos_token_id: int | None = None
118
+ eos_token_id: int | list[int] | None = None
119
+ base_model_tp_plan = {
120
+ "layers.*.self_attn.q_proj": "colwise",
121
+ "layers.*.self_attn.k_proj": "colwise",
122
+ "layers.*.self_attn.v_proj": "colwise",
123
+ "layers.*.self_attn.g_proj": "colwise", # Laguna-specific gating projection
124
+ "layers.*.self_attn.o_proj": "rowwise",
125
+ "layers.*.mlp.gate_proj": "colwise",
126
+ "layers.*.mlp.up_proj": "colwise",
127
+ "layers.*.mlp.down_proj": "rowwise",
128
+ }
129
+ base_model_pp_plan = {
130
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
131
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
132
+ "norm": (["hidden_states"], ["hidden_states"]),
133
+ }
134
+
135
+ def __init__(
136
+ self,
137
+ vocab_size: int = 100352,
138
+ hidden_size: int = 2048,
139
+ intermediate_size: int = 8192,
140
+ num_hidden_layers: int = 48,
141
+ num_attention_heads: int = 32,
142
+ num_key_value_heads: int = 8,
143
+ head_dim: int = 128,
144
+ qkv_bias: bool = False,
145
+ attention_bias: bool = False,
146
+ gating: bool | str = True,
147
+ hidden_act: str = "silu",
148
+ max_position_embeddings: int = 4096,
149
+ initializer_range: float = 0.02,
150
+ rms_norm_eps: float = 1e-6,
151
+ use_cache: bool = True,
152
+ tie_word_embeddings: bool = False,
153
+ rope_parameters: RopeParameters | dict[str, RopeParameters] | None = None,
154
+ partial_rotary_factor: float | None = None,
155
+ attention_dropout: float = 0.0,
156
+ sliding_window: int | None = None,
157
+ layer_types: list[str] | None = None,
158
+ num_attention_heads_per_layer: list[int] | None = None,
159
+ swa_attention_sink_enabled: bool = False,
160
+ swa_rope_parameters: RopeParameters | None = None,
161
+ num_experts: int = 256,
162
+ num_experts_per_tok: int = 16,
163
+ moe_intermediate_size: int = 1024,
164
+ shared_expert_intermediate_size: int = 1024,
165
+ norm_topk_prob: bool = True,
166
+ decoder_sparse_step: int = 1,
167
+ mlp_only_layers: list[int] | None = None,
168
+ router_aux_loss_coef: float = 0.001,
169
+ moe_routed_scaling_factor: float = 1.0,
170
+ moe_apply_router_weight_on_input: bool = False,
171
+ moe_router_logit_softcapping: float = 0.0,
172
+ output_router_logits: bool = False,
173
+ **kwargs,
174
+ ):
175
+ # Default mlp_only_layers: first layer is dense (moe_first_k_dense_replace=1)
176
+ if mlp_only_layers is None:
177
+ mlp_only_layers = [0]
178
+
179
+ # Default layer_types: all layers use full attention (Laguna-M). Laguna-XS
180
+ # ships an explicit list with a mix of "full_attention" and "sliding_attention".
181
+ # Downstream mask builders (``create_masks_for_generate``) iterate
182
+ # ``layer_types``, so it must be a list — not left as ``None``.
183
+ if layer_types is None:
184
+ layer_types = ["full_attention"] * num_hidden_layers
185
+
186
+ # Default rope_parameters with Laguna's theta
187
+ if rope_parameters is None:
188
+ rope_parameters = {"rope_type": "default", "rope_theta": 500000.0}
189
+
190
+ # config.json stores SWA rope nested in rope_parameters["sliding_attention"]
191
+ # and carries no top-level swa_rope_parameters. Derive it here, else the
192
+ # sliding-window layers silently reuse the full-attention rope.
193
+ if swa_rope_parameters is None and isinstance(rope_parameters, dict):
194
+ swa_rope_parameters = rope_parameters.get("sliding_attention")
195
+
196
+ # If ``partial_rotary_factor`` is set at the top level, inject it into any
197
+ # rope dict that does not already carry one so the rotary embedding picks
198
+ # it up consistently for both full-attention and SWA layers.
199
+ if partial_rotary_factor is not None:
200
+ if isinstance(rope_parameters, dict) and "partial_rotary_factor" not in rope_parameters:
201
+ rope_parameters = {**rope_parameters, "partial_rotary_factor": partial_rotary_factor}
202
+ if isinstance(swa_rope_parameters, dict) and "partial_rotary_factor" not in swa_rope_parameters:
203
+ swa_rope_parameters = {
204
+ **swa_rope_parameters,
205
+ "partial_rotary_factor": partial_rotary_factor,
206
+ }
207
+
208
+ self.vocab_size = vocab_size
209
+ self.hidden_size = hidden_size
210
+ self.intermediate_size = intermediate_size
211
+ self.num_hidden_layers = num_hidden_layers
212
+ self.num_attention_heads = num_attention_heads
213
+ self.num_key_value_heads = num_key_value_heads
214
+ self.head_dim = head_dim
215
+ self.qkv_bias = qkv_bias
216
+ self.attention_bias = attention_bias
217
+ self.gating = gating
218
+ self.hidden_act = hidden_act
219
+ self.max_position_embeddings = max_position_embeddings
220
+ self.initializer_range = initializer_range
221
+ self.rms_norm_eps = rms_norm_eps
222
+ self.use_cache = use_cache
223
+ self.rope_parameters = rope_parameters
224
+ self.partial_rotary_factor = partial_rotary_factor
225
+ self.attention_dropout = attention_dropout
226
+ # Sliding window attention arguments
227
+ self.sliding_window = sliding_window
228
+ self.layer_types = layer_types
229
+ self.num_attention_heads_per_layer = num_attention_heads_per_layer
230
+ self.swa_attention_sink_enabled = swa_attention_sink_enabled
231
+ self.swa_rope_parameters = swa_rope_parameters
232
+ # MoE arguments
233
+ self.num_experts = num_experts
234
+ self.num_experts_per_tok = num_experts_per_tok
235
+ self.moe_intermediate_size = moe_intermediate_size
236
+ self.shared_expert_intermediate_size = shared_expert_intermediate_size
237
+ self.norm_topk_prob = norm_topk_prob
238
+ self.decoder_sparse_step = decoder_sparse_step
239
+ self.mlp_only_layers = mlp_only_layers
240
+ self.router_aux_loss_coef = router_aux_loss_coef
241
+ self.moe_routed_scaling_factor = moe_routed_scaling_factor
242
+ self.moe_apply_router_weight_on_input = moe_apply_router_weight_on_input
243
+ self.moe_router_logit_softcapping = moe_router_logit_softcapping
244
+ self.output_router_logits = output_router_logits
245
+
246
+ super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
247
+
248
+
249
+ __all__ = ["LagunaConfig"]
generation_config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 2,
6
+ 24
7
+ ],
8
+ "max_new_tokens": 32768,
9
+ "pad_token_id": 9,
10
+ "temperature": 1.0,
11
+ "top_p": 1.0,
12
+ "min_p": 0.0,
13
+ "top_k": 20,
14
+ "tool_call_parser": "poolside_v1",
15
+ "reasoning_parser": "poolside_v1",
16
+ "default_chat_template_kwargs": {
17
+ "enable_thinking": true
18
+ },
19
+ "speculative_config": {
20
+ "method": "dflash",
21
+ "source": "huggingface",
22
+ "model": "poolside/Laguna-S-2.1-DFlash",
23
+ "num_speculative_tokens": 15
24
+ }
25
+ }
model-00001-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8fd968d4c0d1c5ddaccaf93a3bb277d49652f853f628b5c7467c0161632e1dd
3
+ size 5079805456
model-00002-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e74b6bb8ba427c87dd8315fadaeb76386405e337f1f0be14fcbd526932e7806f
3
+ size 5118428616
model-00003-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:583231c1d7cee5f5c30889d95740ef11f96761fb211c5998c8e8d32dd44ab0e1
3
+ size 5115054984
model-00004-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ce6e48b7aad7ea1d88f4adc2363979268aece2d0cb3451258796f93ba7d3b6c
3
+ size 5115054984
model-00005-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:554e0b341efc75449e35373df435b01d1b393897faaaf2b266dfc579c659a738
3
+ size 5115054984
model-00006-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:09375e99bde0b699167640f283c6c97630cd04dc8cdf6577099acb6dbbf47132
3
+ size 5115054984
model-00007-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:211981662364c537705ab2f001e890a0dad78f317f991cba12328a8430912a20
3
+ size 5115054984
model-00008-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:accf003d94c40b9a1b18e1d0af8f09d6283845b0f9ab4d1620237c5acdb4c711
3
+ size 5115054984
model-00009-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:beb2b07cd0130203d940bd2d7e111ac3289a2924b987de4a4b66f4a75677c998
3
+ size 5115054984
model-00010-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:854c9ecfd640218821382cbe884234aa2ab4a095586b7e79332fe0dd39030451
3
+ size 5115054984
model-00011-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7990e4cfcef928737036a79b51dd18b583b97f768191e16a4c9c35ed6a8a90be
3
+ size 5115055728
model-00012-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4499f1834bbb61963e4cab3910d9fa68204e6a79df20e074e33033cc9eccebe
3
+ size 5115055736
model-00013-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21939ed1f057632d2619f8116bef1393f5651f66b42803e11cfb9421272acbe6
3
+ size 5115055744
model-00014-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56a93bce9942193cbc97d1bf0956e6e144d2eda5393f1451a8b29e47c1dd72e3
3
+ size 5115055752
model-00015-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8dbe8f40428c9b54dbdbe3bd48bfe24915e7ff6c041dc4f264253cfedf52c131
3
+ size 5115055752
model-00016-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7e321b971707b3202807173286ff9958b1c68d18294a8099c14cd9f19b1e031
3
+ size 5115055752
model-00017-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:635d2210c72a5433c54c6648d382907a273113d37565fc8327dfa48467fe4956
3
+ size 5115055752
model-00018-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3cf79b3ec1e02327aa0db2b401695d9f9ad30d554a5a196bc0c664e6efa1814
3
+ size 5115055752
model-00019-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:879c8ae5315d6ac85d06af3edd44c17259cc5da41cbb517e209557d8d495a7fe
3
+ size 5115055792
model-00020-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b17ade3e3b89f91a837da754c4b5664ca0aaf5ee303853929c2b61e7629e6d7
3
+ size 5115055792
model-00021-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ba6273814850b4f700a1610529d1dd49631077536bf4a647c526cc7757137f0
3
+ size 5115055792
model-00022-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:baafcfcaf638eb3281f544f19fe94061947b70b480ccb9fba2ccb1d9c9d375af
3
+ size 5115055792
model-00023-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5887ad7d9449bebd0ca74eb89e66fc365e3de0e2a0957f3129af2a508e425fd
3
+ size 5115055792
model-00024-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd42e9ecc725ca75416220d6928f5d604aa2e930d850e19fc28810076ad46950
3
+ size 5115055792
model-00025-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:806fb7ac2acb46e7fa998714346f30ca698203124a104016e96b3cc2afd41914
3
+ size 5115055792
model-00026-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50f5cab6c72b8cefbf73ca198142e91b297063c79999bb9db1d96914004ff2ca
3
+ size 5115055792
model-00027-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b136986ef03a9fb0d59b5402431b39a9a6c00e912aa0aa39202313b6f71725b
3
+ size 5115055792
model-00028-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b20986e17c2438afae92adacc73d8f0950c3b5fa1df7b841edf6f4599d0aba82
3
+ size 5115055792
model-00029-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06bc11f60a13bd25d5a051b43601174c1eabbfc8a79b7f27ce913f24dc0dd704
3
+ size 5115055744
model-00030-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f91f242ba966007796911d413c2a55301c2970e77b6aeb7ae106f969e00143c7
3
+ size 5115055744
model-00031-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eadd9d449788573437fd5547ddf1ab47d319bab86d386af09816fdce1a277e56
3
+ size 5115055752
model-00032-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cee82b9e55e10d7dc8e9e6d520307cad812da0578395735d350f2070688b911
3
+ size 5115055752
model-00033-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:431608c5d999abb7d221ba7eaea200c15a226f6b70b0745bbf2228bf77244465
3
+ size 5115055752
model-00034-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdccefda3ec897e2120fd6ce61295e76506c3738ff0d411440957e19ec53cdde
3
+ size 5115055752
model-00035-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96b809ce76baa75b689acf44c0b32e55b19668f045a70917cc46218be53c1e12
3
+ size 5115055752
model-00036-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a4768922f56d5882548e93e53afd481b1d4b4090b65f8b7f53ef69acc215b31
3
+ size 5115055784
model-00037-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2eb3e2ebb178c804671e03886384a0bf350ac28fa7e5b79c772d2f18818d2d46
3
+ size 5115055792
model-00038-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:347c4b5bad0fd5630903ded0cb7b5774563f321e245643dab80e6ca14915a395
3
+ size 5115055792
model-00039-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:268a4ce70a6d1dc532100171393f94f0d7c45b9fd0f1fbb538516f20cb1d14ba
3
+ size 5115055792
model-00040-of-00046.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3ee5dbe50a75da5776ff2e5b94b846e80964a083582696ffbbd3b4912e5050d
3
+ size 5115055792