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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
有赞技术团队
有赞技术团队
H
Help Net Security
V
Visual Studio Blog
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
L
LangChain Blog
N
Netflix TechBlog - Medium
罗磊的独立博客
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements

LangChain Forum - Topics tagged python-help

Llama-server process has terminated: invalid argument --load-mode with Ollama client 0.32.6 and langchain-ollama 1.1.0 Langchain Certified Agent Engineer Exam - Exam link not received and no response Null-drift: A bare-metal O(1) Memory Store for continuous LangGraph agents Clarification needed: Assistant config vs context and graph initialization Proposal: a small local helper for readable run traces via PR Proxy Authentication Required 407 What is the right way to dynamically create and run a graph? Re-Implement claude code's dynamic workflow using langchian & deepagents How to define a correct state for multi-agent system Response Format Groq Model Pydantic I hope to get some recommendations for practical skills Interrupt does not work correctly in LangGraph The Qwen3.6b model in fireworks through initchatmodel reporting hugely inflated tokens For parallel execution in Node, should i use the functional API? Potential Enhancement: Django-Managed PostgresSaver Pre-interrupt() code re-runs on resume — anti-pattern, or is there a sanctioned way to detect resume? Interrupt parallel branch execution Best practices for self-hosting LangGraph Server OSS without LangGraph keys Dynamically Enabling/Disabling Graphs in a LangGraph Server at Runtime LangGraph thread copy can take 12+ minutes: recommended production pattern? Will DeltaChannel be the default for AgentState.messages, or expected to stay opt-in? Proposal: additional docs for implementing custom DB checkpointers or a guide on generic base checkpointer 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 Anyone confirms this issue that deepagent ui streaming is disturb by update in deepagent or bug issue Best Stack for Building AI Applications Seeking help regarding the connection between Websocket and tool calls
Help with local RAG pipeline – poor retrieval quality, wr...
IchNarA · 2026-04-20 · via LangChain Forum - Topics tagged python-help
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