Instructions to use shefowl/SenseNova-Loop-9B-Polish-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use shefowl/SenseNova-Loop-9B-Polish-LoRA with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/content/sn") model = PeftModel.from_pretrained(base_model, "shefowl/SenseNova-Loop-9B-Polish-LoRA") - Notebooks
- Google Colab
- Kaggle
SenseNova-Loop-9B Polish LoRA
A LoRA adapter that teaches SenseNova-Loop-9B to write Polish. The base model reasons well, but its Polish answers read like a translation: wrong cases and gender agreement, calques, the odd Cyrillic word. With this adapter the reasoning stays the base model's and the answer is fixed: a fifth to two thirds fewer language errors in Polish (depending on the judge) and clearly more natural text, by two independent judges.
Ready-to-run GGUF files with the adapter merged (Q8_0, Q6_K, Q5_K_M, Q4_K_M) are in shefowl/SenseNova-Loop-9B-Polish-GGUF.
The adapter
| Rank / alpha / dropout | 32 / 64 / 0 |
| Target modules | all linear layers of the language model: q_proj, k_proj, v_proj, o_proj (full attention), in_proj_qkv, in_proj_z, out_proj (linear attention), gate_proj, up_proj, down_proj (MLP) |
| Not trained | embeddings, output head, vision tower, loop gates |
| Trainable parameters | 80.2M (0.9% of the model) |
| File | adapter_model.safetensors, 306 MiB, BF16 |
| Base revision | 3cc220e9c14bd7a74813c1299765e22147b1a3d5 |
The vision tower is untouched, so image input should work as in the base model (not tested).
Usage
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
from peft import PeftModel
base = "sensenova/SenseNova-Loop-9B"
model = AutoModelForImageTextToText.from_pretrained(base, trust_remote_code=True, dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(model, "shefowl/SenseNova-Loop-9B-Polish-LoRA")
model = model.merge_and_unload() # optional: merge once for faster inference
tok = AutoTokenizer.from_pretrained(base, trust_remote_code=True)
msgs = [{"role": "user", "content": "Napisz krótki e-mail do sąsiada z prośbą o przyciszenie muzyki po 22:00."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=8000, do_sample=False)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
- Use greedy decoding (
do_sample=False, or temperature 0). It gave the fewest errors; at temperature 0.6 errors go up. - Leave thinking on. Without the reasoning step answers are faster, but slightly worse.
- About one task in ten runs out of the 8,000-token reasoning budget and returns an empty answer (the base model does this too). If that happens, ask again with thinking off (
enable_thinking=Falseinapply_chat_template). All the numbers below include that retry.
For llama.cpp, use the GGUF repo: support for SenseNova-Loop is in the open pull request ggml-org/llama.cpp#32588 and not merged yet.
How good is the Polish
102 Polish tasks in 13 categories (formal and informal e-mails, explanations, style rewrites, proofreading, translation EN→PL and PL→EN, grammar questions, creative writing, how-tos, opinions, facts, marketing). No task in the set has a similar prompt in the training data. Two judges score every answer: Mistral Medium and Claude Haiku 5.5. They count language errors per 100 words, and rate fluency and task completion from 1 to 5. All runs use the merged model as Q8_0 GGUF in llama.cpp and greedy decoding (temperature 0).
| Model | Errors / 100 words ↓ (Medium / Haiku) | Fluency ↑ | Task ↑ |
|---|---|---|---|
| SenseNova-Loop-9B (base) | 5.33 / 4.68 | 3.20 / 3.05 | 3.70 / 3.73 |
| this model | 4.13 / 1.68 | 3.82 / 4.06 | 3.97 / 3.96 |
| Bielik-11B-v3.2-Instruct (teacher) | 2.95 / 0.64 | 4.35 / 4.71 | 4.65 / 4.48 |
Paired against the base model on the same 102 tasks, with 95% bootstrap intervals:
| Medium | Haiku | |
|---|---|---|
| Errors / 100 words | −1.20 [−2.08…−0.28] | −3.00 [−3.68…−2.30] |
| Fluency | +0.63 [+0.39…+0.86] | +1.01 [+0.78…+1.23] |
| Task | +0.27 [−0.04…+0.58] | +0.24 [−0.03…+0.49] |
Both judges agree on the direction for every measure. The two judges differ in how strict they are, so compare rows, not judges. Answers also got shorter and to the point: the median is 62 words, the same as the teacher's.
Polish next to the other languages
The same 102 tasks, translated, in English, German and French, with the same judges and settings. Each judge used a rubric for the language in question. DeepSeek V4.1 Flash (via API, no reasoning) is there to show how hard each language version of the set is.
Errors per 100 words, Medium / Haiku (lower is better):
| English | German | French | Polish | |
|---|---|---|---|---|
| SenseNova-Loop-9B (base) | 2.25 / 0.46 | 4.27 / 2.59 | 3.49 / 1.86 | 5.33 / 4.68 |
| after this LoRA | 1.76 / 0.50 | 4.19 / 1.82 | 2.93 / 1.66 | 4.13 / 1.68 |
| DeepSeek V4.1 Flash | 1.77 / 0.31 | 2.71 / 0.46 | 2.44 / 0.38 | 3.22 / 0.61 |
Fluency 1–5, Medium / Haiku (higher is better):
| English | German | French | Polish | |
|---|---|---|---|---|
| SenseNova-Loop-9B (base) | 4.37 / 4.68 | 3.14 / 3.54 | 3.62 / 3.90 | 3.20 / 3.05 |
| after this LoRA | 4.32 / 4.65 | 3.39 / 3.90 | 3.82 / 4.16 | 3.82 / 4.06 |
| DeepSeek V4.1 Flash | 4.60 / 4.79 | 4.30 / 4.79 | 4.34 / 4.76 | 4.40 / 4.63 |
The base model is an English model first: its German and French are about as weak as its Polish. After the LoRA its Polish matches or beats the base model's German and French: fewer errors than German by both judges, about as many as French, and more fluent than both. It is still well behind its English.
Training on Polish did not hurt the language of the other answers: errors in English, German and French stay within noise (a little fewer in German by Haiku), and German and French read slightly more fluently by both judges. What did change: answers got shorter in every language (median 120–140 words before, 65–85 after), the judges rate task completion up to 0.4 points lower in English, German and French (significant for one judge in English and French), and repetition is flagged somewhat more often. If you mostly need English, the base model is the better choice.
What did not change: this is still a 9B model that first reasons, mostly in English, and then answers. Knowledge, math and code are the base model's. It is not a replacement for a native Polish model like Bielik on purely Polish work. It is the base model's reasoning with a much better Polish answer.
How it was trained
- Data: 3,299 Polish prompts of 17 kinds (the 13 above plus summaries, complaints, announcements and customer replies), written by DeepSeek V4.1 Flash and Claude Haiku 5.5; 563 of them are prompts of polish-writing-eval. Bielik-11B-v3.2-Instruct (Apache 2.0) wrote the answers. The data without anything that overlaps an evaluation set is polish-sft-bielik (2,736 rows).
- Target: SenseNova first wrote its own reasoning for each prompt. The training sample is that reasoning as context plus Bielik's answer, with the loss on the answer only. The model learns to answer in good Polish without learning a different way of thinking.
- LoRA: rank 32, alpha 64, on all linear layers of the language model (attention, linear attention, MLP). Embeddings, the output head and the vision tower are untouched. 80M trainable parameters. 2 epochs, one A100.
What did not help, for anyone trying the same:
- A second epoch lowered the held-out loss by only 0.011. One epoch is enough.
- Rank 64 was no better than 32.
- DPO on top (teacher's answer preferred over the model's own) gave no gain: errors +0.09 (Haiku) and +0.83 (Medium), both well within noise. The model already imitates the teacher after SFT, and the preference pairs mostly taught it to tell the two styles apart.
- Corrected answers as targets (Mistral Large and Small fixing the base model's own answers) helped less than the teacher's own answers: 5.19 / 3.20 errors per 100 words against 4.13 / 1.68 here.
License
Apache 2.0, like the base model and the teacher. Unofficial community fine-tune, not affiliated with or endorsed by SenseNova.
- Downloads last month
- -
Model tree for shefowl/SenseNova-Loop-9B-Polish-LoRA
Base model
sensenova/SenseNova-Loop-9B