Instructions to use goenkalokesh/MCQGenerator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use goenkalokesh/MCQGenerator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="goenkalokesh/MCQGenerator") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("goenkalokesh/MCQGenerator", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use goenkalokesh/MCQGenerator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "goenkalokesh/MCQGenerator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "goenkalokesh/MCQGenerator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/goenkalokesh/MCQGenerator
- SGLang
How to use goenkalokesh/MCQGenerator 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 "goenkalokesh/MCQGenerator" \ --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": "goenkalokesh/MCQGenerator", "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 "goenkalokesh/MCQGenerator" \ --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": "goenkalokesh/MCQGenerator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use goenkalokesh/MCQGenerator with Docker Model Runner:
docker model run hf.co/goenkalokesh/MCQGenerator
YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
π§ MCQGenerator β Fine-tuned LLaMA 3.1 8B for Educational Assessment
This model is a fine-tuned version of Metaβs LLaMA 3.1 8B, trained specifically for generating Multiple Choice Questions (MCQs) from academic passages using Alpaca-style instructions.
It was developed as part of a personalized learning platform focused on adaptive assessments for Kβ12 education. The model generates exactly n questions at a given difficulty level and returns the correct answers, making it suitable for real-time evaluations in edtech platforms.
π― Purpose
- π Generate clear and structured MCQs from textual content
- π§ͺ Create assessments tailored to specific difficulty levels
- π©βπ« Help educators and edtech apps automate quiz creation
- π§βπ Reinforce learning through adaptive testing and feedback
π§ Model Details
- Base Model: LLaMA 3.1 8B
- Training: Instruction-tuned using custom educational data
- Prompt Style: Alpaca (instruction β input β response)
- Dataset: 10,000+ curated educational passages with human-authored MCQs
- Frameworks: Hugging Face Transformers, PEFT (LoRA), Accelerate
βοΈ Alpaca-Style Prompt Format
The model expects prompts in the following format:
You are an intelligent and precise Multiple Choice Questions (MCQs) Generator, designed to create effective assessments.
Your goal is to generate exactly {no_mcq} clear, well-structured MCQs with four answer options each.
Ensure each MCQ has options labeled A, B, C, and D.
Also, give the answer key for all the questions at the end.
Do not generate more or fewer than {no_mcq} questions.
Do not include explanations or extra commentary.
### Instruction:
Generate exactly {no_mcq} {level}-level MCQs based on the following passage:
### Input:
{passage}
### Response:
Output:
At what temperature does water boil under standard atmospheric pressure?
A) 90Β°C
B) 95Β°C
C) 100Β°C
D) 110Β°CWhat is the boiling point of water under standard conditions?
A) 0Β°C
B) 50Β°C
C) 100Β°C
D) 150Β°CUnder what condition does water boil at 100Β°C?
A) High pressure
B) Low pressure
C) Vacuum
D) Standard atmospheric pressure
Answer Key:
- C
- C
- D
Usage:
from transformers import pipeline
generator = pipeline("text2text-generation", model="goenkalokesh/MCQGenerator")
prompt = """ You are an intelligent and precise Multiple Choice Questions (MCQs) Generator, designed to create effective assessments. Your goal is to generate exactly 3 clear, well-structured MCQs with four answer options each. Ensure each MCQ has options labeled A, B, C, and D. Also, give the answer key for all the questions at the end.
Do not generate more or fewer than 3 questions. Do not include explanations or extra commentary.
Instruction:
Generate exactly 3 Medium-level MCQs based on the following passage:
Input:
India gained independence from British rule in 1947 after years of struggle and sacrifice by freedom fighters.
Response:
"""
output = generator(prompt, max_new_tokens=400) print(output[0]['generated_text'])
π§βπ» Author
Lokesh Goenka π M.Sc. in Data Science & Computing π¬ Working on AI for Education, Adaptive Testing & Personalized Learning π Hugging Face Profile