{
  "id": 23579197,
  "title": "My study agent said \"Embedding your PDF :)\"",
  "url": "https://urgent.news/2026/12/05/my-study-agent-said-embedding-your-pdf",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-05T07:44:01.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/zkaria_gamal_3cddbbff21c8/my-study-agent-said-embedding-your-pdf--3fj7"
  },
  "original_language": null,
  "account": "StudyWithFriend is a local AI study assistant that enables users to drop PDFs into a folder, ask questions, and receive answers based on their own notes using Retrieval-Augmented Generation (RAG). The creator built this tool to simplify the process, but encountered several issues in the first version.\n\nThe initial problem was that embedding a PDF would freeze the chat entirely. The creator first resolved this by running the embedding process in a separate terminal window, but this introduced a new issue: the AI was no longer answering from the PDFs. After investigating the pipeline, they discovered that the database had 0 chunks, leading to five underlying bugs.\n\n1. The LLM was controlling the embedding process, which shouldn't be an LLM's responsibility. The application should handle background tasks independently.\n2. A library change caused the embedding job to crash at the final step, as it was using a deprecated method.\n3. The separate terminal window closed immediately after the process completed, leaving no visible error or feedback for debugging.\n4. Every PDF generated chunk IDs from 0, 1, 2, etc., causing overwriting issues and resulting in a non-functional knowledge base.\n5. The search results displayed negative similarity scores, which were being filtered out, effectively returning no results.\n\nTo address these issues, the creator changed the ingestion workflow. Now, the application controls embedding jobs, runs them in the background without blocking the chat, provides status messages, assigns unique chunk IDs, and corrects similarity calculation using cosine similarity.\n\nInterestingly, the creator also discovered an Ollama configuration issue. The num_gpu=1 setting controlled GPU layer offloading, not the number of GPUs, resulting in a 5x performance improvement when the setting was removed.\n\nThe end result is that an 8-page PDF is now fully processed and searchable within approximately 3 seconds after being dropped into the folder. The chat remains responsive, ingestion errors are visible, and retrieval functions properly. The creator emphasizes that reliable AI systems require reliable software engineering, not just focusing on the model or AI components.",
  "summary": "I built StudyWithFriend , a local AI study assistant that lets you drop PDFs into a folder, ask questions, and get answers based on your own notes using RAG (Retrieval-Augmented Generation). Sounds simple, right? Well, it wasn't. The problem In my first version, embedding a PDF would freeze the entire chat. My first solution was to move the embedding process into a separate terminal window. The…",
  "summary_source": "publisher",
  "key_points": [
    "StudyWithFriend tool simplifies PDF-based AI study assistance",
    "Creator resolves embedding freeze, database chunk issue, and other bugs",
    "Tool now processes 8-page PDF in 3 seconds with responsive chat"
  ],
  "editors_take": "Fixing these software engineering flaws ensures the study assistant actually uses uploaded notes instead of freezing or returning empty results during user chats.",
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}