Run this model with HF Jobs

Run getachewgetu/AmLegal_Gemma-Inst on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/getachewgetu/AmLegal_Gemma-Inst. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/getachewgetu/AmLegal_Gemma-Inst on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/getachewgetu/AmLegal_Gemma-Inst. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/getachewgetu/AmLegal_Gemma-Inst. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

⚖️ AmLegal_Gemma-Inst: Specialized Amharic Legal LLM

AmLegal_Gemma-Inst is an open-weights, domain-adapted language model fine-tuned for Amharic legal question answering and Retrieval-Augmented Generation (RAG) over decisions of the Federal Supreme Court of Ethiopia Cassation Division (የኢትዮጵያ ፌዴራል ጠቅላይ ፍርድ ቤት ሰበር ሰሚ ችሎት).

The model is based on google/gemma-3-4b-it and adapted using Rank-Stabilized LoRA (rsLoRA, $r=64$, $\alpha=64$, $\alpha/\sqrt{r}$ scaling) with completion-only loss masking and negative distractor conditioning.


📊 Empirical Evaluation (Held-Out Cassation Decisions)

Evaluated against the unadapted base model and alternative 7B models on strictly unseen Ethiopian Supreme Court decisions:

Evaluation Metric Base Gemma-3-4B Qwen-2.5-7B FT AmLegal_Gemma-Inst (Ours) Relative Delta
ROUGE-1 ($F_1$) 29.68% 38.40% 49.66% +67.3%
ROUGE-2 ($F_1$) 19.58% 27.10% 34.94% +78.4%
ROUGE-L ($F_1$) 29.68% 36.59% 49.66% +67.3%
SacreBLEU 8.80 28.29 23.47 +166.7%
chrF 19.27 — 38.95 +102.1%
BERTScore $F_1$ 58.40% — 91.30% +56.3%
Evidence Grounding 84.00% 78.00% 92.00% +9.5%
Citation Recall 68.94% 15.31% 88.07% +27.7%
Citation Precision 88.46% 23.21% 92.02% +4.0%
Citation $F_1$ 77.49% 18.45% 90.00% +16.1%
Foreign Contamination 7.49% — 0.03% -99.6% (Eliminated)
Distractor Misattribution — — 0.00% Zero confusion
Answer Completeness (1–3) 2.14 — 2.88 +34.6%

🧑‍⚖️ LLM-as-a-Judge Qualitative Scores (Scale 1–10)

  • Faithfulness: 9.43 / 10
  • Relevance: 9.20 / 10
  • Consistency: 9.17 / 10
  • Coherence: 9.00 / 10
  • Clarity: 8.90 / 10
  • Accuracy: 8.53 / 10
  • Overall Mean: 8.77 / 10

💻 Quick Start & Inference

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "getachewgetu/AmLegal_Gemma-Inst"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

prompt = """<start_of_turn>user
አንተ የኢትዮጵያ ፍርድ ቤት ጉዳዮችን የምትመለከት ከፍተኛ የህግ ረዳት ነህ። ከዚህ በታች በተሰጠው የሰበር ችሎት የውሳኔ ዐውደ-ጽሑፍ ላይ ብቻ ተመርኩዘህ ለቀረበው ጥያቄ ትክክለኛ ዝርዝር እና ሕጋዊ መሠረት ያለው ምላሽ በአማርኛ ቋንቋ ብቻ ስጥ።

**የሰበር ውሳኔ ዐውደ-ጽሑፍ:**
[ቅጽ 15 መዝገብ ቁጥር 80202]
... (የሰበር ችሎት ውሳኔ ጽሑፍ) ...

**ጥያቄ:**
በቅጽ 15፣ መዝገብ ቁጥር 80202 የተመዘገበው የክርክሩ ዋና ጉዳይ ምን ነበር?<end_of_turn>
<start_of_turn>model
"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
    **inputs,
    max_new_tokens=512,
    do_sample=False,
    repetition_penalty=1.1
)

answer = tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
print(answer)

🏛️ Citation & Authorship

Developed by Getachew Getu as part of the Amharic Legal RAG Research Project.

Downloads last month
46
Safetensors
Model size
4B params
Tensor type
BF16
¡
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for getachewgetu/AmLegal_Gemma-Inst

Finetuned
(882)
this model