Ajuste Fino (Fine-tuning)
Fine-tuning é o processo de pegar um modelo de machine learning pré-treinado e treiná-lo ainda mais em um conjunto de dados específico para melhorar seu desempenho em uma tarefa específica.
Fine-tuning é uma técnica de aprendizagem de transferência em que um modelo de aprendizagem de máquina pré-treinado, tipicamente treinado em um grande conjunto de dados geral (por exemplo, ImageNet para visão, um grande corpus para NLP), é adaptado para uma tarefa específica em baixo usando um conjunto de dados específico de tarefas menores. O processo envolve tomar a arquitetura e os pesos do modelo pré-treinado e continuar o processo de treinamento, geralmente com uma taxa de aprendizagem mais baixa, no novo conjunto de dados. Muitas vezes, as camadas finais da rede são substituídas ou modificadas para corresponder aos requisitos de saída da nova tarefa (por exemplo, mudar um classificador de classe 1000 para um classificador de classe 10). Fine-tuning aproveita as características gerais aprendidas pelo modelo no grande conjunto de dados,
graph LR
Center["Ajuste Fino (Fine-tuning)"]:::main
Pre_machine_learning["machine-learning"]:::pre --> Center
click Pre_machine_learning "/terms/machine-learning"
Pre_large_language_model["large-language-model"]:::pre --> Center
click Pre_large_language_model "/terms/large-language-model"
Center --> Child_lora["lora"]:::child
click Child_lora "/terms/lora"
Center --> Child_rlhf["rlhf"]:::child
click Child_rlhf "/terms/rlhf"
Rel_front_running["front-running"]:::related -.-> Center
click Rel_front_running "/terms/front-running"
Rel_inference["inference"]:::related -.-> Center
click Rel_inference "/terms/inference"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧠 Teste de conhecimento
🧒 Explique como se eu tivesse 5 anos
It's like taking a chef who knows how to cook many things (pre-trained model) and teaching them your specific family recipes (new dataset) so they become great at cooking just your favorite dishes.
🤓 Expert Deep Dive
Fine-tuning operates on the principle that representations learned on large-scale, diverse datasets capture fundamental patterns applicable to related tasks. In deep learning, this typically involves adjusting the weights of a pre-trained network (e.g., ResNet, BERT) using backpropagation on a target dataset. The learning rate is often set significantly lower than during pre-training to avoid drastic weight updates that could disrupt the learned features. Layer freezing is a common strategy: earlier layers capturing low-level features (e.g., edges, textures in images; word embeddings in text) are often frozen, while later layers capturing more task-specific features are fine-tuned. Alternatively, adapter modules can be inserted between layers, allowing task-specific parameters to be learned while keeping the original model weights fixed. The effectiveness relies heavily on the similarity between the pre-training and fine-tuning data distributions and tasks. Domain shift can necessitate more extensive fine-tuning or different adaptation strategies. Overfitting remains a primary concern, especially with very small target datasets, often mitigated by regularization techniques or early stopping.