Falcon-H1R-7B UAE Laws LoRA Adapter

A LoRA adapter for tiiuae/Falcon-H1R-7B finetuned on UAE Federal Laws to provide legal analysis in IRAC format.

What is IRAC?

IRAC is a legal analysis framework:

  • Issue: Identifies the legal question
  • Rule: Cites the relevant law/article
  • Application: Explains how the rule applies to the situation
  • Conclusion: Provides the final answer

Quick Start Options

Method Best For
GGUF + Ollama Local deployment, easy setup
Python + LoRA Custom integration, fine-tuning

GGUF + Ollama (Recommended)

The easiest way to run this model locally is with Ollama.

1. Install Ollama

curl -fsSL https://ollama.com/install.sh | sh

2. Download the GGUF

# Download from HuggingFace
wget https://huggingface.co/SalahALHaismawi/falcon-h1r-uae-laws/resolve/main/falcon-h1r-uae-laws.gguf

3. Create a Modelfile

Create a file named Modelfile:

FROM ./falcon-h1r-uae-laws.gguf

TEMPLATE """### Instruction:
{{ .Prompt }}

### Response:
"""

PARAMETER stop "### Instruction:"
PARAMETER temperature 0.1

4. Create and Run

# Create the model in Ollama
ollama create falcon-uae-laws -f Modelfile

# Run inference
ollama run falcon-uae-laws "What are the penalties for drunk driving in the UAE?"

Example Ollama Output

Issue: Drunk driving penalties. Rule: Under UAE Federal Decree-Law No. 14 of 2020
(amending the Penal Code) and the Federal Traffic Law, driving under the influence
of alcohol is a criminal offence punishable by imprisonment and or a fine...

Training Dataset

UAE Laws Q&A Dataset (IRAC Format)

  • 9,477 samples of UAE legal Q&A pairs
  • 100% IRAC format consistency
  • 83.8% cite specific article numbers
  • Human-written seed data (~1,000 pairs) + synthetic generation with human validation
from datasets import load_dataset
dataset = load_dataset("SalahALHaismawi/uae-laws-irac")

Example Outputs

Example 1: Criminal Law

Question: What are the penalties for drunk driving in the UAE?

Response:

Issue: Drunk driving penalties. Rule: Under UAE Federal Decree-Law No. 14 of 2020 (amending the Penal Code) and the Federal Traffic Law, driving under the influence of alcohol is a criminal offence punishable by imprisonment and or a fine, with penalties increasing if damage, injury, or death is caused. Application: Anyone who drives a vehicle while intoxicated may be punished by imprisonment and a fine as determined by the court. If the offence results in damage to property, bodily injury, or death, stricter penalties including longer imprisonment and higher fines may be imposed. Conclusion: Drunk driving in the UAE is a serious offence with penalties that escalate depending on the harm caused.


Example 2: Labor Law

Question: What happens if an employer terminates an employee without notice in the UAE?

Response:

Issue: Employer terminates without notice. Rule: Article 44 of Federal Decree-Law No. 33 of 2021 permits termination without notice only in specific circumstances. Article 47 provides compensation where termination is unlawful. Application: If an employer terminates an employee without notice and without a valid legal reason, the employee is entitled to compensation of up to three months' salary, in addition to notice pay and other contractual entitlements. Conclusion: An employer who unlawfully terminates an employee without notice must compensate the employee in accordance with UAE Labour Law.


Example 3: Property Law

Question: What are the rules regarding property ownership for foreigners in the UAE?

Response:

Issue: Can foreigners own property in the UAE? Rule: Foreigners may own property only in areas designated by the relevant Emirate, subject to applicable laws and regulations. Application: Emirate-level legislation determines the specific freehold or usufruct areas where foreign ownership is permitted. Conclusion: Foreigners may own property in the UAE only in designated areas and in accordance with Emirate-specific regulations.


Python Usage

from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch

# Load with 8-bit quantization (required)
tokenizer = AutoTokenizer.from_pretrained("tiiuae/Falcon-H1R-7B", trust_remote_code=True)
bnb_config = BitsAndBytesConfig(load_in_8bit=True)

base_model = AutoModelForCausalLM.from_pretrained(
    "tiiuae/Falcon-H1R-7B",
    quantization_config=bnb_config,
    device_map="auto",
    max_memory={0: "15GiB"},  # Prevents CPU offloading issues
    trust_remote_code=True
)

# Load the LoRA adapter
model = PeftModel.from_pretrained(base_model, "SalahALHaismawi/falcon-h1r-uae-laws-lora")
model.eval()

# Generate response
question = "What are the penalties for drunk driving in the UAE?"
prompt = f"### Instruction:\n{question}\n\n### Response:\n"

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    output = model.generate(
        **inputs,
        max_new_tokens=400,
        do_sample=False,
        pad_token_id=tokenizer.eos_token_id
    )

response = tokenizer.decode(output[0], skip_special_tokens=True)
print(response.split("### Response:")[-1].strip())

Training Details

Parameter Value
Base Model tiiuae/Falcon-H1R-7B
Method LoRA (Low-Rank Adaptation)
Rank (r) 32
Alpha 64
Dropout 0.05
Target Modules q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Training Data UAE Federal Laws

Available Files

File Size Description
falcon-h1r-uae-laws.gguf ~15GB Quantized model for Ollama/llama.cpp
adapter_model.safetensors ~134MB LoRA adapter weights
adapter_config.json - LoRA configuration

Important Notes

8-bit quantization is required for Python usage - The model produces incorrect outputs without it

GGUF works out of the box - No quantization setup needed when using Ollama

RAG Implementation is recommended: This fine-tune teaches the model IRAC format aligned with UAE legal text. For the most accurate legal output, implement a document retriever or web-crawler to reduce hallucinations and ground the truth.

Use the exact prompt format shown above for best results

Legal Disclaimer: This model is for educational purposes only. Always consult a qualified legal professional for actual legal advice.


Model Architecture

Falcon-H1R-7B is a hybrid architecture combining:

  • Mamba (State Space Model) layers for efficient sequence processing
  • Attention layers for complex reasoning

This makes it particularly efficient for long legal documents.


License

Apache 2.0 (following the base model license)

Author

Salah AlHaismawi

Downloads last month
177
GGUF
Model size
8B params
Architecture
falcon-h1
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for SalahALHaismawi/falcon-h1r-uae-laws

Adapter
(1)
this model