> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 如何进行重复评估

运行多次重复评估可以更准确地估算系统性能，因为大语言模型的输出并非确定性的。每次重复的输出可能有所不同。重复评估是降低高变异性系统（如智能体）噪声的一种方法。

## 在实验中配置重复次数

在 `evaluate` / `aevaluate` 函数（[Python](https://docs.smith.langchain.com/reference/python/evaluation/langsmith.evaluation._runner.evaluate)、[TypeScript](https://docs.smith.langchain.com/reference/js/interfaces/evaluation.EvaluateOptions#numrepetitions)）中添加可选参数 `num_repetitions`，以指定对数据集中每个示例进行评估的次数。例如，若数据集中有5个示例且设置 `num_repetitions=5`，则每个示例将运行5次，总计25次运行。

<CodeGroup>
  ```python Python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  from langsmith import evaluate

  results = evaluate(
      lambda inputs: label_text(inputs["text"]),
      data=dataset_name,
      evaluators=[correct_label],
      experiment_prefix="Toxic Queries",
      num_repetitions=3,
  )
  ```

  ```typescript TypeScript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  import { evaluate } from "langsmith/evaluation";

  await evaluate((inputs) => labelText(inputs["input"]), {
    data: datasetName,
    evaluators: [correctLabel],
    experimentPrefix: "Toxic Queries",
    numRepetitions: 3,
  });
  ```
</CodeGroup>

## 查看重复评估实验的结果

如果您使用了[重复评估](/langsmith/repetition)运行实验，输出结果列中将显示箭头，以便您在表格中查看输出。要查看重复评估中的每次运行，请将鼠标悬停在输出单元格上并点击展开视图。当您运行重复评估实验时，LangSmith会在表格中显示每个反馈分数的平均值。点击反馈分数可查看单次运行的反馈分数，或查看重复评估间的标准差。

<img src="https://mintcdn.com/other-405835d4/kU99RLuXybYOidw_/langsmith/images/repetitions.png?fit=max&auto=format&n=kU99RLuXybYOidw_&q=85&s=ee8b2062d4b79b8f802a60108bcae316" alt="重复评估" width="1592" height="922" data-path="langsmith/images/repetitions.png" />

***

<div className="source-links">
  <Callout icon="terminal-2">
    [连接这些文档](/use-these-docs)到Claude、VSCode等工具，通过MCP获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在GitHub上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/langsmith/repetition.mdx)或[提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
