DaaS / Products / AIRec with Custom Models and Semantic Search

AIRec with Custom Models and Semantic Search

Train and serve custom embedding/ranking models on Alibaba Cloud Linux instances, deploy those embeddings into OpenSearch for vector-based semantic retrieval, then layer AIRec on top to orchestrate a full recommendation pipeline that leverages both custom model inference and semantic search for higher-quality personalized recommendations.

Products involved

Scenario

Use this integration when standard recommendation algorithms lack domain-specific context or semantic understanding. By training custom embedding and ranking models on Alibaba Cloud Linux (ALinux) instances, indexing vectors in OpenSearch, and orchestrating the pipeline through AIRec, you achieve highly personalized, context-aware recommendations that combine semantic recall with fine-tuned ranking.

Integration steps

  1. Deploy custom models on ALinux (alinux-deploy-model): Provision a GPU-enabled ECS instance and serve your PyTorch/ONNX model via FastAPI:
  2. ``bash aliyun ecs RunCommand --InstanceId i-uf6xxxx --CommandContent "pip install fastapi uvicorn torch && python serve_model.py --port 8080" ``

  3. Expose inference endpoint: Verify VPC connectivity to http://<alinux-vpc-ip>:8080/infer (embedding) and /rank (ranking).
  4. Configure OpenSearch vector index (opensearch-deploy-model): Create an index with dense_vector mapping matching your model’s output dimension:
  5. ``json PUT /airec_semantic_index { "mappings": { "properties": { "item_id": { "type": "keyword" }, "embedding": { "type": "dense_vector", "dims": 768, "index": true, "similarity": "cosine" } } } } ``

  6. Ingest embeddings: Batch-encode catalog items via the ALinux endpoint and push to OpenSearch:
  7. ``bash curl -X POST "http://<opensearch-host>:9200/airec_semantic_index/_bulk" -H "Content-Type: application/json" -d @batch_vectors.json ``

  8. Provision AIRec service (airec-deploy-service): Initialize the recommendation instance:
  9. ``bash aliyun airec CreateInstance --InstanceType standard --RegionId cn-hangzhou --Name "custom-semantic-rec" ``

  10. Wire data sources: In AIRec, configure OpenSearch as the semantic recall source and register the ALinux /rank endpoint as a custom ranking service via aliyun airec UpdateDataSource --InstanceId <id> --Config '{"recall":"opensearch","rank":"http://<alinux-ip>:8080/rank"}'.
  11. Orchestrate pipeline: Define the execution flow: SemanticRecall (OpenSearch) -> CustomRank (ALinux) -> DiversityFilter -> Serve. Validate with aliyun airec CreatePipeline --InstanceId <id> --Config pipeline_v1.json.

Architecture

Item metadata flows through the ALinux-hosted embedding model, generating vectors stored in OpenSearch. At query time, AIRec triggers semantic recall against OpenSearch, retrieves candidate items, and passes them to the ALinux ranking endpoint for personalized scoring. AIRec handles business logic, diversity filtering, and final response formatting, while ALinux and OpenSearch handle heavy ML inference and vector search respectively.

Prerequisites

Common pitfalls

Typical questions

FAQ

Q: How do I deploy a full-stack recommendation pipeline with custom models and semantic search? A: You can deploy this architecture by training and serving custom embedding or ranking models on Alibaba Cloud Linux instances, indexing those embeddings in OpenSearch for vector-based retrieval, and layering AIRec on top to orchestrate the complete recommendation pipeline. This cross-product combination integrates Airec, OpenSearch, and Alibaba Cloud Linux to deliver higher-quality personalized recommendations through unified custom model inference and semantic search.