Testing Alibaba Cloud Model Studio (Bailian 百炼)
I’ve written about AI and LLMs a number of times in this blog in the last couple of years, but in all the occasions I was referring to OpenAI and their GPT3 model.
Today I’m writing the article I’ve been wishing to write for the last 3 years. Why? Alibaba Cloud just released a new product, Model Studio, which is their playground to test and play with models like Qwen, Tongyi Qwen, Tongyi Wanxiang and the multiple chat models they have like Qwen1.5-72B-Chat.
As a curiosity, in the original chinese version they call it Bailian (百炼), which means “refined through a hundred processes”, symbolizing meticulous development and high-quality craftsmanship.
As part of their release announcement, they opened the whole platform for free until the 15th of July, so here I am rushing to test everything I can. In fact, I’ll show you a quick demo of how to get a basic example up and running.
Ok, give me more details about Model Studio
Honestly, Alibaba Cloud Model Studio stands out as a comprehensive, generative AI platform that can be used for multiple of business needs.
It can be seen as a one-stop solution to integrate foundation models (FMs). These foundation models are enhanced to support a range of capabilities such as chat, SQL creation (NL2SQL) and more, making it easier for developers to quickly build applications addressing their specific requirements.
Something that surprised me of Alibaba Cloud Model Studio is how developer-focused appears to be. It just simplifies so much the development of AI applications with pre-built workflows, visual orchestration, and a full collection of APIs.
I believe targeting developers to make their life easier is the key, but Model Studio even offers the possibility of customizing the models with custom-data using a Retrieval-Augmented Generation (RAG) architecture isolated from external networks. Meaning your private data will stay, well, private.
This product is purpose-built for businesses looking to use AI without managing the underlying infrastructure.
Intro was good, but let’s have some fun with this
Okay, okay. I get it. Mucho blah blah but you want to run it by yourself. Let’s see how this platform “refined through a hundred processes” works.
Step 1: Play with the chat
This step is simple, just go to the Model Studio console and start chatting straight away.
Here, you can choose the model to chat with, like Qwen-Max, Qwen-Plus, Qwen-Turbo & Qwen1.5-32B-Chat. Go and have a fruitful conversation with your new friend. Then, come back and continue this How-To.
Step 2: Get an API Key
This gets serious! Go into the API Key Management screen and click on “Create API Key”. In just a couple of seconds you’ll get one. It will look something like sk-fexxxxxde91xxxxxe06cb34axxxxx8e
.
Step 2.1: Activate Model Service
I call this step 2.1 because you will only need to activate this the first time you use the service. Go into the Model Gallery and click “Activate Model Service”.
Step 3: Choosing a model
Nice! You made it to this point, so it makes sense you keep going.
This step is about discovery, as the Model Studio UI is very well-made. Still in the link from the above step, the Model Gallery, we can choose any model we want to test. In my case, I chose “Qwen-Max”, a Qwen 2.5 model that supports a parameter scale of hundreds of billions. At the moment, the Qwen-Max-0428 is the current version.
Following the above example, we get the next curl
command:
curl --location "https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text-generation/generation" \
--header "Authorization: Bearer <your-dashscope-api-key>" \
--header "Content-Type: application/json" \
--header "X-DashScope-SSE: enable" \
--data '{
"model": "qwen-max",
"input":{
"messages":[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Introduce the capital of Spain"
}
]
},
"parameters": {
}
}'
Also, the equivalent request made in Node.js would be something like:
const axios = require('axios')
const config = {
method: 'post',
url: 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text-generation/generation',
headers: {
'Authorization': 'Bearer <your-dashscope-api-key>',
'Content-Type': 'application/json',
'X-DashScope-SSE': 'enable',
},
data: {
'model': 'qwen-max',
'input': {
'messages': [
{
'role': 'system',
'content': 'You are a helpful assistant.',
},
{
'role': 'user',
'content': 'Introduce the capital of Spain',
},
],
},
'parameters': {},
},
}
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data))
})
.catch(console.error)
Making sure you replace the <your-dashscope-api-key>
with your actual API key, the result you could get is a series of JSON
encoded responses from the real-time output of the model. As we asked to “Introduce the capital of Spain” to the system with some initial instructions of “You are a helpful assistant”, the final result is something like:
{
"output": {
"finish_reason": "stop",
"text": "The capital of Spain is Madrid. Located in the heart of the country, Madrid is not only the political center but also a major cultural, educational, and economic hub. With a population of over 3 million people in the metropolitan area, it is one of the most populous cities in Europe. Known for its rich history, Madrid boasts world-renowned museums such as the Prado Museum, Reina Sofia Museum, and the Thyssen-Bornemisza Museum, which together form the Golden Triangle of Art. The city is also famous for its vibrant nightlife, beautiful parks like Retiro Park, and iconic landmarks including the Royal Palace of Madrid and the Puerta del Sol. Madrid is a fusion of modernity and tradition, offering a unique experience to visitors with its architectural treasures, gastronomy, and lively festivals throughout the year."
},
"usage": {
"total_tokens": 193,
"output_tokens": 168,
"input_tokens": 25,
"plugins": {}
},
"request_id": "01cacea2-4e1c-9597-9a3a-2170e8c6fa2e"
}
Not bad, the model knows about Madrid!
Conclusion
Exploring Alibaba Cloud Model Studio has been a very interesting step for me to keep exploring the world of AI and LLMs.
This was a small test, but the platform has a great suite of tools and models, making it accessible for developers of all backgrounds and levels to create AI-powered applications.
Here, just by following the steps outlined in this guide, including generating a detailed response about the capital of Spain using the Qwen-Max model, you can quickly get started and see the potential of these models firsthand.
The future of AI development does look shiny with platforms like Alibaba Cloud Model Studio.
Original article: Testing Alibaba Cloud Model Studio (Bailian 百炼).