Fix quiz feedback: re-retrieve sources for grading and validate feedback structure - #132
Open
jshuao wants to merge 1 commit into
Open
Fix quiz feedback: re-retrieve sources for grading and validate feedback structure#132jshuao wants to merge 1 commit into
jshuao wants to merge 1 commit into
Conversation
Crysta1ightning
suggested changes
Sep 5, 2026
|
|
||
| try { | ||
| const retrievedSources = quizState.currentSources | ||
| const feedbackQuery = `${quizState.currentQuestion}\n${answer}` |
There was a problem hiding this comment.
Since feedbackQuery combines the question with the full student answer, a long or vocabulary-rich incorrect answer may dominate the retrieval query and shift the retrieved chunks away from the question’s topic. This could cause grading to use irrelevant evidence. Would it be safer to retrieve primarily using the question, or preserve/merge quizState.currentSources rather than replacing them entirely?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quiz feedback was often vague or incomplete because the source chunks were selected randomly for each question and then reused unchanged all the way through grading, with no re-retrieval based on the actual question or the student's answer.
Fixes this issue by implementing the FAISS similarity index that is used for regular chat, re-retrieving sources using the question and the answer. If this fails then it falls back to the original sources. validateQuizFeedback() also added to check that the feedback follows the correct format, and gets corrected before reaching the user if it is in the incorrect format.