LLM

Updated at:

Definition

The AI Studio large language model (LLM) node is a core feature that leverages large language models to process various user inputs, such as text, files, and images, and provide intelligent responses.

A typical LLM workflow consists of a Start node, an LLM node, and an End node connected in sequence. The Start node defines input variables, the LLM node selects a model (such as qwen-max-latest) to process the input, and the End node outputs the result. You can test the workflow in real time by clicking the Test Run button in the upper-right corner. The model's output is displayed in the Result panel.

Prerequisites

Create an AI Studio service

Use cases

The LLM node handles a wide range of tasks based on your prompts, playing a key role in various workflow stages.

  • Intent recognition: In customer service scenarios, it identifies and classifies the intent of user questions to route them to different processing flows.

  • Text generation: Serves as the core of content generation, automatically creating articles or reports from topics and keywords.

  • Content classification: In email processing, automatically classifies emails as inquiries, complaints, or spam.

  • Text translation: Translates user text into a specified language.

  • Code generation: Assists with programming by generating business logic or test cases from user requirements.

  • Retrieval-augmented generation (RAG): In knowledge base Q&A, combines retrieved knowledge with user questions to generate accurate answers.

  • Image understanding: Leverages the vision capability of a multimodal model to understand and answer questions about images.

By selecting the right model and crafting effective prompts, you can build powerful and reliable AI solutions in AI Studio.

Node configuration

Click the image icon after the Start node to add an LLM node.

Click the LLM node and add a model in the node panel.

The node panel is organized into several sections. At the top, the Model drop-down list lets you select a configured model (such as qwen-max-latest), with its type and context window size displayed on the right. The central section is for prompt editing, containing input boxes for the SYSTEM (system prompt) and USER (user message). You can reference variables from upstream nodes in the USER section. At the bottom, you can configure Output Variables and Retry on Failure. Click Add Message to add more conversational turns.

Configuration steps:

  • Select a model: AI Studio supports major global models, including Alibaba Cloud's Qwen series, OpenAI's GPT series, and Google's Gemini series. When selecting a model, consider factors such as its inference capability, cost, response speed, and context window to match your specific scenario and task requirements.

    • Note: If you are using AI Studio for the first time, you must configure your models in the Plugin Model Provider section before selecting a model in the LLM node.

  • Configure model parameters: These parameters control the model's output and include settings such as Temperature, Top P, Max Tokens, and Response Format. For convenience, the system provides three preset parameter sets: Creative, Balanced, and Precise. If you are not familiar with these parameters, we recommend using the default settings. If your application requires image analysis capabilities, select a multimodal model with vision capability.

  • Provide context (optional): Context provides background information for the LLM and is often used to populate output variables with results from knowledge retrieval.

  • Write the prompt: The LLM node provides a user-friendly interface for designing prompts. The prompt structure varies depending on whether you choose a chat model or completion model. If you select a chat model, you can customize the SYSTEM (system prompt), USER , and ASSISTANT sections.

Each prompt area supports Jinja template syntax. You can reference output variables from upstream nodes, such as variables defined in the Start node, by using the @ symbol. The character count for each area is displayed in the upper-right corner. To build multi-turn conversational prompts, add multiple USER and ASSISTANT messages by clicking Add Message.

Model parameters

Model parameters directly affect the output and vary by model. The following section describes the parameters for qwen-max-latest.

For example, the parameter panel for qwen-max-latest includes the following parameters: Presence Penalty (default: 1), Frequency Penalty (default: 1), Max Tokens (default: 1024), Temperature (default: 1), Top P (default: 1), Seed (default: 0), and Response Format (drop-down list). You can adjust each parameter's value with its slider or input box, and enable or disable it using the checkbox to its left.

Model parameter list

The following is an explanation of the main parameters:

● Temperature: Controls the randomness of the generated output. It typically ranges from 0 to 1. ○ Values closer to 0 result in more deterministic and repetitive output. ○ Values closer to 1 result in more random and diverse output. ● Top P: Controls the diversity of the output. The model selects from a pool of candidate words, ensuring that their cumulative probability does not exceed the preset threshold P. ● Presence Penalty: Reduces the likelihood of repeating tokens that have already appeared. Higher values increase the penalty, encouraging the model to introduce new topics. ● Frequency Penalty: Reduces the repetition of tokens that appear frequently. Higher values apply a stronger penalty to overused tokens, which increases the text's lexical diversity.