Enterprises are increasingly adopting Large Language Models (LLMs) to enhance information access and automation, but direct usage of LLMs often introduces critical challenges such as hallucinated outputs, limited visibility into proprietary enterprise data, and security risks including data leakage and prompt injection.
Alibaba Cloud addresses these challenges through Qwen, a family of large language models optimized for natural language and multimodal understanding, which performs optimally when guided by structured instructions and accurate domain-specific context. To further improve reliability and relevance, Retrieval-Augmented Generation (RAG) is introduced as a core architectural approach, enabling LLMs to generate responses grounded in trusted enterprise knowledge without requiring frequent model retraining.
Retrieval Augmentation Generation (RAG) is an architecture that can augment the capabilities of AI models including large language models (LLMs) like Qwen. RAG adds an information retrieval system that provides the models with relevant contextual data, such as data of specific domains or an organization's internal knowledge base, without the need to re-train the model. RAG improves LLM output cost-effectively, making the results more relevant and accurate.
Key benefits of RAG:
Within this architecture, Dify plays a central role as the orchestration layer for RAG-based applications. As an open-source and visual LLM application development platform, Dify simplifies dataset ingestion, vector-based retrieval, prompt orchestration, and workflow management while abstracting underlying model complexity.
Dify is a popular open-source, visual platform for developing large language model (LLM) applications. It provides a full set of tools to create, orchestrate, and operate AI applications, including prompt engineering, context management, and a retrieval-augmented generation (RAG) engine.
In a RAG scenario, Dify acts as the orcehestration layer that handles:
By integrating Dify with Alibaba Cloud services such as Object Storage Service (OSS) for document storage and AnalyticDB or OpenSearch for vector databases, enterprises can efficiently manage private knowledge bases and deliver accurate, context-aware responses. This approach allows development teams to focus on business logic and application outcomes rather than low-level generative AI infrastructure.
To ensure enterprise-grade security, governance, and operational readiness, a security gateway is positioned between end users and the Dify application. The gateway enforces authentication and authorization, validates and filters user prompts, applies rate limiting and quota controls, and provides comprehensive logging and auditing capabilities.
This additional layer protects the RAG application from unauthorized access, prompt manipulation, and uncontrolled operational costs. Combined with Alibaba Cloud’s scalable infrastructure and high availability services, this secure RAG architecture enables organizations to deploy compliant, reliable, and production-ready AI applications that meet enterprise security, governance, and compliance requirements.
Directly exposing an LLM or RAG endpoint can lead to serious risks, including unauthorized access, prompt injection, and uncontrolled costs.
A security gateway acts as a protective layer that:
This ensure that the RAG application is production-ready and complaint with enterprise security requirements.
General RAG Workflow with Security Gateway by Installing Dify on Compute Nest Alibaba Cloud
1. Install Dify by Compute Nest
Compute Nest is a Platform as a Service (PaaS) solution Alibaba Cloud provides for service providers and their customers to manage services.
Log on to the Compute Nest console. On the Services Catalog page, search for and click Deploy Now.

2. Install LLM plugin for QWEN & input API keys
Access your user profile at the upper right, click Settings, then navigate to Model Provider to select public LLM plugins, we will choose TONGYI. If successful, all available LLM models on TONGYI will be shown.

3. Create Application on Dify by Workflow AI
To create an application using Dify's Workflow AI, you build a logic flow by dragging and dropping various components onto a canvas. The process involves defining the flow's purpose, adding necessary nodes (like LLM, Code, or Tools), connecting them, and then publishing the result.
Log in to Dify and Go to Studio: Sign in to your Dify account. In the main navigation menu, select the Studio option.
Create a New Application: In the application list, choose Create from Blank.

4. User request sends a query through a web or internal application testing.

5. Security Gateway Validation
-Gateway authenticates the user.
-Request is checked against security and content policies.
-Create agent instruction for checking the input query from user.

6. Retrieval Phase, relevant documents are retrieved from the vector database that already uploaded in knowledge based.
Upload your knowledge base, click Create Knowledge to import your knowledge base. You may upload files directly or sync them from Notion or your website.

LLM Generation, the LLM generates a response grounded in enterprise data.

7. Response Filtering, generated output is inspected and sanitized if needed.


8. Final Response, clean and secure response is returned to the user via the gateway.


A common enterprise use case is an internal knowledge assistant that helps employees search policies, SOPs, and technical documentation.
With RAG and a security gateway:
Combining RAG with a security gateway enables enterprises to unlock the power of GenAI while maintaining control, safety, and compliance. By using Dify on Alibaba Cloud, organizations can build scalable, secure, and production-ready RAG applications that turn internal knowledge into actionable insights.
2 posts | 0 followers
FollowAlibaba Cloud Indonesia - April 14, 2025
Alibaba Cloud Data Intelligence - June 20, 2024
Alibaba Cloud Data Intelligence - November 27, 2024
Alibaba Cloud Data Intelligence - December 27, 2024
Alibaba Cloud Community - July 3, 2025
Alibaba Cloud Native Community - November 20, 2025
2 posts | 0 followers
Follow
Tongyi Qianwen (Qwen)
Top-performance foundation models from Alibaba Cloud
Learn More
Alibaba Cloud for Generative AI
Accelerate innovation with generative AI to create new business success
Learn More
AI Acceleration Solution
Accelerate AI-driven business and AI model training and inference with Alibaba Cloud GPU technology
Learn More
Compute Nest
Cloud Engine for Enterprise Applications
Learn MoreMore Posts by Muhamad Miftah