Text Generation
Transformers
Safetensors
PEFT
qwen3
quantization
qlora
causal-lm
low-rank-adapters
4bit
bitsandbytes
efficient-finetuning
conversational
4-bit precision
Instructions to use abdou-u/MNLP_M2_quantized_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abdou-u/MNLP_M2_quantized_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="abdou-u/MNLP_M2_quantized_model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("abdou-u/MNLP_M2_quantized_model") model = AutoModelForCausalLM.from_pretrained("abdou-u/MNLP_M2_quantized_model", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use abdou-u/MNLP_M2_quantized_model with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use abdou-u/MNLP_M2_quantized_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "abdou-u/MNLP_M2_quantized_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdou-u/MNLP_M2_quantized_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/abdou-u/MNLP_M2_quantized_model
- SGLang
How to use abdou-u/MNLP_M2_quantized_model with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "abdou-u/MNLP_M2_quantized_model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdou-u/MNLP_M2_quantized_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "abdou-u/MNLP_M2_quantized_model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdou-u/MNLP_M2_quantized_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use abdou-u/MNLP_M2_quantized_model with Docker Model Runner:
docker model run hf.co/abdou-u/MNLP_M2_quantized_model
| library_name: transformers | |
| tags: [quantization, qwen3, qlora, causal-lm, low-rank-adapters, 4bit, bitsandbytes, peft, efficient-finetuning] | |
| # Qwen3-0.6B Quantized with QLoRA for Reasoning Tasks | |
| This is a 4-bit quantized version of `Qwen/Qwen3-0.6B-Base`, fine-tuned using LoRA adapters on multiple MCQA-style reasoning datasets. The model was optimized using QLoRA, a parameter-efficient tuning method with minimal memory footprint and minimal accuracy loss. | |
| ## Model Details | |
| ### Model Description | |
| This model is: | |
| - A quantized version of `Qwen/Qwen3-0.6B-Base` using `bitsandbytes` 4-bit NormalFloat (nf4) | |
| - Fine-tuned using Low-Rank Adaptation (LoRA) with rank 8 | |
| - Adapted to multiple-choice reasoning datasets like AQuA-RAT and TheoremQA | |
| - Fully compatible with Hugging Face Transformers | |
| - **Developed by:** Ahmed Abdelmalek (EPFL CS-552 Project) | |
| - **Model type:** Causal Language Model | |
| - **Language(s):** English | |
| - **License:** Apache 2.0 | |
| - **Fine-tuned from model:** `Qwen/Qwen3-0.6B-Base` | |
| ### Model Sources | |
| - [Repository](https://huggingface.co/Qwen/Qwen3-0.6B-Base) | |
| ## Uses | |
| ### Direct Use | |
| You can directly use this model for MCQA-style question-answering tasks using generation. | |
| ### Out-of-Scope Use | |
| - Not intended for open-ended generation or safety-critical applications | |
| - Not intended for real-time or commercial deployment without evaluation | |
| ## Bias, Risks, and Limitations | |
| - Inherits biases from its base model and training data (e.g., reasoning datasets) | |
| - May fail on adversarial or out-of-distribution logic tasks | |
| ### Recommendations | |
| Evaluate the model against your specific reasoning task before production use. | |
| ## How to Get Started with the Model | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| model_id = "your-username/MNLP_M2_quantized_model" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True) | |
| prompt = "Question: What is 3 + 5? | |
| Options: | |
| A) 6 | |
| B) 8 | |
| C) 9 | |
| D) 10 | |
| Answer:" | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| outputs = model.generate(**inputs, max_new_tokens=50) | |
| print(tokenizer.decode(outputs[0], skip_special_tokens=True)) | |
| ``` | |
| ## Training Details | |
| ### Training Data | |
| - Processed versions of AQuA-RAT, TheoremQA, and custom MCQA datasets | |
| - Unified into a single format with rationale-enhanced prompts | |
| ### Training Procedure | |
| - **Precision:** fp16 | |
| - **Quantization:** 4-bit nf4 + double quant + float16 compute | |
| - **Adapter Type:** LoRA (r=8, α=16, dropout=0.05) | |
| - **Base model frozen** | |
| #### Training Hyperparameters | |
| - **Epochs:** 3 | |
| - **Batch size:** 4 | |
| - **Grad accum steps:** 2 | |
| - **Optimizer:** paged_adamw_8bit | |
| ## Evaluation | |
| ### Testing Data | |
| Validation set with 1000 samples held out from the unified dataset. | |
| ### Metrics | |
| - Accuracy / F1 (to be reported in evaluation phase) | |
| ## Environmental Impact | |
| - **Hardware:** Google Colab Pro, GPU A100 | |
| - **Hours used:** ~6–7 hours | |
| - **Carbon Emitted:** Estimated with [MLCO2](https://mlco2.github.io/impact#compute) | |
| ## Technical Specifications | |
| ### Architecture | |
| - Qwen3-0.6B base | |
| - 28-layer transformer with rotary positional encoding and 16 heads | |
| ### Compute Infrastructure | |
| - **Hardware:** Colab A100 GPU, High RAM | |
| - **Software:** Python 3.10, PyTorch 2.2.2, Transformers 4.51.3 | |
| ## Contact | |
| - **Author:** Ahmed Abdelmalek | |
| - **Email:** ahmed.abdelmalek@epfl.ch |