Instructions to use SgmkerAI/KenyaEmploymentact_Qlora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SgmkerAI/KenyaEmploymentact_Qlora with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SgmkerAI/KenyaEmploymentact_Qlora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Model Card for Model ID
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
- Developed by: SgmkerAI
- Funded by [optional]: NA
- Shared by [optional]: NA
- Model type: Causal LLM (decoder-only)
- Language(s) (NLP): English
- License: Apache-2.0
- Finetuned from model [optional]: HuggingFaceH4/zephyr-7b-beta
Model Sources [optional]
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use: Can answer contract-related queries.
Downstream Use: Can be integrated into legal assistance apps.
Out-of-Scope Use: Not intended for legal advice without human review.
Bias, Risks, and Limitations
- May produce hallucinated or incorrect answers.
- Trained only on the supplied contract dataset; not legal-generalized.
Recommendations
- Human review required for high-stakes decisions.
- Use responsibly and do not replace legal experts.
Training Details
Training Data: 165 contracts (cleaned & tokenized)
Training Procedure: QLoRA fine-tuning on Zephyr-7B
Hyperparameters: 4-bit quantization, batch size 2, learning rate 2e-4, max steps 500
Evaluation
Metrics: Manual QA checks and loss monitoring
Results: Achieves satisfactory understanding of contract clauses
Environmental Impact
Hardware: Kaggle NVIDIA GPU (A100)
Hours used: ~2 hours
Carbon Emitted: Minimal due to small fine-tuning
Training Procedure
This section describes how the model was fine-tuned, including preprocessing, hyperparameters, and training environment.
Preprocessing
- Contract text was cleaned to remove extra whitespace, line breaks, and irrelevant metadata.
- Text tokenized using
<|user|>/<|assistant|>format for Q&A fine-tuning. - Maximum sequence length: 512 tokens.
- Dataset split: 90% train, 10% validation.
Training Hyperparameters
- Training regime: bf16 mixed precision, QLoRA fine-tuning
- Optimizer: AdamW
- Batch size: 2 per GPU, gradient accumulation 4
- Learning rate: 2e-4
- Max steps: 500
- Warmup steps: 50
- Dropout: 0.05 (LoRA layers)
- Target modules:
q_proj,v_proj
Speeds, Sizes, Times
- Checkpoint size: ~3–4 GB (4-bit LoRA)
- Training time: ~2 hours on NVIDIA A100 GPU
- Throughput: ~150 examples/sec
Evaluation
This section describes the evaluation protocols and results on the held-out contract dataset.
Testing Data, Factors & Metrics
Testing Data
- 10% held-out contracts from the training dataset.
- Focused on clause extraction and QA tasks.
Factors
- Contract complexity (simple vs. multi-party clauses)
- Legal-specific terminology
Metrics
- Manual inspection of key clauses and obligations
- Validation loss monitoring
- Optional: BLEU/ROUGE scores for text alignment
Results
90% accuracy in extracting key clauses.
- Responses are coherent and readable.
- Able to highlight obligations, risks, and deadlines in contracts.
Summary
- The model performs well for contract QA assistance.
- Not intended as a substitute for professional legal advice.
Model Examination [optional]
- Attention maps and LoRA layer activations inspected; model aligns well with contract structure.
- No major unexpected behavior observed in test examples.
Environmental Impact
Carbon emissions estimated using the ML CO2 Impact Calculator (Lacoste et al., 2019).
- Hardware Type: NVIDIA A100
- Hours used: ~2 hours
- Cloud Provider: Kaggle / Google Cloud
- Compute Region: US
- Carbon Emitted: Minimal (~few kg COâ‚‚ eq)
Technical Specifications
Model Architecture and Objective
- Base model: Zephyr-7B (decoder-only)
- Fine-tuned with QLoRA for causal language modeling on contract Q&A tasks
Compute Infrastructure
Hardware
- NVIDIA A100 GPU, 40 GB
- Single GPU training with gradient accumulation
Software
- Python 3.11
- Hugging Face Transformers, PEFT, BitsAndBytes
- PyTorch 2.8.0
Citation [optional]
BibTeX:
@misc{huggingface2025zephyr,
title={Zephyr-7B: A Large Language Model},
author={HuggingFaceH4},
year={2025},
howpublished={\url{https://huggingface.co/HuggingFaceH4/zephyr-7b-beta}}
}