Tongyi Qianwen AI full-scenario application solution
🛒 Tongyi Qianwen's full-scenario application solution for developers and enterprise users is based on the latest Qwen3.5 series models, covering API integration, code assistance, multi-modal understanding, enterprise knowledge base construction, model fine-tuning and privatized deployment, maximizing the use of Qianwen's open source ecosystem and Alibaba Cloud infrastructure.
Tongyi Qianwen AI full-scenario application solution
Solution overview
This solution is oriented to software R&D teams and enterprise AI application development scenarios. It uses Alibaba Cloud Tongyi Qianwen (Tongyi Qianwen) series models as the core engine to provide an end-to-end application workflow covering six major links: API integration, code assistance, multi-modal understanding, enterprise knowledge base construction, model fine-tuning, and privatized deployment.
Tongyi Qianwen is a large language model series independently developed by Alibaba Cloud. From Qwen to Qwen3.5, Qwen3.5-Coder, Qwen3.5-VL and other branch models, it has formed a complete ecosystem covering dialogue, code, vision, voice, and agent frameworks. As the latest version of Tongyi Qianwen, Qwen3.5 has significantly improved its reasoning capabilities, code generation, multi-modal understanding and long context processing compared to Qwen3, and supports 256K+ token context windows. With Alibaba Cloud Bailian Platform and Model Studio, developers can choose online API calls, local deployment of open source models, or full parameter fine-tuning as needed, reducing engineering costs from prototype to launch.
Target users: Software development engineers, AI application developers, technical leaders, data scientists, enterprise IT architects.
Prerequisites:
- Have basic REST API calling and Python development experience
- Have an Alibaba Cloud account (for API and Bailian platform) or Hugging Face / ModelScope access (for open source models)
- Business data sets required for target scenarios (fine-tuning, knowledge base scenarios)
Estimated total project time: It will be implemented in phases, 2-5 days for a single scenario, and about 2-6 weeks for the entire scenario.
Toolchain list
| Tools | Purpose | Required Account Level | Estimated Cost | Alternatives |
|---|---|---|---|---|
| Tongyi Qianwen | Dialogue, content generation, code assistance (Web/App) | Free | Free | |
| Qwen | Tongyi Qianwen Open Source Model (HuggingFace/ModelScope) | Open Source Free | Free (You need to bring your own computing power) | DeepSeek Open Source Model |
| Qwen3.5-Coder (Qwen series) | AI code generation and completion (based on the latest Qwen3.5 code model) | Open source and free | Free | 豆包 Doubao/DeepSeek-Coder |
| Qwen-Agent (Qwen series) | Agent framework and tool calling | Open source and free | Free | LangChain / None |
| Alibaba Cloud Bailian Platform | Model API, knowledge base, Agent construction | Alibaba Cloud real-name authentication | Pay-as-you-go billing | None |
| 豆包 Doubao | Dialogue, translation, summary (compared to competing products) | Free | Free | Kimi |
| DeepSeek | Reasoning, mathematics, programming (open source benchmarking) | Free / API by volume | Free to start | Qwen open source model |
| Long document analysis, code audit (auxiliary) | Free / Pro $20/month | On-demand |
Preparation
Before officially starting the implementation of the plan, please complete the following preparations:
Account and environment preparation
- [ ] Register an Alibaba Cloud account and complete real-name authentication
- [ ] Open Bailian platform (
https://bailian.console.aliyun.com/) and create API Key - [ ] (Open source path) Register Hugging Face / ModelScope account and obtain Access Token
- [ ] (deployment path) Prepare GPU server or Alibaba Cloud ECS/PAI instance
- [ ] Install Python 3.10+ and
dashscopeSDK:pip install dashscope
Data and material preparation
- [ ] Organize internal documents (PDF, Markdown, Word) required for knowledge base construction
- [ ] Prepare fine-tuning corpus data set (JSONL format)
- [ ] Determine the image/video samples that need to be processed (multimodal scenes)
Team Aligned with Goals
- [ ] Clarify the person responsible for each scenario
- [ ] Set acceptance indicators (such as API response time, code completion accuracy, RAG search hit rate)
- [ ] Confirm data compliance requirements and deployment environment security policies
Step-by-step guide
Step 1: Model selection and API integration
⏱ Estimated time: 1 day 🎯 Goal: Determine the appropriate Qwen model and complete API access ⚠️ Prerequisite: Alibaba Cloud account is ready
Operation instructions
Tongyi Qianwen provides multiple model routes, and you can choose the appropriate model version according to the complexity of the task. The Qwen3.5 series supports 256K+ contexts, Qwen3.5-Coder focuses on code scenarios, and Qwen3.5-VL supports multi-modal input.
Specific operations
-
Model route selection:
- Universal dialogue/content generation → Qwen3.5/Qwen3.5-Plus/Qwen3.5-Max
- Code completion/generation → Qwen3.5-Coder / Qwen3.5-Coder-Flash
- Multimodal understanding (picture/video) → Qwen3.5-VL / Qwen3.5-Omni
- Voice interaction → Qwen3.5-TTS / Qwen3.5-ASR
- Agent/tool call → Qwen3.5 + Qwen-Agent framework
-
API integration (taking Python as an example):
from dashscope import Generation response = Generation.call( model='qwen3.5-plus', messages=[{'role': 'user', 'content': 'Explain what microservice architecture is'}], api_key='your-api-key' ) print(response.output.text) -
API Management:
- Apply for API Key on Bailian platform and set usage limit
- Select service area (domestic station or international station)
- Monitor request volume and response latency
-
Cost estimate: Qwen3.5-Plus inputs ¥0.005/1K tokens and outputs ¥0.02/1K tokens; Qwen3.5-Max inputs ¥0.04/1K tokens and outputs ¥0.12/1K tokens (the price is subject to the real-time quotation of Bailian platform).
Verification method
Complete API calls and return valid responses with end-to-end latency < 3s (normal model) or as per business requirements.
Step 2: Code development scenario integration
⏱ Estimated time: 1-2 days 🎯 Goal: Integrate Qwen models into IDE and CI/CD processes ⚠️ Precondition: API access completed
Operation instructions
Qwen3.5-Coder is a code-oriented full-scenario model. Based on Qwen3-Coder, it further strengthens cross-file reconstruction, long-context code analysis, and Agent tool calling capabilities. With the custom Agent of Bailian platform, it can be embedded into Git workflow.
Specific operations
-
Code completion within IDE:
- Access Qwen code capabilities through Bailian Platform or Alibaba Cloud Comate
- Configure a custom prompt to align the completion style with team coding standards
-
Code Review Agent:
- Create an Agent on the Bailian platform and configure the input as Git to submit differences.
- Set prompt:
Please review the following code changes and mark potential bugs, security holes and style deviations. Output format: one finding per line, number + file: line number + level + suggestion - Connect to GitLab/GitHub through Webhook, MR triggers automatic review
-
Unit test generation:
- Use Qwen3.5-Coder API to generate pytest/unittest test cases for specified functions
- Manual sampling and integration with CI pipeline
-
Commit Message automatically generated:
- Pass
git diffinto the model and output structured commit instructions
- Pass
Expert point of view
Code scenarios are the first link where the development team can demonstrate AI ROI. Qwen3.5-Coder belongs to the first echelon in the current code model, and is open source and can be privatized. It is suitable for financial, government affairs and other scenarios that are sensitive to code data security. Compared with Claude or DeepSeek, Qianwen's advantage lies in its deep integration of Chinese annotation/document understanding and Alibaba Cloud ecological tools.
Verification method
- Completion scenario: 50 completion results are randomly selected, and the semantic accuracy of manual judgment is ≥ 80%
- Review Agent: Compared with manual review results, the discovery rate is ≥ 60%
Step 3: Multi-modal understanding application construction
⏱ Estimated time: 1-2 days 🎯 Goal: Build image/video understanding, image and text retrieval, OCR and other applications ⚠️ Precondition: API access completed
Operation instructions
The Qwen3.5-VL series supports multi-modal input (pictures + text) and can be used in scenarios such as document parsing, chart understanding, and product image analysis. Qwen3.5-VL performs better than Qwen3-VL in multi-language text recognition, chart data extraction and high-resolution image understanding. Qwen3.5-Omni further integrates voice input and output capabilities.
Specific operations
-
Document-level OCR and interpretation:
from dashscope import MultiModalConversation response = MultiModalConversation.call( model='qwen3.5-vl-plus', messages=[{ 'role': 'user', 'content': [ {'image': 'https://example.com/invoice.jpg'}, {'text': 'Please extract the amount, date and invoice number in this invoice'} ] }] ) -
Charts and UI understanding:
- Input product prototype diagrams or data analysis charts, and let the model output structured description or corresponding front-end code
- Typical scenario: Design draft → Tailwind CSS / HTML fragment
-
Video understanding (key frame analysis):
- Extract 1 frame of key picture every second and transmit it to Qwen3.5-VL
- Cooperate with prompt to realize surveillance video anomaly detection, live content review, etc.
-
Multimodal RAG:
- Embed images into vector libraries and combine them with Qwen3.5-VL’s image and text understanding capabilities to achieve “image search + interpretation” integration
Verification method
- OCR accuracy ≥ 95% (sampling 100 fields)
- Accuracy rate of multiple rounds of graphic dialogue ≥ 85%
Step 4: Enterprise knowledge base construction
⏱ Estimated time: 2-3 days 🎯 Goal: Build a RAG knowledge base based on internal documents to implement question and answer retrieval ⚠️ Precondition: Document data has been sorted
Operation instructions
Use the knowledge base function of Alibaba Cloud Bailian platform (based on Qwen's Embedding model + BGE series) or self-built vector database to build a searchable enterprise knowledge base.
Specific operations
-
Data preprocessing:
- Clean PDF/Word/HTML documents and use Qwen3.5-VL to extract text descriptions in charts
- Chunk: Each chunk is about 512 tokens to maintain paragraph integrity
-
Vectorization and Storage:
- Use
qwen3.5-embeddingmodel to generate 1024-dimensional vectors - Store in Bailian knowledge base or build your own Milvus/Elasticsearch
- Use
-
Retrieval Enhanced Generation (RAG) link construction:
from dashscope import TextEmbedding, Generation # Check Embedding emb = TextEmbedding.call(model='qwen3.5-embedding', texts=[query]) # Retrieve top-5 chunks (vector similarity) # Assembly prompt prompt = f"Answer the question based on the following information:\n\n{context}\n\nQuestion:{query}" result = Generation.call(model='qwen3.5-plus', messages=[{'role':'user','content':prompt}]) -
Effect Tuning:
- Adjust chunk size and overlap rate
- Added HyDE (hypothetical document embedding) to improve retrieval accuracy
- Configure rough sorting + fine sorting pipeline
Expert point of view
The enterprise knowledge base is one of the highest value scenarios of Tongyi Qianwen within the enterprise. Compared with the long context mode of directly using ChatGPT or Kimi, the advantages of the RAG architecture are that it is auditable (each answer can be traced to a specific document), updateable (no need to retrain), and controllable permissions (filtering the search scope according to user roles). Tongyi Qianwen's Embedding model has native advantages in mixed Chinese and code scenarios.
Verification method
- Retrieval hit rate (Recall@5) ≥ 85%
- Answer accuracy rate is manually checked ≥ 80%
Step 5: Model fine-tuning and effect optimization
⏱ Estimated time: 3-5 days 🎯 Goal: Adapt the model to specific business scenarios through SFT/QLoRA ⚠️ Prerequisites: GPU resources or PAI instances are ready
Operation instructions
Qwen open source model supports full parameter fine-tuning, LoRA, and QLoRA. You can use preset training scripts on the Alibaba Cloud PAI platform, or you can execute them locally or on ModelScope.
Specific operations
-
Dataset preparation:
- Format: JSONL, each message contains
{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]} - Recommended data volume: at least 500-2000 for SFT, as low as 100 for LoRA
- Quality access control: manual annotation + automatic deduplication + format verification
- Format: JSONL, each message contains
-
Training environment configuration:
- Open source path: use ModelScope or HuggingFace
transformers+peft+deepspeed - Alibaba Cloud PAI: Use preset Qwen to fine-tune workflow
- GPU requirements: QLoRA requires more than 24GB of video memory (such as RTX 4090 / A10)
- Open source path: use ModelScope or HuggingFace
-
Execute training:
# Use ModelScope to fine-tune the script python train.py \ --model_name qwen/Qwen3.5-7B \ --dataset_path ./my_dataset.jsonl \ --output_dir ./qwen3.5-7b-finetuned \ --lora_rank 8 \ --num_train_epochs 3 \ --per_device_train_batch_size 4 -
Effectiveness Evaluation:
- Calculate Loss and BLEU/Rouge metrics on the validation set
- Manually rate 50 generated results (1-5 points)
- A/B testing with baseline model (before fine-tuning)
Expert point of view
Fine-tuning is not a panacea. If the task is just format conversion or label classification, prompt engineering can solve it. The best scenarios for fine-tuning are when the output format is fixed (such as JSON schema), the domain terminology and tone (such as medical reporting), and when a significant improvement in accuracy is required for a specific task (such as SQL generation). Prioritize the use of QLoRA to reduce costs, and then expand to full parameter fine-tuning after confirming ROI.
Compared with open source models such as DeepSeek, Qwen's fine-tuning ecosystem (ModelScope + PAI) is more friendly to domestic developers and has richer documentation and community cases.
Verification method
- After fine-tuning, the model’s performance on the test set improved by ≥ 15%
- Average manual rating ≥ 4.0/5.0
Step 6: Privatized deployment and production launch
⏱ Estimated time: 2-3 days 🎯 Goal: Deploy the model to your own or Alibaba Cloud infrastructure to ensure SLA ⚠️ Preconditions: Fine-tuning is completed or the basic model version is determined
Operation instructions
For enterprises whose data does not go out of the domain, they can choose to deploy the Qwen model privately. Alibaba Cloud provides ECS + vLLM/TGI solutions, or uses the private deployment service of Bailian Platform.
Specific operations
-
Deployment plan selection:
- Lightweight: Single card deployment Qwen3.5-7B (vLLM), suitable for R&D testing
- High concurrency: multi-card deployment Qwen3.5-72B (vLLM + tensor parallel), suitable for production environments
- Fully managed: private deployment using Bailian platform, Alibaba Cloud is responsible for operation and maintenance
-
vLLM deployment example:
# Start vLLM service python -m vllm.entrypoints.openai.api_server \ --model /path/to/qwen3.5-7b-finetuned \ --tensor-parallel-size 1 \ --gpu-memory-utilization 0.9 \ --port 8000 -
Production environment configuration:
- Configure the environment variable
DASHSCOPE_API_KEY(Bailian API) or use your own inference endpoint - Set request current limit and circuit breaker (such as 100 QPS upper limit)
- Access monitoring alarm (Alibaba Cloud CloudMonitor / Prometheus)
- Configure the environment variable
-
Stability Guarantee:
- Model hot loading (supports version switching)
- Multi-region deployment for disaster recovery
- Request log audit
Expert point of view
The main threshold for privatized deployment is GPU computing power rather than the project itself. The 72B model requires 4×A100-80G to run smoothly. If the business volume is not large (average daily < 100,000 requests), it is recommended to use the exclusive instance of Bailian platform first to avoid the burden of operation and maintenance. Only when the request volume reaches millions per day, self-built inference clusters will have economic advantages.
Verification method
- Production environment model response P95 delay < 5s
- No downtime for 7 consecutive days
- All API compatibility tests passed after deployment
Expected results
| Indicators | Before optimization (without AI assistance) | After optimization (Qwen plan) |
|---|---|---|
| Code writing efficiency | Baseline | Improvement by 30-50% (completion + test generation) |
| Code review cycle | Baseline | 40-60% reduction (AI initial review + manual review) |
| Knowledge retrieval efficiency | Manual document review | Second-level search + traceability answer |
| Multi-modal processing (OCR/charts) | Manual entry/analysis | Automation rate ≥ 80% |
| Model iteration cost | Full retraining | LoRA fine-tuning reduces computing power cost by 90% |
Acceptance criteria
- [ ] Complete end-to-end runthrough of at least 3 scenarios
- [ ] The verification indicators of each scenario meet the passing standards defined in the step
- [ ] SLA for API calls or privatized services ≥ 99.5%
- [ ] Output documents and operation manuals for new members to reproduce step by step
- [ ] Data compliance approval has been passed, and there is no risk of data going out of the domain.
Frequently Asked Questions and Troubleshooting
Q: What is the relationship between Tongyi Qianwen and Bailian Platform? A: Tongyi Qianwen is a model brand that includes the full range of Qwen models. Bailian Platform is Alibaba Cloud's large model service platform, providing capabilities such as model API, knowledge base, Agent construction, model fine-tuning, and privatized deployment. Using the Bailian platform, you can complete all aspects of this program in one stop.
Q: How to choose between Qwen open source model and Bailian API? A: If the business requires that the data does not leave the domain at all (such as finance, government affairs), choose the open source model for privatized deployment. If you want to use it out of the box and reduce operation and maintenance costs, use Bailian API. It can also be used in a mixed manner - private for sensitive scenarios and API for common scenarios.
Q: How does the coding capability of Qwen3.5-Coder compare with that of 豆包Doubao? A: Both belong to the first-tier code models in China. The advantage of Qwen3.5-Coder is that it is open source and can be privatized, and the longest 256K+ context supports analysis of very large code bases. Compared with Qwen3-Coder, it has significantly improved cross-file reconstruction and long code understanding. Doubao is more integrated within the ByteDance ecosystem (such as Feishu and Coze). It is recommended to choose based on the collaboration tools used by your team and compliance requirements.
Q: How much data is required for fine-tuning? A: Obvious effects can be seen with 100 high-quality examples in the QLoRA scenario. SFT suggests 500+. The key is data quality - a wrong pair of examples can have a greater impact than missing data. It is recommended to manually mark 50 items to verify the upper limit of Prompt Engineering, and then create a complete data set after confirming that fine-tuning is really needed.
Q: What is the minimum GPU configuration for private deployment? A: Qwen3.5-7B can run on a single RTX 4090 (24GB) using 4-bit quantization. Qwen3.5-72B requires at least 4×A100-80G or 8×RTX 4090. Qwen3.5-Coder-Flash (light version) even runs on consumer GPUs. If there are no GPU resources, Alibaba Cloud PAI on-demand instances are recommended.
Q: How to control API costs? A: Bailian platform provides usage monitoring and limit setting. It is recommended to start with Qwen3.5-Plus (the most cost-effective) and switch to Qwen3.5-Max when higher accuracy is required. Caching answers to frequently asked questions reduces duplicate API calls. For batch tasks, use asynchronous Batch mode to get 50% off.
Period and result
| Phase | Estimated period | Deliverables | Acceptance criteria |
|---|---|---|---|
| Model selection + API integration | 1 day | API test report, integration code example | API response is normal, average delay < 3s |
| Code scenario integration | 1-2 days | Code completion configuration, review of Agent deployment documents | Random inspection of completion accuracy ≥ 80% |
| Multi-modal application construction | 1-2 days | OCR/image and text understanding Demo, integrated code | OCR accuracy ≥ 95% |
| Enterprise knowledge base construction | 2-3 days | Searchable knowledge base + RAG Q&A interface | Search Recall@5 ≥ 85% |
| Model fine-tuning | 3-5 days | Checkpoint + evaluation report after fine-tuning | Test set indicator improvement ≥ 15% |
| Private deployment | 2-3 days | Production deployment architecture + monitoring alarms | P95 latency < 5s, no downtime for 7 days |
Advantages and Disadvantages of the Solution
Advantages:
- Complete model family: From 0.5B to 72B+, from dialogue to code to multi-modality, the entire Qwen series covers most scenarios and can be called with a set of API specifications
- Open source can be privatized: The Qwen model is open source under the Apache 2.0 protocol, and there are no legal barriers to domestic deployment
- Chinese Ecosystem Leading: Stable performance in Chinese understanding and code mixing scenarios, and the Embedding model has native advantages in Chinese search scenarios
- Alibaba Cloud Native Integration: In-depth adaptation of Bailian Platform, PAI, and ECS to reduce operation and maintenance complexity
- Active community: There are a large number of Qwen's fine-tuning scripts, inference optimization and community cases on Hugging Face and ModelScope
Disadvantages:
- English scene is relatively weaker than Claude/GPT: There is still a gap with
Claude and
ChatGPT in terms of English long text reasoning and multi-turn dialogue consistency.
- API availability zone restrictions: The domestic site of Bailian API needs to register a domain name, and some functions of the international site are restricted.
- Median inference cost is high: Compared with DeepSeek's extremely cost-effective and open source MoE architecture, Qwen is not the lowest choice in terms of inference cost.
- Document Fragmentation: Bailian Platform, ModelScope, and GitHub each have some documents. There is a certain learning cost for cross-platform troubleshooting.
Tool summary
| Tools | Slug | Role in this scenario |
|---|---|---|
| Tongyi Qianwen | tongyi-qianwen | Main model product, providing dialogue/content generation entrance |
| Qwen | qwen | Open source model family (including Qwen3.5 series), used for fine-tuning and private deployment |
| Doubao | doubao | Competing products, Chinese scene comparison reference |
| DeepSeek | deepseek | Open source competing products, cost comparison reference |
| chatgpt | Universal dialogue competitor, English scene reference | |
| claude | Long text analysis assistance, code audit reference | |
| Kimi | kimi | Chinese long document dialogue competing product reference |
Implementation suggestions and risk reminders
Phase implementation strategy:
- Phase 1 (1-2 weeks): API integration + code scenarios (highest ROI, lowest risk)
- The second period (2-3 weeks): multi-modal + knowledge base (requires data governance cooperation)
- The third phase (3-5 weeks): fine-tuning + privatized deployment (computing power and compliance pre-review)
Key Risks:
- Data Compliance: API calls and data in the knowledge base must pass legal approval, especially in financial, medical, and government affairs scenarios. It is recommended to give priority to using Alibaba Cloud Shanghai/Beijing regional nodes.
- Quality Drift: The prompt words may become invalid after the model version is updated. Create a prompt regression test set and execute it before the version is updated.
- Over-reliance: The code generated by AI must be manually reviewed before being merged into the main trunk. It is prohibited to bypass the CI/CD access control and go online directly.
- Vendor lock-in: Although Qwen is open source and can be privatized, some functions of the Bailian platform (such as private large model training) are bound to Alibaba Cloud. It is recommended that key modules maintain the API abstraction layer to facilitate switching to other model services.
User Reviews