Downloads · 30 days
53
33% of all-time downloads
GiusMagi/qwen3-4b-prosody-rag-lora-mlx
qwen3-4b-prosody-rag-lora-mlx is a text generation model from GiusMagi. Use it when you need the model to write or continue text. It is set up for mlx. The card lists the license as apache-2.0.
LoRA adapter for mlx-community/Qwen3-4B-Instruct-2507-4bit, fine-tuned to answer questions about prosody, intonational phonology and phonetics (with a focus on Italian and Italo-Romance varieties) in a retrieval-augme…
Downloads · 30 days
53
33% of all-time downloads
All-time downloads
159
Public
Repo size
2.5 GB
Likes
0
Public
Click a slice to open those files.
.gguf2.5 GB · 99%
From the Hugging Face model README
LoRA adapter for mlx-community/Qwen3-4B-Instruct-2507-4bit, fine-tuned to answer questions about prosody, intonational phonology and phonetics (with a focus on Italian and Italo-Romance varieties) in a retrieval-augmented regime: the model expects one or more source excerpts in the user message and produces grounded, terminologically precise answers in English or Italian.
Trained with mlx-lm on an Apple M4 Pro.
This adapter is designed as the generation head of a RAG system over a linguistics paper collection. Prompt format used in training:
system: You are an expert assistant in prosody and phonology. Answer the
question based on the provided excerpt, using precise terminology.
user: ESTRATTO (<source>, p. <n>):
<excerpt text>
DOMANDA: <question>
Without excerpts in the prompt, the model falls back to generic behaviour — it was deliberately not trained to answer from parametric memory, to avoid hallucinated bibliography.
from huggingface_hub import snapshot_download
from mlx_lm import load, generate
adapter = snapshot_download("GiusMagi/qwen3-4b-prosody-rag-lora-mlx")
model, tokenizer = load("mlx-community/Qwen3-4B-Instruct-2507-4bit",
adapter_path=adapter)
messages = [
{"role": "system", "content": "You are an expert assistant in prosody and phonology. Answer the question based on the provided excerpt, using precise terminology."},
{"role": "user", "content": "ESTRATTO (...): <excerpt>\n\nDOMANDA: <question>"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False,
add_generation_prompt=True)
print(generate(model, tokenizer, prompt=prompt, max_tokens=400))
prosody-rag-4b.Q4_K_M.gguf (2.5 GB) is the adapter fused into the base
model and quantized Q4_K_M — runs anywhere via llama.cpp, LM Studio or Ollama:
llama-cli -m prosody-rag-4b.Q4_K_M.gguf --temp 0.3 -cnv
# oppure, con Ollama:
# FROM ./prosody-rag-4b.Q4_K_M.gguf → ollama create prosody-rag
| Base model | Qwen3-4B-Instruct-2507 (4-bit, MLX) |
| Method | LoRA (rank 8, 16 layers, scale 20) |
| Data | 2,256 train / 94 valid QA pairs, each grounded in an excerpt from a private corpus of ~6,800 linguistics papers (prosody, intonation, phonology) |
| Data generation | QA pairs synthesized by Qwen3-8B from stratified corpus samples, bilingual (EN/IT) |
| Schedule | 3,200 iterations, batch 2, max seq 1,536, lr 1e-5 |
| Result | val loss 2.47 → 1.86 |
| Hardware | Apple M4 Pro, 24 GB (≈314 tok/s, 3h47m) |