Instructions to use odelpa/mistral-small-scienziato-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use odelpa/mistral-small-scienziato-v2 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Mistral-Small-3.2-24B v2 — «Lo Scienziato Dilettante GDP» (adattatore LoRA, scala 0,85)
Giovanni Del Papa — ricercatore indipendente, Italia · Independent researcher, Italy (progetto Lo Scienziato Dilettante GDP, Arianna Labs)
🇮🇹 Italiano · 🇬🇧 English · 📄 Articolo / Paper: paper/article_it.pdf · paper/article_en.pdf · DOI Zenodo: 10.5281/zenodo.23809148 · Divulgativa / plain-language: paper/divulgativa_it.pdf · paper/divulgativa_en.pdf · Codice / code: https://github.com/usergdp136/mistral-small-scienziato-v2 · Dati / data: https://huggingface.co/datasets/odelpa/mistral-small-scienziato-v2-dati · Ollama: ollama run ollamagdp/mistral-small-scienziato-v2
Modello gemello (stessa ricetta) / sister model:
odelpa/qwen14-scienziato-v2
Italiano
In una frase
Un adattatore LoRA (r = 16, 0,38 % dei parametri, solo ramo linguistico) addestrato su risposte generate dal modello stesso (auto-distillazione, senza codice, solo dati con licenza commerciale) e applicato a scala 0,85 porta l'identità dichiarata da 8 % a 100 % (test a parole chiave, 50 domande) senza differenze statisticamente significative su ARC-it, GSM8K e IFEval. L'unico guadagno significativo è l'identità; non c'è alcun miglioramento di capacità.
| Test (held-out) | n | base | + LoRA scala 0,85 | differenza [IC 95 %] | p (McNemar) |
|---|---|---|---|---|---|
| ARC-it | 1132 | 90,9 % | 91,0 % | +0,09 (1 / 0 item) | 1,00 |
| GSM8K | 919 | 95,1 % | 95,1 % | 0,00 (6 / 6) | 1,00 |
| IFEval (prompt-level strict) | 341 | 77,1 % | 75,7 % | −1,47 [−4,96; +2,03] (16 / 21) | 0,51 |
| Identità (parole chiave) | 50 | 8,0 % | 100 % | +92 (46 / 0) | < 0,001 |
Adattatore a scala 1,0 («ft»): ARC-it 91,0 %, GSM8K 94,7 %, IFEval 75,7 %, identità 100 %. Merge fisico bf16 (scala 0,85): identità 92 %, IFEval 74,5 %.
⚠️ Limiti (leggere prima di usare)
- Calo puntuale su IFEval (−1,47 punti sul held-out, 341 prompt). Non è statisticamente significativo (IC [−4,96; +2,03], p = 0,51), ma supera come stima puntuale la soglia di −1 punto della nostra regola pre-registrata (R3 b): non si può quindi affermare «nessuna perdita». Con questi n non si escludono perdite fino a ~5 punti su IFEval.
- L'identità è misurata a parole chiave/regex (
code/pod/score.py), non da un giudice umano o da un modello. Le 4 risposte «corrette» della base sono falsi positivi (la parola chiave è nella domanda). Il 100 % non è correttezza fattuale: il modello può inventare dettagli. - Nessun miglioramento di capacità.
- Il merge fisico in bf16 fallisce il criterio d'identità (92 %): perciò il riferimento pubblicato è l'adattatore, da non fondere in bf16. Il GGUF per Ollama è un merge in fp16 (somma fp32) quantizzato a 4 bit e non è l'oggetto valutato nell'articolo (vedi
OLLAMA_README.md). - Un solo run, un solo seed, greedy. Scala scelta su un set di sviluppo (40 domande d'identità, 400 GSM8K, 200 IFEval). Costo: 6,69 $ (A100 80 GB, 3,74 h).
- Scheda identità scritta a mano; solo testo (il ramo visione non è stato addestrato né valutato); nessuna valutazione di sicurezza/codice.
Come funziona, passo per passo
- Dati: prompt con licenza commerciale (aya_dataset ITA, oasst1, GSM8K-train, prompt generati dal modello e vincoli verificabili in stile IFEval propri); esclusi dataset con output di modelli proprietari e i prompt di IFEval (
results/MANIFEST.json). - Auto-distillazione: Mistral-Small-3.2 scrive le proprie risposte (vLLM, bf16, T = 0,7); la scheda identità è visibile solo in generazione, assente nel training. Risultato: 8.601 esempi di train + 299 di validazione (8.597 + 298 effettivamente usati dal trainer, 6,97 M token).
- Addestramento LoRA: r = 16, α = 16, dropout 0,05, 7 proiezioni × 40 strati del solo ramo linguistico, 92.405.760 parametri addestrabili; LR 3·10⁻⁵ coseno, warm-up 3 %, 1 epoca, batch 16, 538 passi, bf16; loss ≈ 0,23 → ≈ 0,13, val 0,137; A100 SXM 80 GB, ≈ 2 h.
- Scale di merge: $W = W_0 + s,\tfrac{\alpha}{r} B A$ con $s\in{0{,}3;,0{,}5;,0{,}7;,0{,}85;,1{,}0}$ (si scala
lora_B). - Regola pre-registrata R1 (solo dev): la scala più piccola con identità dev ≥ 95 %, GSM8K dev ≥ base − 1 pt, IFEval dev ≥ base − 1 pt → s = 0,85 (dev: identità 97,5 %, GSM8K 94,0 %, IFEval 78,5 %; s = 0,7 dà solo 67,5 %).
- Valutazione: vLLM 0.32.0 bf16, greedy, seed 1234, stesso template dell'addestramento; ARC-it via logprob, GSM8K regex, IFEval
lm_evalprompt-level strict, identità a parole chiave. - Statistica: IC di Wilson 95 %, McNemar esatto, IC di Wald appaiato.
Uso dell'adattatore
Tre cartelle: adapter_s085/ (consigliata, scala 0,85 già applicata), adapter/ (scala 1,0) e tokenizer/ (tokenizer.json + template di chat usati).
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
from peft import PeftModel
BASE = "mistralai/Mistral-Small-3.2-24B-Instruct-2506"
tok = AutoTokenizer.from_pretrained("odelpa/mistral-small-scienziato-v2", subfolder="tokenizer") # stesso tokenizer/template usati in addestramento e valutazione (il repo base ha solo tekken.json)
m = AutoModelForImageTextToText.from_pretrained(BASE, torch_dtype=torch.bfloat16, device_map="auto")
m = PeftModel.from_pretrained(m, "odelpa/mistral-small-scienziato-v2", subfolder="adapter_s085") # NON fondere in bf16 (vedi limiti)
msgs = [{"role": "user", "content": "Chi sei?"}]
x = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(m.device)
print(tok.decode(m.generate(**x, max_new_tokens=200, do_sample=False)[0][x["input_ids"].shape[1]:], skip_special_tokens=True))
Con vLLM: vllm serve mistralai/Mistral-Small-3.2-24B-Instruct-2506 --enable-lora --lora-modules ft=<cartella adapter_s085> (come nella valutazione). L'identità appare con il system prompt di default di Mistral (nessun system esplicito) o con system neutri; non è garantita con system prompt che dichiarano un'altra identità.
Come riprodurre
bash code/pod/setup.sh <max_secondi> # pod A100/H100 80 GB: ambiente, download base, dati
bash code/pod/run_all.sh # generazione → training → scale+dev+R1 → test+merge+statistiche
# analisi (scarica prima il dataset -dati in ./dati)
python code/analysis/paired_stats.py dati/results
python code/analysis/make_figures.py dati figures/
bash code/analysis/build_pdf.sh paper/article_it.md paper/article_it.pdf # pandoc + tectonic
Gli script del pod assumono /workspace e un token Hugging Face nell'ambiente (non incluso).
Ollama
ollama run ollamagdp/mistral-small-scienziato-v2 — GGUF Q4_K_M del merge fp16 a scala 0,85 (code/gguf/). Test fatti sul GGUF: identità 49/50 = 98 % (scorer a parole chiave), GSM8K 29/30 su un campione di 30 problemi del test; IFEval e ARC non misurati (llama-server, temperatura 0, una sola esecuzione) (dettagli in OLLAMA_README.md).
Licenze
Codice e adattatore: Apache-2.0 (base Mistral-Small-3.2-24B-Instruct-2506: Apache-2.0, © Mistral AI). Testo degli articoli: CC BY 4.0. Dati: licenze commerciali (Apache-2.0, MIT; risposte generate da Mistral-Small-3.2, Apache-2.0), elenco in results/MANIFEST.json. Nessun segreto o token è incluso.
English
In one sentence
A rank-16 LoRA adapter (0.38 % of the parameters, language branch only) trained on the model's own answers (self-distillation, no code, commercially licensed data only) and applied at scale 0.85 takes the stated identity from 8 % to 100 % (keyword test, 50 questions) with no statistically significant difference on ARC-it, GSM8K and IFEval. The only significant gain is identity; there is no capability improvement.
| Held-out test | n | base | + LoRA scale 0.85 | difference [95 % CI] | p (McNemar) |
|---|---|---|---|---|---|
| ARC-it | 1132 | 90.9 % | 91.0 % | +0.09 (1 / 0 items) | 1.00 |
| GSM8K | 919 | 95.1 % | 95.1 % | 0.00 (6 / 6) | 1.00 |
| IFEval (prompt-level strict) | 341 | 77.1 % | 75.7 % | −1.47 [−4.96; +2.03] (16 / 21) | 0.51 |
| Identity (keywords) | 50 | 8.0 % | 100 % | +92 (46 / 0) | < 0.001 |
Adapter at scale 1.0 ("ft"): ARC-it 91.0 %, GSM8K 94.7 %, IFEval 75.7 %, identity 100 %. Physical bf16 merge (scale 0.85): identity 92 %, IFEval 74.5 %.
⚠️ Limitations (read before use)
- Point drop on IFEval (−1.47 points on the held-out set, 341 prompts). Not statistically significant (CI [−4.96, +2.03], p = 0.51), but as a point estimate it exceeds the −1 point threshold of our pre-registered rule (R3 b), so "no loss" cannot be claimed. With these sample sizes, losses of up to ~5 IFEval points are not excluded.
- Identity is scored with keywords/regex (
code/pod/score.py), not by a human or a model judge. The 4 "correct" base answers are false positives (the keyword is in the question). 100 % is not factual correctness: the model can invent details. - No capability improvement.
- A physical bf16 merge fails the identity criterion (92 %): the published reference is therefore the adapter, not to be merged in bf16. The Ollama GGUF is an fp16 merge (fp32 summation) quantised to 4 bits and is not the object evaluated in the paper (see
OLLAMA_README.md). - One run, one seed, greedy. The scale was chosen on a development set (40 identity questions, 400 GSM8K, 200 IFEval). Cost: $6.69 (A100 80 GB, 3.74 h).
- Hand-written identity card; text only (the vision branch was neither trained nor evaluated); no safety/code evaluation.
How it works, step by step
- Data: commercially licensed prompts (aya_dataset ITA, oasst1, GSM8K-train, model-generated prompts and our own verifiable IFEval-style constraints); datasets with proprietary-model outputs and IFEval prompts excluded (
results/MANIFEST.json). - Self-distillation: Mistral-Small-3.2 writes its own answers (vLLM, bf16, T = 0.7); the identity card is visible only at generation time, absent from training. Result: 8,601 train + 299 validation examples (8,597 + 298 used by the trainer, 6.97 M tokens).
- LoRA training: r = 16, α = 16, dropout 0.05, 7 projections × 40 layers of the language branch only, 92,405,760 trainable parameters; LR 3·10⁻⁵ cosine, 3 % warm-up, 1 epoch, batch 16, 538 steps, bf16; loss ≈ 0.23 → ≈ 0.13, val 0.137; A100 SXM 80 GB, ≈ 2 h.
- Merge scales: $W = W_0 + s,\tfrac{\alpha}{r} B A$ with $s\in{0.3, 0.5, 0.7, 0.85, 1.0}$ (scaling
lora_B). - Pre-registered rule R1 (dev only): the smallest scale with dev identity ≥ 95 %, dev GSM8K ≥ base − 1 pt, dev IFEval ≥ base − 1 pt → s = 0.85 (dev: identity 97.5 %, GSM8K 94.0 %, IFEval 78.5 %; s = 0.7 gives only 67.5 %).
- Evaluation: vLLM 0.32.0 bf16, greedy, seed 1234, same template as training; ARC-it via logprobs, GSM8K regex, IFEval
lm_evalprompt-level strict, keyword identity. - Statistics: Wilson 95 % CI, exact McNemar, paired Wald CI.
Using the adapter
Three folders: adapter_s085/ (recommended, scale 0.85 already applied), adapter/ (scale 1.0) and tokenizer/ (the tokenizer.json + chat template used). See the Python snippet above (subfolder="adapter_s085"), or vllm serve mistralai/Mistral-Small-3.2-24B-Instruct-2506 --enable-lora --lora-modules ft=<adapter_s085 folder>. The identity appears with Mistral's default system prompt (no explicit system message) or neutral system prompts; it is not guaranteed under system prompts declaring another identity. Do not merge in bf16.
How to reproduce
See the commands above (code/pod/, code/analysis/); pod scripts assume /workspace and a Hugging Face token in the environment (not included).
Ollama
ollama run ollamagdp/mistral-small-scienziato-v2 — Q4_K_M GGUF of the fp16 merge at scale 0.85 (code/gguf/). Tests on the GGUF: identity 49/50 = 98 % (keyword scorer), GSM8K 29/30 on a sample of 30 test problems; IFEval and ARC not measured (llama-server, temperature 0, a single run) (details in OLLAMA_README.md).
Licences
Code and adapter: Apache-2.0 (base Mistral-Small-3.2-24B-Instruct-2506: Apache-2.0, © Mistral AI). Article text: CC BY 4.0. Data: commercially usable licences (Apache-2.0, MIT; answers generated by Mistral-Small-3.2, Apache-2.0), listed in results/MANIFEST.json. No secrets or tokens are included.
- Downloads last month
- -
Model tree for odelpa/mistral-small-scienziato-v2
Base model
mistralai/Mistral-Small-3.1-24B-Base-2503
