The PAI-Rec engine is a Go-based framework for building online recommendation services. It provides a complete, configurable pipeline—from retrieval through filtering and sorting—so you can ship a production-ready recommendation service without building infrastructure from scratch, or extend it with custom logic when your use case requires it.
Overall architecture

System architecture and deployment

How it works
The PAI-Rec engine processes each recommendation request through a sequential pipeline:
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.
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.
Retrieve candidates — Predefined retrieval policies fetch a candidate set of items matching the request context.
Filter candidates — Filtering policies remove ineligible items from the candidate set.
Sort candidates — Sorting policies rank the filtered candidates. For model-based ranking, the engine calls EAS to run inference online.
Return results — The ranked list is returned via the RESTful API response.
The recommendation flow is fully described through configuration. Adjust retrieval sources, filtering rules, and sorting strategies without changing code. For logic outside the built-in policies, use the extension points to inject custom operations at any stage.
Overall flow of the recommendation service

Built-in features

The PAI-Rec engine ships with the following 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. |