A grader is a core component of application evaluation, used to automatically assess output quality. Bailian provides a rich set of preset grader templates and also supports custom LLM graders and Code graders, helping you build an evaluation system tailored to your business scenarios.
A grader is a core component of application evaluation, used to automatically assess output quality. Bailian provides a rich set of preset grader templates and also supports custom LLM graders and Code graders, helping you build an evaluation system tailored to your business scenarios.
Alibaba Cloud Bailian offers multiple preset grader templates covering a variety of evaluation scenarios. Templates are organized into the following categories:
Configuration Steps
Click the Create Grader button in the top-right corner of the graders page, then click Create Custom Grader to enter the creation page.
An LLM grader uses a large model to score application output—suitable for evaluation scenarios that require semantic understanding.
Configuration Steps
A Code grader implements evaluation logic with Python scripts—suitable for evaluation scenarios that require precise rule-based judgment.
Configuration Steps
Creating a grader from an evaluation task uses the annotation results of a historical evaluation task to automatically abstract and summarize a new LLM grader. This is suitable when you already have manual annotation data and want to solidify annotation experience into automated evaluation rules.
Configuration Steps
On the custom grader list page, you can filter graders by type or name, and manage specific graders.
After a grader is created, you must add it to an evaluation task and configure parameter mapping for it to take effect.
After an evaluation task completes, view the grader results on the task details page. For details, see Evaluation Tasks.
The evaluation task list includes columns for Evaluation Status, Task Name, Dataset Name, Application & Score (Pass Rate), Grader Details Auto, Label Details Manual, Token Consumption, Evaluation Time, and Actions. The Grader Details Auto column shows each automatic grader's run status (in progress or completed) and pass rate. The Actions column provides Details, Terminate, and Delete links.
Recommendations:
Create from a Preset Grader Template
Alibaba Cloud Bailian offers multiple preset grader templates covering a variety of evaluation scenarios. Templates are organized into the following categories:
- General Quality: Evaluates basic quality metrics of responses.
- Agent: Specifically evaluates the various capabilities of Agent applications.
- Text Matching: Uses exact rules for text matching.
- Text Similarity: Computes a text-similarity score.
- Format Validation: Validates output format compliance.
Evaluation dataset field planning: Different preset graders have different requirements for evaluation dataset fields. Before building an evaluation dataset, confirm the required parameters of the grader you intend to use, and include the corresponding fields in the dataset in advance.For example, when an evaluation task uses the "Q&A Relevance" grader, the required parameters are
query and response. Therefore, when building the evaluation dataset, the fields must include query (mapped to the Prompt field) and response (mapped to the Completion field).Click View Details on a preset grader template card to see its required parameter list, and plan dataset fields accordingly.- Click the Create Grader button in the top-right corner of the graders page, and choose to create a grader from a preset template.
- Click Create from Preset on the desired template card to quickly create a grader, adjusting the details as needed.
- In the trial-run validation area, click Run to confirm the evaluation logic works as expected, then click Create to save.
- Click View Details to see the parameter information of the current grader template.
Create a Custom Grader
Click the Create Grader button in the top-right corner of the graders page, then click Create Custom Grader to enter the creation page.
Create an LLM Grader
An LLM grader uses a large model to score application output—suitable for evaluation scenarios that require semantic understanding.
Configuration Steps
-
On the custom grader creation page, fill in the basic information:
- Grader name: Up to 50 characters.
- Description: Up to 200 characters, describing the grader's purpose.
- Select LLM as the creation method.
- Select a model: Click the model dropdown to choose the large model used for evaluation. Evaluation models are free for a limited time.
- Prompt: Design evaluation rules in the prompt editor; click Select Preset Grader to import rules.
-
Configure scoring rules:
- Score range: Determines the grader's scoring scale. The score range is added to the system prompt, so keep the score range consistent with the system prompt rules when editing.
- Pass threshold: Determines the Pass/Fail status. Score ≥ threshold is Pass; score < threshold is Fail.
- Trial-run validation: Fill in test values for each referenced parameter, click Run to confirm the evaluation logic works as expected, then click Create to save.
Create a Code Grader
A Code grader implements evaluation logic with Python scripts—suitable for evaluation scenarios that require precise rule-based judgment.
Configuration Steps
-
On the custom grader creation page, fill in the basic information:
- Grader name: Up to 50 characters.
- Description: Up to 200 characters, describing the grader's purpose.
- Select Code as the creation method.
-
Input parameters:
- Default parameters: The system presets two parameters,
queryandresponse, which can be modified or deleted as needed. - Add parameters: Click Add Variable to define function input parameters.
- Default parameters: The system presets two parameters,
-
Execution function: Write a Python 3.10 function in the code editor.
Code requirements:
- The function signature must include all parameters defined in the input parameters.
- The function must return a scoring result (numeric type, within the score range).
- Error-handling logic is recommended.
- Score range: Determines the grader's scoring scale. The score range is added to the system prompt, so keep the score range consistent with the system prompt rules when editing.
- Pass threshold: Determines the Pass/Fail status. Score ≥ threshold is Pass; score < threshold is Fail.
-
Trial-run validation: Enter test data (the format must include all input parameters), click Run to view the score or error message, then click Create to save the grader.
Example test data:
Create a Grader from an Evaluation Task
Creating a grader from an evaluation task uses the annotation results of a historical evaluation task to automatically abstract and summarize a new LLM grader. This is suitable when you already have manual annotation data and want to solidify annotation experience into automated evaluation rules.
Configuration Steps
-
On the custom grader creation page, fill in the basic information:
- Grader name: Up to 50 characters.
- Description: Up to 200 characters, describing the grader's purpose.
- Select From Evaluation Task as the creation method.
- Select a model: Click the model dropdown to choose the large model used for evaluation. Evaluation models are free for a limited time.
- Select an evaluation task: Choose a historical evaluation task with completed annotations from the dropdown. The system learns evaluation rules based on that task's annotation results.
-
Configure field mapping: Select evaluation dataset fields or application output fields from the dropdown. Preset parameters:
- query (String): The user's input question or query—map it to the question field in the dataset (e.g., the Prompt field).
- response (String): The application output to evaluate or a dataset field (e.g., the Completion field).
- label_score (Number): The manually annotated score—map it to the grader output score used in the evaluation task.
querymaps to a data field in the evaluation dataset.label_scoremaps to the grader in the evaluation task (shown as "grader-name_version Auto").- Only evaluation tasks that have completed evaluation can be used to create graders; incomplete tasks show "The grader status in the evaluation task is not complete."
-
Task description (optional): Provide complete background information about the evaluation task, including:
- System purpose (e.g., "medical Q&A system").
- Target user group.
- Use case (e.g., "for medical professionals, providing fast and accurate clinical Q&A").
- This description is used to automatically generate evaluation criteria and the final evaluation prompt.
- Grader language: Choose the grader's output language—Chinese or English.
-
Configure scoring rules:
- Score range: Determines the grader's scoring scale.
- Pass threshold: Determines the Pass/Fail status. Score ≥ threshold is Pass; score < threshold is Fail.
- After completing the configuration, click Create in the top-right corner to save the grader.
Graders created from an evaluation task do not support trial runs; you need to use them in an actual evaluation task to see their effect.
- You must select an evaluation task with completed evaluation; incomplete tasks cannot be used to create graders.
- Choose evaluation tasks with sufficient, high-quality annotation data for a more accurate grader.
- The
label_scorefield maps to the grader output score in the evaluation task, not the raw fields of the evaluation dataset.
Manage Graders
On the custom grader list page, you can filter graders by type or name, and manage specific graders.
- Filter and search: Filter graders by LLM or Code type, or enter a grader name (fuzzy match supported, up to 50 characters) in the search box.
- Edit: The edit page shows a list of historical versions; select a version and click Overwrite Current Draft to switch and view different version configurations.
- Copy: Create a copy based on the current latest version, automatically carrying over all configurations.
- Delete: Deleted graders cannot be recovered—proceed with caution. A grader used by an evaluation task cannot be deleted. Before deleting, confirm no evaluation task depends on it.
Use a Grader in an Evaluation Task
After a grader is created, you must add it to an evaluation task and configure parameter mapping for it to take effect.
-
When creating an evaluation task, click Add Grader and select the grader and its version.
Choose the grader type as Custom Grader or Preset Grader, then map fields such asEach evaluation task supports up to 10 graders.
query,context, andreference_responseto the corresponding dataset fields in the field-mapping area, and click Complete Creation. -
After selecting a grader, complete parameter mapping to tell the system "where the grader's parameters get their data."
Suppose you created an LLM grader whose prompt references 3 variables:
query: The user's question.reference: The reference answer.response: The answer to be evaluated.
Grader Parameter Maps To Description query Dataset field: question Get the user's question from the dataset's question field reference Dataset field: reference answer Get the reference answer from the dataset's "reference answer" field response Model output or dataset field Get the content to evaluate from the application's actual output or a dataset field
View Evaluation Results
After an evaluation task completes, view the grader results on the task details page. For details, see Evaluation Tasks.
The evaluation task list includes columns for Evaluation Status, Task Name, Dataset Name, Application & Score (Pass Rate), Grader Details Auto, Label Details Manual, Token Consumption, Evaluation Time, and Actions. The Grader Details Auto column shows each automatic grader's run status (in progress or completed) and pass rate. The Actions column provides Details, Terminate, and Delete links.
Frequently Asked Questions
What's the relationship between a grader and an evaluation task?
What's the relationship between a grader and an evaluation task?
A grader defines the rules for "how to score"; an evaluation task applies graders to specific data. A single grader can be used by multiple evaluation tasks.
How do I choose between an LLM grader and a Code grader?
How do I choose between an LLM grader and a Code grader?
| Comparison | LLM Grader | Code Grader |
|---|---|---|
| Evaluation method | Semantic understanding by a large model | Rule-based judgment via code |
| Strengths | Flexible, adapts to complex scenarios | Precise, reproducible |
| Use cases | Relevance, harmfulness, hallucination detection | Format validation, numeric computation, exact matching |
| Cost | Token cost from model calls | No additional cost |
- Need semantic and contextual understanding → Choose an LLM grader.
- Need precise rules and deterministic results → Choose a Code grader.
- Complex evaluation scenarios → Combine multiple graders.
How do I improve the accuracy of an LLM grader?
How do I improve the accuracy of an LLM grader?
- Choose an appropriate model: A model with 32B+ parameters is recommended.
- Optimize the prompt: Clarify scoring criteria and evaluation steps; provide clear output-format requirements; use examples to illustrate expected behavior.
- Adjust the score range: Choose a score range appropriate for the scenario.
- Trial-run validation: Validate with multiple sets of test data before creation.