Skip to content

Add Topic-Based Retrieval and Chunked Embeddings for Flashcard Generation #57

@AliBenrami

Description

@AliBenrami

Is your feature request related to a problem? Please describe.

Right now, embeddings are used mostly as supporting context for quiz and flashcard generation, but there is no full RAG-style retrieval system. Notes are generated by the LLM in Markdown, converted into structured JSON blocks, and then Gemini embeddings are generated from the processed note content.

The issue is that embedding an entire note as one unit is too broad for study features. If users have multiple similar notes, the embeddings can overlap heavily and retrieval becomes less precise. Flashcard generation also has no strong way to focus on a specific topic, concept, or section the user wants to study. This makes the current embedding workflow feel overbuilt for broad note-level retrieval but underpowered for precise generation.

Describe the solution you'd like

I would like to add a query-based retrieval system to the flashcard generation flow. Users should be able to enter a topic, concept, or focus area when generating flashcards, and the system should retrieve the most relevant note content before generation.

Instead of embedding each note as one large unit, the structured JSON note content should be split into smaller topic-based chunks. Each chunk would be embedded individually, allowing the system to retrieve more precise sections of a note. This would make flashcard generation more targeted and reduce irrelevant context.

When a note is edited, only the affected chunks should be re-embedded instead of regenerating embeddings for the entire note. This could reduce processing time while keeping the embeddings accurate.

An LLM/task queue could also be introduced to handle note processing, embedding updates, and generation requests asynchronously. This would make the system more scalable and prevent long-running AI tasks from blocking the user experience.

Describe alternatives you've considered

One alternative is to keep the current note-level embedding system and simply pass the entire note into flashcard generation. However, this does not solve the precision issue and may produce less focused flashcards.

Another option is to let users manually select notes or sections before generation. This would be simpler, but it puts more work on the user and does not take full advantage of embeddings.

A third option is to add basic keyword search instead of chunked embeddings. This could help with simple matching, but it would likely perform worse for semantic concepts, related ideas, or differently worded explanations.

Additional context

The current note pipeline already produces structured JSON from Markdown, so the system has access to block-level content. This structure could be used to create more meaningful chunks based on headings, sections, concepts, or related blocks.

The main goal is to make embeddings more useful for study features by improving retrieval precision. This would allow flashcards to be generated around specific topics instead of relying on broad note-level context.

Metadata

Metadata

Assignees

Labels

FrontendNote TakingCurrently, Taskmaster is split into two teams. this is one of themenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions