fix: pre-translate non-English chunks to English before LLM inference
Mehdi
67da08d
French PDFs caused the model to output French despite English-only
instructions — the source tokens dominated the decoding distribution.
Fix: detect French via stop-word heuristic, translate the chunk with
a dedicated LLM call (cached per chunk), then use the English version
for question generation, MCQ and evaluation.
Also strip leading number prefixes (e.g. '3. ') from section bodies
in the JS feedback parser so mis-numbered model output renders cleanly.
fix: enable sampling — temperature=0.8 for MCQ, 0.4 for evaluator
Mehdi
8f2e039
Greedy decoding (do_sample=False) caused the model to repeat the same
answer for all 4 MCQ options (e.g. 4x BERT) and to copy source text
verbatim for the model answer. Sampling breaks the repetition loop and
produces diverse, coherent outputs.
fix: stronger MCQ/evaluator prompts — no duplicates, no self-reference, English-only, section 2 always present
Mehdi
c8e8b73
- MCQ: explicit rule against self-referential questions and duplicate options
- MCQ: retry loop (up to 3x) validates all 4 choices are unique before returning
- Evaluator: section 2 (What was good) is MANDATORY even for wrong/empty answers
- Evaluator: section 4 must synthesize answer in own words, not copy source text
- Both: stronger English-only enforcement with explicit "translate everything" instruction
fix: make the llama.cpp CPU runtime actually usable on the Space
Mehdi
b5f4a07
- No @spaces.GPU window for llamacpp (CPU-only, was wasting quota and
capping calls at 180s)
- Preload the GGUF into RAM at startup in a background thread
- JS: pick up late results even after the spinner times out, timeout
raised to 5 min with honest CPU-mode messages, guarded by mode
- Evaluation capped at 320 tokens to fit CPU latency
fix: truncate runaway question generation to the first question
Mehdi
81e2542
The v2 fine-tune never learned EOS (pad==eos masked the stop token in
training labels), so open questions rambled into endless Q/A streams.
Clean the output to the first '?' and cap generation at 80 tokens.
feat: amphitheater hero with mouse-tracking robot professor, fixed particles
fix: prompts évaluateur séparés EN/FR pour forcer la langue du feedback
Mehdi
5e6ff7d
fix: texte question/feedback invisible + prompt langue renforcé
Mehdi
7c23d32
fix: tighten question prompt to avoid compound multi-part questions
Mehdi
3e7d6d6
feat: switch to MiniCPM4-8B, add robustness, score tracker, language selector
Mehdi
83ec3f5
- model/llm.py: upgrade to MiniCPM4-8B with bfloat16 and chat template
- requirements.txt: relax transformers pin to >=4.50.0
- core/parser.py: handle corrupt/scanned/empty PDFs with clear errors
- app.py: graceful error handling in all pipeline steps
- app.py: session score tracker (correct/total with verdict parsing)
- app.py: FR/EN language selector wired to question and evaluation prompts
- core/questioner.py: language param in prompt
- core/evaluator.py: language param in prompt
feat: initial project structure with all core modules