Teacher: generate exercices
To generate exercises locally, serve Qwen 3.5 9B (6.6 GB) with Ollama or LM Studio, save your prompt in a custom template, request multiple-choice questions in script-validated JSON, and have code calculate the numeric answers instead of the model. The French national education system’s usage framework allows this use, provided you verify everything and disclose it.
Preparing exercises, answer keys, and adapted versions takes many long evenings, and AI can help if you retain control of the content. This guide sets up a local workstation for multiple-choice questions, exercises, and their adaptation, based on one guiding principle: the model drafts, the code calculates and checks, and the teacher verifies. It builds on the framework for AI use in education published in 2025.
#Why prepare your exercises with a local model
The framework for AI use in education published by the ministry in June 2025, as summarized by the regional education authorities, permits use for lesson preparation, assessment, and grading, with two obligations for teachers: systematically verify AI-generated work and be transparent about its use. It expressly prohibits using personal or confidential data in public-facing AI systems and encourages favoring open-source solutions. A local model meets all three points: nothing leaves the computer, no registration is required, and open-weight models are open-source solutions in the usual sense of the term.
One argument often made needs some nuance: preparing a math exercise with a consumer service is still allowed as long as no personal data is entered. The value of local deployment lies elsewhere. It lets you work with documents containing names, such as student papers or assessments, without exposing students. It works offline. And it provides stable behavior: a saved instruction and a model that does not change from one month to the next.
- Students and copies
- Never enter a name, identifiable copy, or opinion into an online service. Locally, the risk of transfer disappears, but minimization is still a good habit.
- Cost
- No subscription. The hardware already exists if your recent computer has 16 GB of memory; otherwise, a small model is enough for simple exercises.
- Offline
- Useful in a teachers’ room or in a school whose network filters AI services.
- Stability
- A prompt saved in a custom model produces consistent briefs from week to week.
#The minimal stack
Your private ChatGPT, free, on your own machine in an hour — LM Studio, Ollama, Open WebUI, your documents, no cloud.
- Lifetime online access
- PDF + files
- Lifetime updates
Two software options are available for serving the model: Ollama, from the command line, or LM Studio, with a more accessible graphical interface if the terminal puts you off. On the model side, Qwen 3.5 with 9 billion parameters weighs 6.6 GB in the Ollama library and advertises 256,000 context tokens: it fits on an 8 GB card or in the memory of a recent computer. Mistral Small 24B weighs 14 GB and requires more memory. A larger model is not a guarantee of accuracy; your review is.
To avoid retyping your prompt, create a custom model with a Modelfile: the SYSTEM instruction defines the system message applied to every conversation. The file below locks in the role, level, and style of your briefs.
#Generate usable multiple-choice quizzes, not just readable ones
A multiple-choice quiz requested as free-form text is difficult to reuse: you have to retype it into the classroom tool. It is better to request a structured format that the code can then validate. Ollama can constrain the response to a JSON schema: according to its documentation, you pass it in the format field. The model writes the questions; the script checks that there are four distinct choices and only one correct answer, then writes an importable file.
The GIFT format, used by Moodle, is a simple text file that can be imported into a question bank. If your institution uses another tool, adapt the last function: the principle remains to produce a file from the validated data, not to copy and paste the model's text. What the script does not verify is whether the questions are correct—which is why there is a section on verification.
#Anchor each question to a passage from your course
The safest method against invented facts is to require, for every question, the course passage that supports it. You paste in your text, add a passage field to the schema, and the script checks that the passage exists word for word in the supplied text. A question whose passage cannot be found is discarded: either the model invented it or paraphrased it without a source. This check does not prove that the question is good, but it guarantees that it is grounded in your course rather than in the model’s approximate memory.
The schema and instruction complement each other accordingly: add passage to the properties and required fields, and write in the instruction, “copy the passage from the text that justifies the correct answer word for word.” Questions about facts absent from the course, such as dates never mentioned, will not pass the filter, which is precisely the point.
#Math exercises: Python calculates, the model dresses it up
A 9-billion-parameter model makes mistakes on simple operations, especially with decimals and carrying. For calculation exercises, it is better to reverse the roles: the code randomly selects the numbers, calculates the exact result, and generates the answer key; the model writes the word problems around those numbers, which it does well. This way, the answers in your worksheets never depend on its arithmetic.
A fixed seed lets you regenerate exactly the same worksheet, for example to produce the corrected version the next day. The same principle applies to unit conversions, percentages, first-degree equations—anything that can be calculated: code generates and verifies it, while the model formats it. Languages are different, however: that is the model’s domain. It generates the sentences to complete, fill-in-the-blank dialogues, and instructions, which you must review.
#Corrections: ask, then cross-check
Ask for the answer key in a second message so the model keeps the prompt in context, specifying what you expect: the final answer, the step-by-step reasoning, the rule applied, and the typical mistake to avoid. The answer key is the riskiest part of the worksheet: a student can confidently learn the wrong answer. Two practices reduce the risk.
- Calculate rather than make it calculate
- When the answer can be calculated, get it from the code, not the model.
- Generate twice and compare
- For reasoning exercises, ask for the solution twice, using slightly different instructions. If the final answers differ, review the exercise manually.
- Have another model solve it
- A second model, from a different size or family, solves the problem statement without seeing the answer key. Disagreement indicates likely errors. It is not proof, just a filter.
- Proofread everything that will be distributed
- No automated check replaces the teacher’s review, and the teacher remains responsible for the content.
#Adapt a worksheet to the students' level
Differentiation is where the model adds the most value, because rephrasing is its strength. Start with a validated worksheet and ask for variants, keeping the same numbers and answers so the answer key remains valid. Have a colleague review the variant before distributing it: a simpler rephrasing can change the meaning of a question, which is a classic flaw of these rewrites.
| Need | Prompt to provide | Check next |
|---|---|---|
| Struggling student | Rephrase the statements as short sentences, add a solved example before the first exercise, and keep the same numbers | That the answers have not changed |
| Advanced student | Adds three advanced exercises that use the same concepts in a more abstract context | That the new exercises are feasible and correct |
| Special requirements | Reduce it to four exercises, with short sentences and one solved example before each exercise; formatting remains your responsibility | The agreement with the accommodations planned for the student |
| Oral version | Turns statements into questions to ask aloud, with one instruction per sentence | Oral readability |
#Check accuracy, discipline by discipline
| Discipline | Main risk | Verification |
|---|---|---|
| Mathematics | Retention, sign, and comma errors | Calculate with code; redo every exercise |
| History and geography | Invented or shifted dates, names, and figures | Cross-check against the manual or an official source |
| Languages | Incorrect forms, unnatural sentences | Review by a colleague or a native speaker |
| Science | Formulas, units, numerical values | Check every formula and unit |
| French | Nonexistent or misattributed citations | Check each citation against the work |
The common thread is that the model writes with the same confidence when it is right and when it is wrong. The ministerial framework also calls for systematic verification of AI output. In practice, set aside five minutes to review each worksheet, and keep a small log of errors you find: after a month, you will know which subjects the model is reliable for you in.
#A realistic production pace
- 01List the week's conceptsThree to five concepts, with the course excerpts to use as the source.
- 02Generate from your sourcesPaste the course excerpt into the prompt: the questions remain grounded in what you taught.
- 03Have the code calculate the answer keysFor anything encrypted, use a script like the one above.
- 04Review and correctRead the entry as a student would: a grading error is costly.
- 05Format the page and disclose usageExport to PDF or to your classroom tool, and tell students that AI helped prepare the worksheet, in accordance with the transparency requirement.
- Prompting basics
- Master system prompts
- Ollama Modelfile: create and customize your model
- LM Studio for beginners
- Limit hallucinations in a local LLM
- Structured JSON outputs with Ollama
- Source: summary of the framework for AI use in education (Normandy education authority)
- Source: framework for AI use in education (ministry)
- Source: the Ollama Modelfile
- Source: structured outputs from Ollama
- Source: Qwen 3.5 in the Ollama library
Can a teacher use AI to prepare lessons?+
Which local model should you choose to generate exercises?+
Can you trust AI-generated answer keys?+
Should you tell students that a handout was generated by AI?+
How do I import generated MCQs into Moodle or another tool?+
Can you enter student papers into a local model?+
Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.