# RAG Pipeline for industries

**URL:** <https://forum.langchain.com/t/rag-pipeline-for-industries/4718>\
**Category:** Talking Shop\
**Tags:** self-hosted, python-help\
**Created:** [October 9, 2026, 12:35pm UTC](https://forum.langchain.com/t/rag-pipeline-for-industries/4718 "2026-10-09T12:35:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dip\_gohil](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/dip_gohil/32/3673_2.png) [@dip\_gohil](https://forum.langchain.com/u/dip_gohil)\
**Post date:** [October 9, 2026, 12:35pm UTC](https://forum.langchain.com/t/rag-pipeline-for-industries/4718/1 "2026-10-09T12:35:40Z")

</div>

Everyone knows that when we discuss about any AI services or solutions there’s always a word comes which is RAG.  
But issue is not how we implement it or how we build it, the main issue is by which architecture you’ll build it.

That’s where I got stuck. If you guys any idea about which is industrial standard to build RAG precisely then it would help me to learn something interesting for me instead of just below normal pipeline:

query → understanding → rewriting → convo context → text ingestion → vector store → chunking → retrieval → top-K → reranking → generation

Tech Stack:  
PostgreSQL + ChromaDB with Docker workers. (any other tech stack suggestions are acceptable)

Providers:  
OpenAI, Mistral, Gemini

Additionally, I’m using additional helpers like caching, latency control, etc.

Is there any other way or inclusion in pipeline which I can implement to run my chatbot even better than this with respect to Accuracy & Response Time.

It would help a lot if you give any solution or suggestion to improve my chatbot’s accuracy without suffering response time.

---

<div class="post-metadata">

**Author:** ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)\
**Post date:** [October 9, 2026, 6:47pm UTC](https://forum.langchain.com/t/rag-pipeline-for-industries/4718/2 "2026-10-09T18:47:48Z")

</div>

Hello @dip_gohil ,

Welcome to langchain community.

There’s no single industry-standard RAG architecture. It depends on your data and your queries, so the most reliable approach I’ve found is to measure rather than guess.

**How I do it**

I start with a golden dataset: 50-100 questions (real user queries if you have them, synthetic ones if not), each with a hand-checked reference answer and the source passage it comes from. Then I experiment with the following parameters:

- Chunk size and chunk overlap
- Top-k at retrieval time
- Similarity metric
- Vector database. Weaviate has been the best fit in most of my production-like tests, mainly for its native hybrid search and filtering. Since you’re already on Postgres, pgvector is also worth including in the comparison.

I score each run on cost per trace, response speed, and accuracy. For accuracy, an LLM judge compares each answer with the reference and assigns a 1 or a 0. I then pick the configuration with the highest accuracy that stays within my latency and cost limits. There’s no golden formula; you iterate until the numbers settle.

**Things I’d try on your pipeline**

- Your chain mixes indexing steps (ingestion, chunking, vector store) with query-time steps. Keep them as two separate paths and do the heavy enrichment (chunk summaries, metadata) at index time, where latency doesn’t matter.
- Use hybrid retrieval (dense plus keyword) instead of vector-only.
- Retrieve wide and rerank narrow, for example top 30 down to 5. The smaller prompt also speeds up generation.
- Make query rewriting conditional (skip it for self-contained questions), run it on a small fast model, and merge it with query understanding into one call.
- Evaluate retrieval separately from generation (hit rate, MRR). It needs no LLM calls and shows which stage is failing. Trace each stage so you know where the latency actually goes.
- Stream the final answer so users see the first tokens sooner.

If you share what your documents and typical queries look like, I can be more specific.

---

<div class="post-metadata">

**Author:** ![dip\_gohil](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/dip_gohil/32/3673_2.png) [@dip\_gohil](https://forum.langchain.com/u/dip_gohil)\
**Post date:** [October 12, 2026, 5:36am UTC](https://forum.langchain.com/t/rag-pipeline-for-industries/4718/3 "2026-10-12T05:36:22Z")

</div>

Thanks for the detailed reply, @keenborder786 ! My first post simplified things too much, so here’s the real setup.

**Data:** Mostly crawled websites, many of them e-commerce: product pages with prices, spec tables and model numbers. There are also uploaded PDFs, DOCX and XLSX files.  
The content is multilingual and multi-tenant, with one Chroma collection per project.

**Typical queries:** Spec lookups, product comparisons, filters (“cheapest under 500 €”), exact model codes or SKUs, and follow-ups like “what about the other one?”

**What I already have:**

- Indexing runs separately in background workers. Chunks are table-aware, and each one gets a title/breadcrumb header plus LLM-written context for long documents.
- Hybrid retrieval: Chroma vectors plus Postgres full-text search, combined with Reciprocal Rank Fusion.
- Top 30 results reranked down to 5 with `bge-reranker-base`. The reranker is skipped when the top result is clearly ahead.
- Query rewriting runs only for unclear follow-ups.
- Streaming answers, caching, and a check that prices and numbers in the answer actually appear in the sources.

**Where I need help:**

1. **Evaluation:** I don’t have a golden dataset yet. With many tenants, would you build one set per tenant or one shared set?
2. **Failures:** [e.g., comparisons retrieve only one product, values in large tables get missed]
3. **Latency:** p50 is about [X] s and p95 about [Y] s. The slowest stage is [e.g., the rewrite call or Chroma on large tenants].
4. **Vector DB:** Since keyword search is already in Postgres, would you move to pgvector, or to Weaviate/Qdrant?

Happy to share traces if that helps. Thanks!

---

<div class="post-metadata">

**Author:** ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)\
**Post date:** [October 12, 2026, 9:55am UTC](https://forum.langchain.com/t/rag-pipeline-for-industries/4718/4 "2026-10-12T09:55:08Z")

</div>

Thanks for the details, @dip_gohil, that helps a lot. Taking your four questions in order:

**1. Evaluation: per-tenant or shared golden set?**  
Start with one shared set, kept as a single table (question, reference answer, source passage), to avoid over-complicating things. Add `tenant`, `language` and `query_type` columns (spec lookup, comparison, price filter, exact SKU, follow-up) so you can slice the scores instead of maintaining separate sets. Only split out a per-tenant set if one tenant’s slice shows problems the shared set doesn’t catch. Include a few follow-ups like “what about the other one?”.

**2. Failures**  
Mark every failure explicitly. In LangSmith I use an [online LLM-as-judge evaluator](https://docs.langchain.com/langsmith/online-evaluations-llm-as-judge) on the tracing project to flag failing answers. You can limit it to certain runs (for example by `tenant` metadata) and set a sampling rate such as 10% to control judge cost. Evaluated traces move to extended retention, which affects trace pricing. Then filter for the failed traces and open each one to see which stage broke: retrieval, reranking or generation. Add each failure back to the golden set so it becomes a regression test. For follow-ups, there are also multi-turn evaluators that score a whole conversation.

**3. Latency**  
I use LangSmith tracing for this. Make each stage (rewrite, retrieve, rerank, generate) its own span, e.g. with `@traceable`, so every trace shows where the time went. Then set a [latency alert](https://docs.langchain.com/langsmith/alerts) on the project. The preview shows how often a threshold would have fired on past data, and notifications can go to Slack, PagerDuty or a webhook. The metric is the average over a 5- or 15-minute window, so it catches regressions but not single slow requests (check your slowest traces for p95). You can also scope an alert by tag or run type to watch one stage, such as the rewrite call.

**4. Vector DB**  
In my production-like tests Weaviate has been the best fit, mainly for native hybrid search and filtering, but I’d test rather than assume. Run the same golden set through (a) your current Chroma + Postgres FTS + RRF, (b) pgvector + Postgres FTS in one database, and (c) Weaviate hybrid. Compare hit rate, p95 latency, how each handles many small tenants vs a few large ones, and how much you have to operate. Include your filtered queries (price limits, tenant filters), since filtered search is often where engines differ most.

Weaviate’s [hybrid search](https://docs.weaviate.io/weaviate/search/hybrid) has knobs that fit your query types: `alpha` to weight keyword vs vector (set it explicitly), relative-score or ranked fusion, per-property boosts for SKUs and model codes, and filters for price limits:

```python
from weaviate.classes.query import Filter

products = client.collections.use("Products")
response = products.query.hybrid(
    query="XR-7 spec sheet",
    alpha=0.5,
    query_properties=["title^3", "sku^3", "description"],
    filters=Filter.by_property("price").less_than(500),
    limit=30,
)

```

Also check how your SKU fields are tokenized. By default, `Test_domain_weaviate` becomes three separate tokens.

One request: the failure examples and the p50/p95 numbers in your post still show placeholders ([X], [Y]). If you can share the real figures or a couple of traces, I can be more specific.

Sources: [RAG Pipeline for industries](https://forum.langchain.com/t/rag-pipeline-for-industries/4718), [LLM-as-a-judge online evaluators](https://docs.langchain.com/langsmith/online-evaluations-llm-as-judge), [Alerts in LangSmith](https://docs.langchain.com/langsmith/alerts), [Weaviate hybrid search](https://docs.weaviate.io/weaviate/search/hybrid)

---

<div class="post-metadata">

**Author:** ![dip\_gohil](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/dip_gohil/32/3673_2.png) [@dip\_gohil](https://forum.langchain.com/u/dip_gohil)\
**Post date:** [October 12, 2026, 10:17am UTC](https://forum.langchain.com/t/rag-pipeline-for-industries/4718/5 "2026-10-12T10:17:20Z")

</div>

Thanks @keenborder786 ! Real numbers from the last 14 days (total time per request):

- **Chat:** p50 about 3.3 s, p95 about 13.8 s (6.3k requests)
- **Search:** p50 about 4.9 s, p95 about 12.8 s

The p95 is about 4x the p50, so a few stages clearly stall at times. I don’t have time per stage yet, so I’m adding a span for each stage next. I also don’t have labelled failures yet. I’ll set up the golden set and online judge as you suggested, then come back with traces.

Thanks again!

---

<div class="post-metadata">

**Author:** ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)\
**Post date:** [October 12, 2026, 10:21am UTC](https://forum.langchain.com/t/rag-pipeline-for-industries/4718/6 "2026-10-12T10:21:47Z")

</div>

Sure, will be waiting.
