muhammaduxair/Hajj-Umrah-Guide-12B

A Hajj and Umrah guide for pilgrims, in the pilgrim's own language and script: English, Urdu, Roman Urdu, Arabic, or the Urdu–English mix many Pakistani pilgrims write in. Given passages from official Saudi guides, it answers in its first line and then gives everything the pilgrim needs: the ritual steps, the miqat and ihram from those passages, fitted to what the pilgrim says about themselves, plus practical advice marked "General advice". It gives no religious rulings: whether something is valid, or what penalty is due, it sends to a scholar.

β–Ά Try it live in the playground: ask in English, Urdu, Roman Urdu or Arabic, ask a follow-up, and open the official guide pages each answer used. The demo runs serverless, so the first answer after a quiet spell takes about 4–8 minutes while the model wakes; later answers come in seconds.

This card describes v2, the release behind the live demo. Built by Muhammad Uzair on Gemma 4 12B Instruct (revision 43c9d014b231474fa7212dbb48a762566c2b255d) with a LoRA fine-tune merged into the weights. Earlier release: revision="v1" (short numbered answers, no thinking).

What is new in v2

  • Fuller answers. v1 gave short numbered steps; v2 answers the question first, then covers the rest of what the pilgrim needs from every passage that helps, and adds marked practical advice.
  • It plans before it answers. With thinking on, v2 first writes a short plan in Gemma's thought channel (which passage says what), then the answer.
  • Conversations. It was trained on multi-turn conversations, including follow-up questions and corrections, with the earlier turns in the prompt.

Evaluation results

Rule-graded benchmark: 216 questions (36 questions, each in six styles: English, Urdu, Roman Urdu, mixed Urdu script, mixed Latin script, Arabic), each with the same eight retrieved passages for both models. Greedy decoding, up to 1,536 new tokens. Each answer is graded by category-specific rules: the required fact, forbidden facts such as another region's miqat, the reply's language and script, no ruling, and no invented prices or times; it passes only if every check does. v2 runs with thinking on, the base model without, as each is served.

Gemma 4 12B Instruct (base) v2
Pass rate (all checks) 56.5% 92.1%
Ritual and miqat: required fact present (108 questions) 93.5% 94.4%
Reply in the pilgrim's style 61.1% 99.1%
Rulings given 0 0
Wrong miqat named 3 2
Invented specifics 3 4

The two wrong miqats are one question (pilgrims from Najd by the old road) in two styles: v2 gives the right miqat, Dhat Irq, then adds Qarn al-Manazil, which other passages give for Najd. Three of the four "invented specifics" are Hijri ritual days ("8 Dhul Hijjah: Mina") in answers about this season's dates, which the grader counts by rule; the fourth quotes the Haram's parking fees, from a passage, when asked a hotel price.

Pairwise quality set: 10 new questions in six styles (60 prompts): complete Umrah and Hajj plans, pilgrims who describe their situation, practical questions, and follow-ups, with the same passages for both models. Claude Opus 5.5 compared v1's and v2's answers to each, shown in a random, recorded order, and judged correctness to the passages first, then completeness, helpfulness and language. v2 was preferred on 48 of 60 (80%): more complete on 59, more helpful on 58. v1 won 12, each because a shorter v1 answer had no ritual error where the longer v2 answer had one. Roman Urdu is v2's weakest style here (4 of 10). This is a single LLM judge on a small set: read it as a direction, not a precise measurement.

Quick start

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "muhammaduxair/Hajj-Umrah-Guide-12B"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
# To pin this release: revision="v2".

system = (
    "You are a Hajj and Umrah guide. Reply in the same language and script as the pilgrim: English, "
    "Urdu, Roman Urdu, Arabic, or the same Urdu–English mix. Answer the question in your first line, "
    "then give everything the pilgrim needs, combining every supplied text that helps and fitting "
    "what the pilgrim has told you about themselves. For ritual steps, the miqat, ihram, numbers and "
    "dates, use only the supplied texts: keep their steps and their order and add nothing, and never "
    "name a miqat they do not name. You may add practical general advice, marked \"General advice:\" in "
    "the pilgrim's language, but never ritual steps in it. Do not give religious rulings; if asked "
    "whether something is valid or what penalty is due, say it is a question for a scholar. Never "
    "invent prices, phone numbers or times; point to the group leader, Nusuk or the Ministry of Hajj "
    "and Umrah. If the supplied texts do not cover a ritual question, say so plainly, give what they "
    "do cover, and point to the Ministry of Hajj and Umrah guide. A miqat, a rule or a step applies "
    "to the pilgrim only when a supplied text gives it for their place, route, gender or type of Hajj "
    "(Ifrad, Tamattu, Qiran): never apply to them what a text gives for other people, and if no text "
    "gives the miqat for their route, say so and point to their group leader or Nusuk. When asked "
    "what comes after a step, give the next steps the texts state, in their order. Give a number from "
    "the texts only when it answers what the pilgrim asked. If the message is not about Hajj, Umrah "
    "or the pilgrim's journey, decline in one line in their language and give nothing else. In Roman "
    "Urdu, write only Latin letters."
)
passages = ("[1] Al-Jamarat: A Guide for Pilgrims β€” p.18\n"
            "Stone it with seven pebbles, saying β€œAllahu Akbar” with each throw. ...\n\n"
            "[2] The Day of Sacrifice: A Guide for Pilgrims β€” p.10\n"
            "After the pilgrim stones Jamrat al-Aqaba, it is prescribed for him to shave or trim his hair. ...")
question = "Eid ke din Jamrat al-Aqaba ko kankariyan kaise marni hain?"

messages = [{"role": "system", "content": system},
            {"role": "user", "content": f"Supplied texts:\n\n{passages}\n\nQuestion: {question}"}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=True,
                                       return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=1536, do_sample=False)
generated = out[0, inputs["input_ids"].shape[1]:].tolist()
close = tokenizer.convert_tokens_to_ids("<channel|>")          # ends the thought
answer = generated[generated.index(close) + 1:] if close in generated else generated
print(tokenizer.decode(answer, skip_special_tokens=True))

Number the passages as above ([n] title β€” page, then the text) and give the eight most relevant. Its plans are short (97 tokens at the median, 222 at most on our tests); in 1 of 276 test generations a plan repeated itself, so in serving stop the thought at 384 tokens, close it with <channel|> and let the model answer. Earlier turns of a conversation go in as plain user and assistant messages before the last question.

We retrieve the passages from the official guides with bge-m3 (revision 5617a9f61b028005a4858fdac845db406aefb181) and the bge-reranker-v2-m3 re-ranker (revision 953dc6f6f85a1b2dbfca4c34a2796e7dde08d41e): eight distinct pages, each joined with its neighbouring passages. The list of the 68 source documents, with their official URLs and hashes, is the dataset muhammaduxair/Hajj-Umrah-Guide-sources; their text stays with their publishers. In bf16 the model needs about 26 GB of GPU memory.

The guardrail

guardrail.py is the hook our server calls around the model. In this release it is a pass-through: scope and safety filtering are left to the application. The scores above measure the model alone.

Known limitations

  • A rule given for someone else. In long answers v2 sometimes applies what a passage gives for other pilgrims: a miqat for another region (Qarn al-Manazil for a traveller from Amman), the hady of Tamattu and Qiran to an Ifrad pilgrim, the women's quiet talbiyah to a man. The system prompt above tells it not to; check miqat and ritual details against the official guide.
  • After stoning Jamrat al-Aqaba it may leave out shaving or trimming.
  • Off-topic questions are usually declined, but not always.
  • Roman Urdu answers are weaker than the other styles.

Good to know

  • It answers from what you give it. Ritual steps, the miqat and ihram come only from the passages in the prompt. With the wrong passages it may answer the wrong part of the ritual, or say the texts do not cover it.
  • Check dates, times and places against the official guide or your group leader before you act on them. Arrangements change from year to year.
  • No rulings. It does not say whether an act is valid or what penalty is due. Ask a scholar.
  • Intended for guidance apps and prototypes where pilgrims can reach a person or the official guide. Not a replacement for scholars, group leaders or the Ministry.
  • Independent project. It is not affiliated with or endorsed by the Saudi Ministry of Hajj and Umrah, the Ministry of Health or Nusuk; it only reads their public guides.

Technical details

  • Data: 7,816 synthetic training examples, balanced across the six styles: 5,099 answers to single questions, 847 conversation turns, and 1,870 search-query planning examples. Teacher models (Claude Sonnet 5.5 and Gemini) wrote each answer and its plan from passages of 68 official guides of the Saudi Ministry of Hajj and Umrah and the Ministry of Health. Every answer passed automatic rule checks (language and script, no miqat or number absent from its passages, no rulings, length), and a stratified sample of 24 examples was reviewed by hand. The set was deduplicated against all test questions (exact and near matches).
  • Training (v2): QLoRA (rank 16, alpha 32, dropout 0.05, all attention and MLP projections) on a 4-bit NF4 base with bf16 compute; learning rate 2e-4 with cosine decay and 15 warm-up steps, effective batch 16, one epoch (489 steps) on one A100 40GB; sequences up to 8,192 tokens, with the loss on the final plan and answer only.
  • Release: the adapter was merged into the unquantized base in bf16 and checked against the evaluated model before upload.
  • Evaluation: rule-based grading with greedy decoding, and a pairwise judge for the quality set. The tests are specific to this project, so their scores do not compare with other benchmarks.

License and attribution

Apache-2.0, the license of the base model; see LICENSE and the Gemma 4 license page. Built on Gemma 4 by Google. The source texts are official publications of the Saudi Ministry of Hajj and Umrah and the Ministry of Health.

Downloads last month
4
Safetensors
Model size
12B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for muhammaduxair/Hajj-Umrah-Guide-12B

Finetuned
(347)
this model