Engine architecture overview

Updated at:

The PAI-Rec engine is a Go-based framework for building online recommendation services. It provides a configurable pipeline—from retrieval through filtering and sorting—that lets you launch a production-ready service without building infrastructure from scratch, or extend it with custom logic as needed.

Overall architecture

架构图

System architecture and deployment

无标题-2025-11-03-1642

How it works

The PAI-Rec engine processes each recommendation request through a sequential pipeline:

  1. Receive the request — The built-in Go HTTP server accepts incoming requests on registered routes, eliminating the need to wire up a separate REST server.

  2. Load features — The engine fetches user and item features from one or more configured data sources: FeatureDB, Hologres, Redis, Tablestore, or DataHub/Kafka. FeatureStore coordinates feature management and keeps data consistent across sources.

  3. Retrieve candidates — Predefined retrieval policies fetch a candidate set of items matching the request context.

  4. Filter candidates — Filtering policies remove ineligible items from the candidate set.

  5. Sort candidates — Sorting policies rank the filtered candidates. For model-based ranking, the engine calls EAS to run inference online.

  6. Return results — The ranked list is returned via the RESTful API response.

The entire recommendation flow is defined in configuration. You can adjust retrieval sources, filtering rules, and sorting strategies without changing code. For logic outside the built-in policies, use extension points to inject custom operations at any stage.

Overall flow of the recommendation service

5967AD78-2A82-47E9-AFF0-C4B6B4AF8E55

Built-in features

6B6D0F87-EDAD-464B-8420-BED758F11B10

The PAI-Rec engine includes the following built-in capabilities:

Capability Description
Go HTTP server Handles incoming requests with built-in route registration. No separate web framework needed.
Recommendation pipeline End-to-end pipeline with predefined retrieval, filtering, and sorting policies.
EAS integration Built-in access to EAS for online model inference during the sorting stage.
Multi-source data loading Loads features from FeatureDB, Hologres, Redis, Tablestore, and DataHub/Kafka in a single pipeline run.
FeatureStore support Improves feature management and ensures data consistency across sources.
Configuration-driven flow Defines the full recommendation flow in configuration files—no code changes required for pipeline adjustments.
Lightweight A/B testing Built-in platform for traffic splitting and experiment management.
Extension points Hooks at each pipeline stage for custom retrieval, filtering, or sorting logic.

Key concepts

Term Description
Pipeline The ordered sequence of stages (retrieval → filtering → sorting) that transforms a request into a ranked result list.
Retrieval The stage that fetches a candidate item set from configured data sources based on the request context.
Filtering The stage that removes ineligible candidates before scoring.
Sorting The stage that ranks filtered candidates, optionally using EAS for model-based scoring.
EAS (Elastic Algorithm Service) The Alibaba Cloud service that hosts and serves ML models online. PAI-Rec calls EAS during the sorting stage for real-time inference.
FeatureStore The feature management layer that coordinates feature reads across multiple data sources and enforces data consistency.
Extension points Named hooks in the pipeline where you can register custom logic without modifying the core framework.
A/B testing platform The built-in experiment layer that splits traffic across pipeline configurations and measures impact per variant.