External Knowledge Base Retrieval: A Practical Guide to Retrieval-Augmented Generation
This guide explains why built-in knowledge base retrieval often returns poor results in visual workflow platforms, and how to solve it by decoupling retrieval into an external service. It covers the core components and resource planning of a retrieval service, embedding and parsing model configuration, knowledge base construction, and a step-by-step tuning checklist for retrieval quality. It also shows how to integrate the service as a tool node in a workflow, plus production concerns such as permission isolation, incremental updates, observability, cost control, and fallback behavior. Readers will learn how to achieve traceable, measurable retrieval-augmented results in visual workflows.
1. Why Built-In Knowledge Base Retrieval Often Falls Short
When building question-answering applications on a visual workflow orchestration platform, a common complaint is that the built-in knowledge base returns unsatisfactory results. The answer clearly exists in the documents, yet the model responds vaguely or cites irrelevant passages. This is rarely caused by a single factor. Instead, it usually comes from several stages of the retrieval pipeline stacking up:
- Document parsing loses structural information, flattening tables, heading levels, and lists into text blocks with no semantics.
- The chunking strategy does not match business semantics, so a complete answer is split across two chunks.
- The embedding model lacks sufficient representation ability for the current language or industry terminology.
- Retrieval relies only on vector similarity and lacks exact matching at the keyword level.
- There is no reranking stage after recall, so the truly relevant fragments rank low within the Top-K results.
- Prompt constraints on the generation side are too weak, so the model tends to “fill in” with its own knowledge instead of strictly following the context.
A mature engineering practice is therefore to decouple retrieval from the orchestration platform and assign it to an independently deployed retrieval service, leaving the platform responsible only for conversation management, prompt assembly, and final generation. This article discusses exactly this kind of “external knowledge base + retrieval augmentation” integration.
2. Components and Resource Planning for an External Retrieval Service
A complete retrieval-augmented service typically relies on several foundational components working together. Understanding each component’s responsibility is the prerequisite for later tuning:
- Full-text search engine: handles inverted indexing and keyword matching, forming the basis of exact recall.
- Object storage: stores original uploaded files and intermediate parsing artifacts, enabling two-way traceability between source documents and chunks.
- Relational database: stores knowledge base metadata, parsing task status, and user and permission information.
- Cache service: relieves pressure from hot queries and task queues.
- Visual management console: provides operational interfaces for knowledge base creation, document parsing monitoring, and retrieval testing.
- The retrieval service itself: exposes interfaces for external applications to call.
A few deployment practices are worth noting. First, mount separate data volumes for the search engine and object storage so that rebuilding a container does not lose indexes and original files. Second, the service usually exposes three types of ports: two for the management console and its encrypted access, and one dedicated to programmatic API calls. During integration, only the API port matters, but make sure the port mappings at the container orchestration layer, security group rules, and reverse proxy configuration are consistent. Otherwise, a common failure is that the console opens fine while API calls time out. Third, estimate resources by document scale rather than document count. Vector dimensions, total chunk count, and replica count together determine memory usage, and when chunks reach the millions, cluster deployment should be the first consideration.
3. Model Configuration and Knowledge Base Construction
After connecting the retrieval service, the first step is to configure two types of models: an embedding model that converts text into vectors, and a chat model that handles final reasoning. The configuration logic is similar to adding a model in the orchestration platform: you fill in the service address, key, and model identifier. The principle here is that once an embedding model is chosen and vectorization is complete on a knowledge base, it should not be swapped midway. Otherwise, historical vectors and new vectors no longer live in the same semantic space, and retrieval quality drops significantly.
Two choices are critical when creating a knowledge base:
- Embedding model: prefer a model that matches the business language and domain terminology, and keep its dimensions consistent with the later retrieval parameters.
- Parsing method: general parsing suits most structured text; if documents are mainly tables, scanned copies, or question-answer pairs, choose the corresponding specialized parsing strategy. The parsing method directly determines chunk quality and is the first gate for retrieval accuracy.
After documents are uploaded, parsing and vectorization tasks need to be triggered. This process is asynchronous, so it is better to observe task status in the console rather than wait synchronously. A more robust engineering approach is to preserve the four-level traceable relationship of “original file - parsing result - chunk - vector”, which makes it easy to locate problematic chunks and rebuild incrementally instead of rebuilding the full index every time.
4. Tuning Retrieval Quality
When retrieval results are poor, troubleshoot in the following order, which usually yields the greatest benefit:
- Inspect the parsing output first. Read a few chunks manually and judge whether they are semantically complete and free of header and footer noise.
- Adjust chunk granularity. Chunks that are too large introduce noise, while chunks that are too small lose context; try overlapping chunks to keep semantics continuous across boundaries.
- Use hybrid retrieval. Run vector recall and keyword recall in parallel, and merge results with fusion ranking to balance semantic similarity and exact terminology matching.
- Introduce reranking. Enable it if a reranking model is already deployed, since it moves the truly relevant fragments to the top; if that capability is unavailable, simply leave it off by default rather than forcing a configuration.
- Adjust the recall count and similarity threshold. Too many candidates dilute the context, while too few may miss key fragments; usually start from a smaller candidate set and increase gradually.
- Strengthen constraints on the generation side. Explicitly require the model to answer only from the retrieved fragments and to state clearly when no supporting evidence exists, which effectively suppresses hallucination.
5. Integrating with the Orchestration Platform
The core of integration is to wrap the external retrieval service as a tool node that the workflow can call. The overall flow is: user input → intent recognition and query rewriting → call the external retrieval API → obtain candidate fragments → rerank and trim → assemble the prompt → model generation → return with citations.
Three things need to be done on the orchestration side: configure the tool node’s service address and authentication information; define inputs (query text, knowledge base identifier, number of results, similarity threshold) and outputs (fragment text, source document, score); and reference the previous step’s output variables in the prompt template. A sample request structure looks like this:
{"question": "query text","dataset_ids": ["knowledge base identifier"],"page_size": 6,"similarity_threshold": 0.35}
The response generally contains fragment content and metadata. The source file name and page number in the metadata can be used by the frontend to display citation sources, which is very important for building trust in enterprise scenarios.
During debugging, first validate recall separately using the retrieval service’s built-in comparison interface, then connect it to the workflow. This makes it clear whether the problem lies on the retrieval side or the generation side. A common source of confusion in practice is that the same question produces differently worded answers in two systems. This mostly stems from differences in the generation model, temperature parameters, and prompt templates rather than incorrect retrieval results, so there is no need to dwell on it.
6. Production Considerations
- Permission isolation: divide knowledge bases by business line, and bind API authentication to the caller’s identity to prevent unauthorized retrieval.
- Incremental updates: route document changes through incremental parsing and index rebuilding, and maintain version records.
- Observability: set up monitoring and alerts for retrieval latency, recall score distribution, and empty recall rate.
- Cost control: cache high-frequency query results and limit candidate fragment length to reduce context overhead.
- Fallback strategy: when the retrieval service is unavailable, the workflow should return a clear message instead of letting the model generate freely.
7. Summary
Externalizing retrieval is a cost-effective path to improving the accuracy of question-answering applications. The retrieval service handles parsing, indexing, hybrid recall, and reranking, while the orchestration platform handles the conversation flow and generation constraints, with the two decoupled through a standard interface. Three keys matter in practice: the parsing method must match the document format, the embedding model should not be changed once chosen, and the generation side must strictly enforce “answer based on context”. Following this approach, you can reliably achieve traceable and measurable retrieval-augmented results in a visual workflow.
