finetuning-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Finetuning Setup

微调设置

Guides the user through selecting a base model and fine-tuning technique based on their use case.
引导用户根据其用例选择基础模型和微调技术。

When to Use

适用场景

  • User asks which fine-tuning technique to use
  • User wants to select or change their base model
  • User mentions a model name or family (e.g., "Llama", "Mistral") — the exact Hub model ID still needs to be resolved
  • 用户询问应使用哪种微调技术
  • 用户想要选择或更换其基础模型
  • 用户提到某个模型名称或系列(例如「Llama」、「Mistral」)——仍需要解析出确切的Hub模型ID

Prerequisites

前置条件

  • A
    use_case_spec.md
    file exists. If not, activate the use-case-specification skill to generate it first.
  • 存在
    use_case_spec.md
    文件。如果不存在,请先激活用例规范生成skill来生成该文件。

Workflow

工作流

Step 1: Discover Hub

步骤1:查找Hub

  1. List all available SageMaker Hubs in the user's region by calling the SageMaker
    ListHubs
    API using the
    aws___call_aws
    tool.
  2. From the results, filter out any hub whose
    HubDescription
    contains "AI Registry" — these do not contain JumpStart models.
  3. The remaining hubs are eligible (e.g.,
    SageMakerPublicHub
    and any private hubs).
  4. If exactly one eligible hub exists, use it automatically — do not ask the user.
  5. If multiple eligible hubs exist, present them to the user and ask which one to use. Example:
    I found the following model hubs:
    - SageMakerPublicHub — SageMaker Public Hub
    - Private-Hub-XYZ — Private Hub models
    Which hub would you like to use?
  6. Store the selected hub name for use in subsequent steps.
  1. 使用
    aws___call_aws
    工具调用SageMaker的
    ListHubs
    API,列出用户区域内所有可用的SageMaker Hub。
  2. 从结果中过滤掉所有
    HubDescription
    包含「AI Registry」的Hub——这些Hub不包含JumpStart模型。
  3. 剩余的Hub均为可用(例如
    SageMakerPublicHub
    和所有私有Hub)。
  4. 如果仅有一个可用Hub,自动使用该Hub,无需询问用户。
  5. 如果有多个可用Hub,将其展示给用户并询问要使用哪个。示例:
    I found the following model hubs:
    - SageMakerPublicHub — SageMaker Public Hub
    - Private-Hub-XYZ — Private Hub models
    Which hub would you like to use?
  6. 存储选中的Hub名称,供后续步骤使用。

Step 2: Select Base Model

步骤2:选择基础模型

  1. Read
    use_case_spec.md
    to understand the use case and success criteria.
  2. Restate the use case in one sentence.
  3. Always retrieve the full list of available SageMaker Hub model names by running:
    python finetuning-setup/scripts/get_model_names.py <hub-name>
    — even if the user has already mentioned a model name or family. Do not skip this step or filter the results.
  4. Present all available models to the user, grouped by model family (e.g., Llama, Mistral, Gemma) for readability.
  5. Ask the user to pick the exact model ID from the list.
  6. Validate the selected model exists in the retrieved list before proceeding.
EXTREMELY IMPORTANT: NEVER recommend or suggest any particular model based on the context you have. YOU ARE ALLOWED ONLY to display the list of models as given by the script. DO NOT add your own recommendation or suggestion after displaying the list of models to tell which model is correct. Present this statement to the user: "Which model would you like to use? Please type the exact model name from the above list." and allow the user to select the model.
  1. 读取
    use_case_spec.md
    以了解用例和成功标准。
  2. 用一句话重述用例。
  3. 始终运行以下命令获取SageMaker Hub中所有可用的模型名称完整列表:
    python finetuning-setup/scripts/get_model_names.py <hub-name>
    ——即使用户已经提到了某个模型名称或系列也必须执行。请勿跳过此步骤或过滤结果。
  4. 为便于阅读,将所有可用模型按模型系列(例如Llama、Mistral、Gemma)分组后展示给用户。
  5. 请用户从列表中选择确切的模型ID。
  6. 继续下一步之前,验证选中的模型存在于检索到的列表中。
非常重要:绝对不要根据你掌握的上下文推荐或建议任何特定模型。你只允许展示脚本返回的模型列表。展示模型列表后,不要额外添加你自己的推荐或建议来说明哪个模型是正确的。向用户展示以下语句:「您想要使用哪个模型?请输入上述列表中的确切模型名称。」并允许用户选择模型。

Step 3: Determine Finetuning Technique

步骤3:确定微调技术

  1. Consult
    references/finetune_technique_selection_guide.md
    and recommend the best-fit technique (SFT, DPO, or RLVR) for the use case. Present the recommendation and reasoning to the user.
  2. Ask the user if they'd like to go with the recommendation or prefer a different technique.
  3. Once the user confirms a technique, retrieve the finetuning techniques available for the selected model by running:
    python finetuning-setup/scripts/get_recipes.py <model-name> <hub-name>
    • This returns only the techniques the model actually supports, filtered to SFT, DPO, and RLVR. Only these three techniques are supported — ignore any other techniques even if the model's recipes include them.
  4. If the chosen technique is available for the model, proceed to Step 4.
  5. If the chosen technique is not available for the model, explain that the selected model does not support it on SageMaker and offer to go back to Step 2 to pick a different model that supports the chosen technique.
  1. 参考
    references/finetune_technique_selection_guide.md
    ,为用例推荐最合适的技术(SFT、DPO或RLVR)。向用户展示推荐结果和理由。
  2. 询问用户是否接受该推荐,还是想要选择其他技术。
  3. 用户确认技术后,运行以下命令获取选中模型支持的微调技术:
    python finetuning-setup/scripts/get_recipes.py <model-name> <hub-name>
    • 该命令仅返回模型实际支持的技术,过滤后仅保留SFT、DPO和RLVR。仅支持这三种技术——即便是模型的配置中包含其他技术也请忽略。
  4. 如果选中的技术适用于该模型,继续执行步骤4。
  5. 如果选中的技术不适用于该模型,向用户说明选中的模型在SageMaker上不支持该技术,并提供返回步骤2选择支持所选技术的其他模型的选项。

Step 4: Confirm Selections

步骤4:确认选择

Present a summary to the user:
Here's what we've selected:
- Base model: [model name]
- Fine-tuning technique: [SFT/DPO/RLVR]
向用户展示摘要:
Here's what we've selected:
- Base model: [model name]
- Fine-tuning technique: [SFT/DPO/RLVR]

References

参考资料

  • references/finetune_technique_selection_guide.md
    — Technique guidance
  • references/finetune_technique_selection_guide.md
    — 技术指南