Skip to main content

Function

The Generation Server is the core module in UltraRAG responsible for calling and deploying Large Language Models (LLMs). It receives input prompts (Prompts) constructed by the Prompt Server and generates corresponding output results. This module supports two modes: Text Generation and Image-Text Multi-modal Generation, flexibly adapting to different task scenarios (such as Q&A, reasoning, summarization, visual Q&A, etc.). The Generation Server is natively compatible with the following mainstream backends: vLLM, HuggingFace, and OpenAI.

Usage Examples

Text Generation

The following example shows how to use the Generation Server to execute a basic text generation task. The process calls the LLM to generate an answer after constructing the input prompt through the Prompt Server, and finally completes result extraction and evaluation.
examples/vanilla_llm.yaml
Run the following command to compile the Pipeline:
Modify parameters:
examples/parameters/vanilla_llm_parameter.yaml
Run Pipeline:

Multi-modal Inference

In multi-modal scenarios, the Generation Server can not only process text inputs but also combine visual information such as images to complete more complex reasoning tasks. The following example shows how to implement this. First, prepare an example dataset (including image paths):
data/test.jsonl
Before performing multi-modal generation, you need to add a new field multimodal_path in the get_data function of the Benchmark Server to specify the image input path.
Please refer to Add Dataset Loading Fields for how to add new fields.
examples/vanilla_vlm.yaml
Run the following command to compile the Pipeline:
Modify parameters:
examples/parameters/vanilla_vlm_parameter.yaml
Run:
Note: You can set image_tag such as <IMG> to specify the position where you wish the image input to be. If empty, it defaults to the leftmost input.

Deploy Model

UltraRAG is fully compatible with the OpenAI API interface specification, so any model that conforms to this interface standard can be directly accessed without additional adaptation or code modification. The following example shows how to use vLLM to deploy a local model. Step 1: Background Model Deployment Taking Qwen3-32B as an example, it is recommended to use multi-card parallelism to ensure inference speed. Screen (Run directly on host)
  1. Create session:
  1. Start command:
script/vllm_serve.sh
Seeing output similar to the following indicates that the model service has started successfully:
  1. Exit session: Press Ctrl + A + D to exit and keep the service running in the background. If you need to re-enter the session, execute:
Step 2: Modify Pipeline Parameters Modify parameters:
examples/parameters/vanilla_llm_parameter.yaml
After completing the configuration, you can run normally.