Skip to content

Bug: Non-English queries never translated before embedding — broken multilingual retrieval #11

Description

@anushagarg6

Description

The new i18n system allows users to ask questions in French, Spanish, Hindi, Portuguese, and other languages. The answer_question pipeline accepts a language parameter and correctly translates the answer back to the user's language. However, the user's original question is embedded and searched against ChromaDB as-is, without first being translated to English.

Since the entire IPCC corpus and research papers are indexed in English, embedding a French or Hindi question produces a query vector that poorly matches the English document space, resulting in low-quality or empty retrieval.

translate_to_english() already existed in backend/llm/translation.py but was never called in the retrieval pipeline.

Reproduction

  1. Set language to French (fr) in the UI dropdown
  2. Ask: "Qu'est-ce qu'une vague de chaleur marine ?"
  3. Observe: retrieval returns 0 or irrelevant chunks despite the question being valid

Impact

All non-English queries return degraded or empty answers, making the multilingual feature effectively non-functional.

Location

backend/retrieval/pipeline.py — answer_question() function.

Fix Applied (commit 2936cb5)

Added retrieval_question = translate_to_english(question) if language != "en" else question before calling query_chunks(), so the translated English version is used for embedding while the original question is preserved for history and display.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions