惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
D
DataBreaches.Net
U
Unit 42
P
Proofpoint News Feed
I
InfoQ
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
博客园 - Franky
博客园_首页
IT之家
IT之家
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志

LangChain Forum - Latest posts

Prompt_cache_retention: '24h' supported in langchain agents and where to provide it, inside invoke or while creating client? Could RAG pipelines realistically cause deployment timeouts, is Render suitable for first-time RAG deployments? How do I use langchain_postgres' init_vectorstore_table correctly? Proposal: Graph-wide default error handler for StateGraph (fallback for nodes without error_handler) Support timedelta for CachePolicy.ttl, consistent with TimeoutPolicy Question about LangSmith Trace Search via API How to cancel a run correct !! Anyone confirms this issue that deepagent ui streaming is disturb by update in deepagent or bug issue Would pre-inference routing help long-context agent workflows? Best Stack for Building AI Applications Question about LangSmith Trace Search Seeking help regarding the connection between Websocket and tool calls Tool invocation error with empty error message when using `InjectedState` + `Command` return in async tool How to use @langchain/react FileSystem middleware Using ChatSnowflake with agents Built llmsessioncontract on AgentMiddleware: runtime enforcement of tool-call protocols — feedback wanted DeltaChannelHistory not found in langgraph-api:3.12 Improving citation accuracy and reducing hallucinations in custom Parent-Child RAG pipeline (Gemma3:4B + FAISS+BM25 + Cross-encoder reranker) Metadata filter not filtering for alerts Connecting the Slack integration fails with invalid_team_for_non_distributed_app Trouble understanding and editing experiment summary evaluators feedbacks SSL certificate error from httpx with LangGraph server WikipediaLoader endup in JSONDecodeError Human-in-the-loop approval dashboard for LangGraph agents — open source, free to deploy Should interrupt() be split into two primitives — one for human input, one for s2s data fetching? How are people handling data governance across agent handoffs in production? Feature Request: @task metadata Research: Friction Points in Agentic Commerce Transactions How should I provide an agent to a LangGraph server?
Help with local RAG pipeline – poor retrieval quality, wr...
IchNarA · 2026-04-20 · via LangChain Forum - Latest posts
Hi everyone, I’m building a fully local RAG application in Python (no cloud APIs) and running into several persistent issues. I’ll pin the full source below. Would really appreciate any advice from people who’ve dealt with similar setups. -– ### Stack overview - **LLM:** Qwen2.5:7b via Ollama - **Embeddings:** `intfloat/multilingual-e5-base` (HuggingFace, offline) - **Vector store:** FAISS (child chunks) + BM25 (via LangChain) - **Reranker:** `cross-encoder/mmarco-mMiniLMv2-L12-H384-v1` - **Chunking:** Parent-child strategy – MarkdownHeaderTextSplitter for parents, RecursiveCharacterTextSplitter for children - **PDF extraction:** pymupdf4llm (fast) or MinerU (slow, for LaTeX-heavy docs) - **Pipeline:** LangGraph with nodes: pre-retrieval → hybrid retrieve → rerank → build context → evaluate evidence → generate - **UI:** Streamlit Documents are primarily English-language academic PDFs (e.g. Montgomery’s Design and Analysis of Experiments, 720 pages). User queries are always in Slovak. -– ### Problem 1 – Cross-lingual retrieval failure (SK query → EN document) This is the most painful issue. When a user asks *“čo to je replikácia?”* (“what is replication?”), the FAISS similarity search returns completely irrelevant chunks (confidence ~0.045) even though the word “replication” appears many times in the document. My current workaround: Detect document language via `langdetect` If EN document detected, translate the SK query to EN using the LLM before retrieval Use the translated query in both FAISS and BM25 This partially works but is inconsistent – sometimes the LLM translates to “What is replication?”, sometimes it doesn’t, so results are non-deterministic even at temperature=0. I also added a rescue BM25 search in `evaluate_evidence` as a last resort, which helps but retrieves chunks from wrong pages (e.g. page 424 instead of page 13 where the definition actually is). **Questions:** - Is `multilingual-e5-base` simply too weak for SK↔EN cross-lingual retrieval? Should I switch to a different model (e.g. `intfloat/multilingual-e5-large`, `BAAI/bge-m3`, or a dedicated cross-lingual model)? - Is there a better approach than LLM-based query translation? I considered expanding the index with translated chunks but haven’t implemented it yet. - Any experience with `mmarco-mMiniLMv2` reranker for non-English content? I suspect it’s poorly calibrated for Slovak and the confidence scores are systematically too low (~0.04 instead of expected ~0.3+). -– ### Problem 2 – Wrong page numbers in cited sources My chunker injects `` markers into the markdown before chunking, then detects which page each chunk belongs to by matching text probes against page texts. The logic works reasonably for single-page chunks but breaks in two cases: **Large parents spanning multiple pages** – when `_split_large` splits them, all resulting chunks inherit the original parent’s page metadata instead of getting re-detected page numbers. **Dense mathematical/formula-heavy pages** – probes (min 15 chars) often don’t match because MinerU reformats LaTeX and the text doesn’t align with the original page content. The cited pages are sometimes off by 5–15 pages which makes source verification impossible. **Questions:** - Is there a more reliable strategy for page attribution in RAG chunking? - Would embedding page number tokens directly into chunk text help BM25/FAISS associate chunks with correct pages? -– ### Problem 3 – Poor Slovak output quality The LLM (Qwen2.5:7b) receives English context and is instructed via system prompt to answer in Slovak. The output Slovak is grammatically broken – literal word-by-word translations, wrong declensions, invented compound words (e.g. “olejová hniloba” for “oil quench”, “oholenie vzorku” for “quenching a specimen”). Current system prompt instructs: - Always answer in Slovak - Don’t translate literally, explain in your own words - Keep English technical terms in parentheses if unsure This helps somewhat but the quality is still poor for technical content. **Questions:** - Is Qwen2.5:7b simply not good enough for EN→SK technical translation in context? Would a larger model (Qwen2.5:14b, gemma3:12b) make a significant difference? - Has anyone tried a two-step approach: generate answer in English first, then translate to Slovak as a second LLM call? - Any prompt engineering tricks that worked for you for multilingual RAG output? -– ### Problem 4 – Reranker confidence threshold causes false abstentions The cross-encoder produces confidence scores around 0.04–0.07 for relevant Slovak/English pairs. My threshold is set to 0.15 (already lowered from original 0.32). At confidence below threshold, the system returns “not found in documents” even when the correct answer is there. I added a keyword override (check if query words appear in context docs) but it’s unreliable for cross-lingual queries because Slovak words don’t match English document text. ### Code *(pinning below)* - `document_processor.py` – PDF extraction + parent-child chunking: https://pastebin.com/m8egQ7HY - `vector_store.py` – FAISS + BM25 + E5Embeddings wrapper: https://pastebin.com/4kkhsg8M - `rag_graph.py` – full LangGraph pipeline: https://pastebin.com/P31pGiie - `parent_store.py` – https://pastebin.com/xwNeAMnE 1 post - 1 participant Read full topic