본문으로 건너뛰기
Skillpedia
에이전트41k · #6737

vision-sft

하는 일

이 도구는 이미지와 텍스트를 함께 이해하도록 AI 모델을 가르칩니다. 이미지를 설명하거나 이미지 내용에 대한 질문에 답하는 것처럼, 둘을 함께 쓰는 특정 작업을 할 수 있도록 모델을 미세 조정합니다.

사용하는 경우

  • ✓AI가 이미지를 더 자세하게 설명하기를 원할 때.
  • ✓AI가 이미지 내용에 대한 질문에 답하기를 원할 때.
  • ✓AI가 특정 종류의 이미지(예: 의료 영상, 도표)를 이해하도록 맞추고 싶을 때.

스킬 링크

https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/vision-sft/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/vision-sft/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 모델이 X선 사진을 이해하고 그에 관한 질문에 답하도록 미세 조정해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 AI 모델에서 이미지와 텍스트를 처리하는 특정 부분을 조정합니다. 모델의 대부분은 그대로 두고, LoRA라는 방법으로 효율적으로 변경합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Vision-Language SFT

This skill assumes finetuning-method-selection already routed here: the data shape is image+text demonstrations, not preference pairs or a verifiable reward signal, and the base is a vision-language model rather than a text-only one. lora-qlora-recipes covers the text-only LoRA/QLoRA recipe this skill specializes for the vision tower and projector; read that skill first if the LoRA fundamentals (rank, alpha, target modules) aren't already familiar.

Input: an image+text dataset and a VLM base model already picked from the model catalog. Output format: a validated adapter config — which components are frozen, LoRA target modules, and a min_pixels/max_pixels budget — that llm-finetuning-training-engineer consumes directly when it generates a runnable script.

Quick Reference

Situation Default
Adapting behavior on familiar images Frozen tower+projector, LoRA r=8–16, α=16–32
Visual domain shift Unfreeze last-6 ViT layers, vision LR 5–10x lower
Doesn't fit in bf16 at target rank QLoRA — frozen vision tower only
fast_inference=True finetune_vision_layers=False
Loss normal, eval not improving Check the Two Silent Killers below first

The Consensus Recipe

Freeze the vision tower and the projector. Put LoRA on the LLM only, all-linear (the same attention + MLP target list as text-only SFT — see lora-qlora-recipes), at r=8–16, α=16–32. This is the settled default for adapting a VLM's behavior without disturbing how it sees.

  • The vision tower and projector stay frozen by default. They already encode a general visual representation; retraining them is rarely necessary and adds risk without adding capability for most tasks.
  • LoRA rank runs lower than the text-only general default (r=8–16 here vs r=16–32 for text-only SFT) because the LLM-only adapter is adapting behavior, not injecting new visual knowledge.
  • QLoRA is permitted only with a frozen vision tower. Quantizing the base while also unfreezing and training vision layers is unsupported and unstable — treat this as a hard pairing rule, not a tunable. If the vision tower needs to unfreeze, drop QLoRA and use bf16 LoRA instead.
# freeze tower + projector; LoRA on LLM only
for name, param in model.named_parameters():
    if "vision_tower" in name or "projector" in name:
        param.requires_grad = False

target_modules = [
    "q_proj", "k_proj", "v_proj", "o_proj",
    "gate_proj", "up_proj", "down_proj",
]  # LLM-only, all-linear — r=8-16, alpha=16-32

When to Unfreeze

Unfreezing vision layers is a deliberate escalation, not a default decision — reach for it only when the domain shift is visual, not textual.

  • Unfreeze only for visual domain shift. If the task is teaching new behavior on images the tower already understands (charts, everyday photos), the frozen-tower recipe above is sufficient. Unfreeze when the visual domain itself is unfamiliar to the tower — satellite imagery, medical scans, dense technical diagrams — and the frozen-tower recipe plateaus.
  • Last-6 ViT layers is the sweet spot. Unfreezing the final six vision-transformer layers (not the whole tower) measured +1.7pt DocVQA at ~1.75x training cost over the frozen baseline. Treat six layers as the ceiling worth paying for; going further spends compute without a matched result.
  • Vision LR must run 5–10x lower than the LLM LR when unfrozen. The vision tower's pretrained representation is more fragile than the LLM's adapter; the same LR for both risks overwriting the visual representation faster than the LLM adapter can compensate.
  • High LoRA rank on the patch- embedding layer risks NaN. If patch embedding is in the unfrozen set, keep its rank low and watch early-step loss closely — one of the most fragile places to apply LoRA in a VLM.

The Two Silent Killers

Both produce a run that trains without error and without learning: the loss curve looks normal, the model doesn't improve, and neither throws an exception — both need an explicit pre-training check, not just a clean training log.

  • Image-tag/count mismatch. Every image placeholder token in the templated text must map 1:1 to a media item actually passed to the collator. A mismatch (one placeholder, zero or two images attached; or an image with no placeholder) doesn't error in most collators —

…

자주 묻는 질문

모델의 일부를 '고정'한다는 것은 무슨 뜻인가요?

학습 중에 그 부분을 바꾸지 않는다는 뜻입니다. AI가 이미 가진 보는 방법에 대한 지식을 그대로 유지하는 것과 같습니다.

LoRA란 무엇인가요?

모델 전체를 다시 학습하지 않고 AI 모델을 미세 조정하는 기법입니다. 작은 '적응'에 집중하므로 더 빠르고 자원을 적게 씁니다.

이미지 크기(min_pixels/max_pixels)가 왜 중요한가요?

모델이 처리할 수 있는 이미지 해상도를 정합니다. 이를 제대로 맞추는 것은, 중요한 세부 사항을 보면서도 메모리를 너무 많이 쓰거나 실패하지 않게 하는 데 핵심입니다.

상세 정보

작성자의 원본 설명

Fine-tune vision-language models (VLMs) with supervised learning on image+text data. Use when adapting a VLM to a visual domain or task, configuring frozen-vision-tower LoRA, or debugging a VLM fine-tune that trains without learning.

repo: wshobson/agents

인기도

GitHub 스타
41k
순위
#6737
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬