Downloads · 30 days
86
6% of all-time downloads
L0uu/gemma4-e4b-etafakna-gguf
gemma4-e4b-etafakna-gguf is a text generation model from L0uu. Use it when you need the model to write or continue text. It is set up for gguf. The card lists the license as gemma.
A fine-tuned Gemma 4 E4B model specialized in Tunisian law, built for the E-Tafakna platform.
Downloads · 30 days
86
6% of all-time downloads
All-time downloads
1.4K
Public
Repo size
47.1 GB
Likes
1
Public
Click a slice to open those files.
.gguf25.7 GB · 100%
From the Hugging Face model README
A fine-tuned Gemma 4 E4B model specialized in Tunisian law, built for the E-Tafakna platform.
The model is designed primarily for Retrieval-Augmented Generation (RAG) legal assistants and answers legal questions in French based on Tunisian legal codes and legislation.
⚠️ This model provides legal information only — it does not constitute professional legal advice.
⚠️ This model is not intended to replace legal professionals and should not be used without a retrieval pipeline in production legal systems.
| File | Quant | Size | Description |
|---|---|---|---|
gemma4-etafakna-q4_k_m.gguf | Q4_K_M | ~5.3 GB | Recommended for most users — good balance of quality and speed |
gemma4-etafakna-f16.gguf | F16 | ~15 GB | Full precision — use for requantization or maximum quality |
This model is designed to work best as part of a Retrieval-Augmented Generation (RAG) pipeline rather than as a standalone legal model.
Because Tunisian law requires precise article references, contextual interpretation, and up-to-date legal sources, the model relies on retrieved legal documents to generate accurate and grounded answers.
Without retrieval, the model may:
For optimal performance, use the model with:
The intended workflow is:
User Question
↓
Legal Document Retrieval (RAG)
↓
Relevant Tunisian Legal Articles
↓
Gemma 4 E4B — E-Tafakna
↓
Grounded Legal Response with Citations
The model was specifically fine-tuned on examples where:
⚠️ The quality of the response depends heavily on the quality of the retrieved legal context.
ollama run hf.co/L0uu/gemma4-e4b-etafakna-gguf:Q4_K_M
Create a file called Modelfile:
FROM hf.co/L0uu/gemma4-e4b-etafakna-gguf:Q4_K_M
SYSTEM """
Vous êtes un assistant juridique de la plateforme E-Tafakna, spécialisé dans le droit tunisien.
Répondez uniquement à partir des documents fournis.
Si une question dépasse le contenu des documents, indiquez-le clairement et recommandez de consulter un professionnel.
Structurez votre réponse par problématique juridique.
Citez toujours les articles et sources.
Ceci ne constitue pas un avis juridique professionnel.
"""
Then:
ollama create etafakna -f Modelfile
ollama run etafakna
llama-server -hf L0uu/gemma4-e4b-etafakna-gguf:Q4_K_M
# or
llama-cli -hf L0uu/gemma4-e4b-etafakna-gguf:Q4_K_M
from llama_cpp import Llama
llm = Llama.from_pretrained(
repo_id="L0uu/gemma4-e4b-etafakna-gguf",
filename="gemma4-etafakna-q4_k_m.gguf",
)
llm.create_chat_completion(
messages=[
{
"role": "system",
"content": "Vous êtes un assistant juridique spécialisé dans le droit tunisien."
},
{
"role": "user",
"content": "Quelles sont les conditions pour qu'un contrat soit valable en droit tunisien?"
}
]
)
User:
Quelles sont les conditions pour qu'un contrat soit valable en droit tunisien?
Documents pertinents:
[1] Source: Article 2 du Code des obligations et des contrats
Les éléments nécessaires pour la validité des obligations qui dérivent d'une déclaration de volonté sont: la capacité de s'obliger, une déclaration valable de volonté portant sur les éléments essentiels de l'obligation, un objet certain pouvant former objet d'obligation, une cause licite de s'obliger.
Model:
The model will provide a structured response citing Article 2 of the Code des obligations et des contrats, breaking down the four conditions:
| Parameter | Value |
|---|---|
| Base model | unsloth/gemma-4-E4B-it |
| Method | LoRA (rank 16, alpha 32, dropout 0) |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Precision | fp16 (no base model quantization during training) |
| Dataset | 1,619 Tunisian law Q&A pairs in French |
| Epochs | 3 |
| Effective batch size | 8 (batch 1 × gradient accumulation 8) |
| Learning rate | 2e-4 (cosine schedule, 5% warmup) |
| Max sequence length | 2,048 tokens |
| Optimizer | AdamW 8-bit |
| Weight decay | 0.01 |
| Max grad norm | 1.0 |
| Training loss masking | Responses only (using train_on_responses_only) |
| GPU | NVIDIA Tesla V100S (32 GB) |
| Framework | Unsloth + TRL SFTTrainer |
The training data consists of 1,619 cleaned Q&A examples covering Tunisian legal topics in French.
Each example follows a multi-turn chat format with:
save_pretrained_mergedllama.cpp/convert_hf_to_gguf.pyllama-quantizeRoPE type: The converter reported Unknown RoPE type: proportional and defaulted to NONE.
This is expected for Gemma 4's architecture and should not impact inference in recent llama.cpp versions.
Duplicated GGUF keys: Warnings about overwritten keys (context_length, head_count, key_length, etc.) are normal.
Gemma 4 uses heterogeneous layer configurations where some layers have different attention dimensions.
This model inherits the Gemma license from Google.