import{s as Rn,f as tt,o as Sn,n as In}from"../chunks/scheduler.37c15a92.js";import{S as zn,i as En,g as r,s as a,r as m,A as Wn,h as o,f as i,c as s,j as Si,u,x as d,k as T,y as Ln,a as n,v as g,d as f,t as c,w as h,m as Ke,n as Oe}from"../chunks/index.2bf4358c.js";import{T as De}from"../chunks/Tip.363c041f.js";import{C as Ii}from"../chunks/CodeBlock.4f5fc1ad.js";import{C as Hn}from"../chunks/CourseFloatingBanner.15ba07e6.js";import{Q as it}from"../chunks/Question.668688bc.js";import{H as $,E as qn}from"../chunks/EditOnGithub.8916dc7c.js";function Bn(y){let p;return{c(){p=Ke(`Consider SFT only if you:
- Need additional performance beyond what prompting can achieve
- Have a specific use case where the cost of using a large general-purpose model outweighs the cost of fine-tuning a smaller model
- Require specialized output formats or domain-specific knowledge that existing models struggle with`)},l(l){p=Oe(l,`Consider SFT only if you:
- Need additional performance beyond what prompting can achieve
- Have a specific use case where the cost of using a large general-purpose model outweighs the cost of fine-tuning a smaller model
- Require specialized output formats or domain-specific knowledge that existing models struggle with`)},m(l,w){n(l,p,w)},d(l){l&&i(p)}}}function Gn(y){let p,l,w="This evaluation will help determine if SFT is the right approach for your needs.";return{c(){p=Ke(`Before starting SFT, evaluate whether your use case requires:
- Precise output formatting
- Domain-specific knowledge
- Consistent response patterns
- Adherence to specific guidelines
`),l=r("p"),l.textContent=w},l(v){p=Oe(v,`Before starting SFT, evaluate whether your use case requires:
- Precise output formatting
- Domain-specific knowledge
- Consistent response patterns
- Adherence to specific guidelines
`),l=o(v,"P",{"data-svelte-h":!0}),d(l)!=="svelte-ktd560"&&(l.textContent=w)},m(v,M){n(v,p,M),n(v,l,M)},p:In,d(v){v&&(i(p),i(l))}}}function Qn(y){let p;return{c(){p=Ke(`Start with conservative values and adjust based on monitoring:
- Begin with 1-3 epochs
- Use smaller batch sizes initially
- Monitor validation metrics closely
- Adjust learning rate if training is unstable`)},l(l){p=Oe(l,`Start with conservative values and adjust based on monitoring:
- Begin with 1-3 epochs
- Use smaller batch sizes initially
- Monitor validation metrics closely
- Adjust learning rate if training is unstable`)},m(l,w){n(l,p,w)},d(l){l&&i(p)}}}function Pn(y){let p;return{c(){p=Ke(`When using a dataset with a "messages" field (like the example above), the SFTTrainer automatically applies the model's chat template, which it retrieves from the hub. This means you don't need any additional configuration to handle chat-style conversations - the trainer will format the messages according to the model's expected template format.`)},l(l){p=Oe(l,`When using a dataset with a "messages" field (like the example above), the SFTTrainer automatically applies the model's chat template, which it retrieves from the hub. This means you don't need any additional configuration to handle chat-style conversations - the trainer will format the messages according to the model's expected template format.`)},m(l,w){n(l,p,w)},d(l){l&&i(p)}}}function Zn(y){let p;return{c(){p=Ke(`Watch for these warning signs during training:
1. Validation loss increasing while training loss decreases (overfitting)
2. No significant improvement in loss values (underfitting)
3. Extremely low loss values (potential memorization)
4. Inconsistent output formatting (template learning issues)`)},l(l){p=Oe(l,`Watch for these warning signs during training:
1. Validation loss increasing while training loss decreases (overfitting)
2. No significant improvement in loss values (underfitting)
3. Extremely low loss values (potential memorization)
4. Inconsistent output formatting (template learning issues)`)},m(l,w){n(l,p,w)},d(l){l&&i(p)}}}function Xn(y){let p;return{c(){p=Ke("Monitor both the loss values and the model's actual outputs during training. Sometimes the loss can look good while the model develops unwanted behaviors. Regular qualitative evaluation of the model's responses helps catch issues that metrics alone might miss.")},l(l){p=Oe(l,"Monitor both the loss values and the model's actual outputs during training. Sometimes the loss can look good while the model develops unwanted behaviors. Regular qualitative evaluation of the model's responses helps catch issues that metrics alone might miss.")},m(l,w){n(l,p,w)},d(l){l&&i(p)}}}function Vn(y){let p;return{c(){p=Ke(`Document your training process, including:
- Dataset characteristics
- Training parameters
- Performance metrics
- Known limitations
This documentation will be valuable for future model iterations.`)},l(l){p=Oe(l,`Document your training process, including:
- Dataset characteristics
- Training parameters
- Performance metrics
- Known limitations
This documentation will be valuable for future model iterations.`)},m(l,w){n(l,p,w)},d(l){l&&i(p)}}}function Yn(y){let p,l,w,v,M,nt,F,at,R,zi="Supervised Fine-Tuning (SFT) is a process primarily used to adapt pre-trained language models to follow instructions, engage in dialogue, and use specific output formats. While pre-trained models have impressive general capabilities, SFT helps transform them into assistant-like models that can better understand and respond to user prompts. This is typically done by training on datasets of human-written conversations and instructions.",st,S,Ei='This page provides a step-by-step guide to fine-tuning the <a href="https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B" rel="nofollow"><code>deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B</code></a> model using the <a href="https://huggingface.co/docs/trl/en/sft_trainer" rel="nofollow"><code>SFTTrainer</code></a>. By following these steps, you can adapt the model to perform specific tasks more effectively.',lt,I,rt,z,Wi="Before diving into implementation, it’s important to understand when SFT is the right choice for your project. As a first step, you should consider whether using an existing instruction-tuned model with well-crafted prompts would suffice for your use case. SFT involves significant computational resources and engineering effort, so it should only be pursued when prompting existing models proves insufficient.",ot,C,pt,E,Li="If you determine that SFT is necessary, the decision to proceed depends on two primary factors:",mt,W,ut,L,Hi="SFT allows precise control over the model’s output structure. This is particularly valuable when you need the model to:",gt,H,qi="<li>Generate responses in a specific chat template format</li> <li>Follow strict output schemas</li> <li>Maintain consistent styling across responses</li>",ft,q,ct,B,Bi="When working in specialized domains, SFT helps align the model with domain-specific requirements by:",ht,G,Gi="<li>Teaching domain terminology and concepts</li> <li>Enforcing professional standards</li> <li>Handling technical queries appropriately</li> <li>Following industry-specific guidelines</li>",dt,x,$t,Q,wt,P,Qi="The supervised fine-tuning process requires a task-specific dataset structured with input-output pairs. Each pair should consist of:",yt,Z,Pi="<li>An input prompt</li> <li>The expected model response</li> <li>Any additional context or metadata</li>",Tt,X,Zi="The quality of your training data is crucial for successful fine-tuning. Let’s look at how to prepare and validate your dataset:",vt,b,Xi,Mt,V,bt,Y,Vi="The success of your fine-tuning depends heavily on choosing the right training parameters. Let’s explore each important parameter and how to configure them effectively:",Ct,A,Yi="The SFTTrainer configuration requires consideration of several parameters that control the training process. Let’s explore each parameter and their purpose:",xt,N,Ai="<li><p><strong>Training Duration Parameters</strong>:</p> <ul><li><code>num_train_epochs</code>: Controls total training duration</li> <li><code>max_steps</code>: Alternative to epochs, sets maximum number of training steps</li> <li>More epochs allow better learning but risk overfitting</li></ul></li> <li><p><strong>Batch Size Parameters</strong>:</p> <ul><li><code>per_device_train_batch_size</code>: Determines memory usage and training stability</li> <li><code>gradient_accumulation_steps</code>: Enables larger effective batch sizes</li> <li>Larger batches provide more stable gradients but require more memory</li></ul></li> <li><p><strong>Learning Rate Parameters</strong>:</p> <ul><li><code>learning_rate</code>: Controls size of weight updates</li> <li><code>warmup_ratio</code>: Portion of training used for learning rate warmup</li> <li>Too high can cause instability, too low results in slow learning</li></ul></li> <li><p><strong>Monitoring Parameters</strong>:</p> <ul><li><code>logging_steps</code>: Frequency of metric logging</li> <li><code>eval_steps</code>: How often to evaluate on validation data</li> <li><code>save_steps</code>: Frequency of model checkpoint saves</li></ul></li>",_t,_,Ut,D,jt,K,Ni="Now that we understand the key components, let’s implement the training with proper validation and monitoring. We will use the <code>SFTTrainer</code> class from the Transformers Reinforcement Learning (TRL) library, which is built on top of the <code>transformers</code> library. Here’s a complete example using the TRL library:",kt,O,Jt,U,Ft,ee,Rt,te,Di="The SFTTrainer supports example packing to optimize training efficiency. This feature allows multiple short examples to be packed into the same input sequence, maximizing GPU utilization during training. To enable packing, simply set <code>packing=True</code> in the SFTConfig constructor. When using packed datasets with <code>max_steps</code>, be aware that you may train for more epochs than expected depending on your packing configuration. You can customize how examples are combined using a formatting function - particularly useful when working with datasets that have multiple fields like question-answer pairs. For evaluation datasets, you can disable packing by setting <code>eval_packing=False</code> in the SFTConfig. Here’s a basic example of customizing the packing configuration:",St,ie,It,ne,Ki="When packing the dataset with multiple fields, you can define a custom formatting function to combine the fields into a single input sequence. This function should take a list of examples and return a dictionary with the packed input sequence. Here’s an example of a custom formatting function:",zt,ae,Et,se,Wt,le,Oi="Effective monitoring is crucial for successful fine-tuning. Let’s explore what to watch for during training:",Lt,re,Ht,oe,en="Training loss typically follows three distinct phases:",qt,pe,tn="<li>Initial Sharp Drop: Rapid adaptation to new data distribution</li> <li>Gradual Stabilization: Learning rate slows as model fine-tunes</li> <li>Convergence: Loss values stabilize, indicating training completion</li>",Bt,me,nn,Gt,ue,Qt,ge,an="Effective monitoring involves tracking quantitative metrics, and evaluating qualitative metrics. Available metrics are:",Pt,fe,sn="<li>Training loss</li> <li>Validation loss</li> <li>Learning rate progression</li> <li>Gradient norms</li>",Zt,j,Xt,ce,Vt,he,ln=`As training progresses, the loss curve should gradually stabilize. The key indicator of healthy training is a small gap between training and validation loss, suggesting
the model is learning generalizable patterns rather than memorizing specific examples. The absolute loss values will vary depending on your task and dataset.`,Yt,de,At,$e,rn="The graph above shows a typical training progression. Notice how both training and validation loss decrease sharply at first, then gradually level off. This pattern indicates the model is learning effectively while maintaining generalization ability.",Nt,we,Dt,ye,on="Several patterns in the loss curves can indicate potential issues. Below we illustrate common warning signs and solutions that we can consider.",Kt,Te,pn,Ot,ve,mn="If the validation loss decreases at a significantly slower rate than training loss, your model is likely overfitting to the training data. Consider:",ei,Me,un="<li>Reducing the training steps</li> <li>Increasing the dataset size</li> <li>Validating dataset quality and diversity</li>",ti,be,gn,ii,Ce,fn="If the loss doesn’t show significant improvement, the model might be:",ni,xe,cn="<li>Learning too slowly (try increasing the learning rate)</li> <li>Struggling with the task (check data quality and task complexity)</li> <li>Hitting architecture limitations (consider a different model)</li>",ai,_e,hn,si,Ue,dn="Extremely low loss values could suggest memorization rather than learning. This is particularly concerning if:",li,je,$n="<li>The model performs poorly on new, similar examples</li> <li>The outputs lack diversity</li> <li>The responses are too similar to training examples</li>",ri,k,oi,ke,wn='We should note that the interpretation of the loss values we outline here is aimed on the most common case, and in fact, loss values can behave on various ways depending on the model, the dataset, the training parameters, etc. If you interested in exploring more about outlined patterns, you should check out this blog post by the people at <a href="https://www.fast.ai/posts/2023-09-04-learning-jumps/" rel="nofollow">Fast AI</a>.',pi,Je,mi,Fe,yn='In section <a href="/en/chapter11/4">11.4</a> we will learn how to evaluate the model using benchmark datasets. For now, we will focus on the qualitative evaluation of the model.',ui,Re,Tn="After completing SFT, consider these follow-up actions:",gi,Se,vn="<li>Evaluate the model thoroughly on held-out test data</li> <li>Validate template adherence across various inputs</li> <li>Test domain-specific knowledge retention</li> <li>Monitor real-world performance metrics</li>",fi,J,ci,Ie,hi,ze,di,Ee,$i,We,wi,Le,yi,He,Ti,qe,vi,Be,Mi,Ge,bi,Qe,Ci,Pe,xi,Ze,_i,Xe,Mn="You’ve learned how to fine-tune models using SFT! To continue your learning:",Ui,Ve,bn="<li>Try the notebook with different parameters</li> <li>Experiment with other datasets</li> <li>Contribute improvements to the course material</li>",ji,Ye,ki,Ae,Cn='<li><a href="https://huggingface.co/docs/trl" rel="nofollow">TRL Documentation</a></li> <li><a href="https://github.com/huggingface/trl/blob/main/trl/scripts/sft.py" rel="nofollow">SFT Examples Repository</a></li> <li><a href="https://huggingface.co/docs/transformers/training" rel="nofollow">Fine-tuning Best Practices</a></li>',Ji,Ne,Fi,et,Ri;return M=new Hn({props:{chapter:2,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/course/en/chapter11/section3.ipynb"}]}}),F=new $({props:{title:"Supervised Fine-Tuning",local:"supervised-fine-tuning",headingTag:"h1"}}),I=new $({props:{title:"When to Use SFT",local:"when-to-use-sft",headingTag:"h2"}}),C=new De({props:{$$slots:{default:[Bn]},$$scope:{ctx:y}}}),W=new $({props:{title:"Template Control",local:"template-control",headingTag:"h3"}}),q=new $({props:{title:"Domain Adaptation",local:"domain-adaptation",headingTag:"h3"}}),x=new De({props:{$$slots:{default:[Gn]},$$scope:{ctx:y}}}),Q=new $({props:{title:"Dataset Preparation",local:"dataset-preparation",headingTag:"h2"}}),V=new $({props:{title:"Training Configuration",local:"training-configuration",headingTag:"h2"}}),_=new De({props:{$$slots:{default:[Qn]},$$scope:{ctx:y}}}),D=new $({props:{title:"Implementation with TRL",local:"implementation-with-trl",headingTag:"h2"}}),O=new Ii({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBZnJvbSUyMHRybCUyMGltcG9ydCUyMFNGVENvbmZpZyUyQyUyMFNGVFRyYWluZXIlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUyMyUyMFNldCUyMGRldmljZSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjBpZiUyMHRvcmNoLmN1ZGEuaXNfYXZhaWxhYmxlKCklMjBlbHNlJTIwJTIyY3B1JTIyJTBBJTBBJTIzJTIwTG9hZCUyMGRhdGFzZXQlMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMkh1Z2dpbmdGYWNlVEIlMkZzbW9sdGFsayUyMiUyQyUyMCUyMmFsbCUyMiklMEElMEElMjMlMjBDb25maWd1cmUlMjB0cmFpbmVyJTBBdHJhaW5pbmdfYXJncyUyMCUzRCUyMFNGVENvbmZpZyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIyLiUyRnNmdF9vdXRwdXQlMjIlMkMlMEElMjAlMjAlMjAlMjBtYXhfc3RlcHMlM0QxMDAwJTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNENCUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q1ZS01JTJDJTBBJTIwJTIwJTIwJTIwbG9nZ2luZ19zdGVwcyUzRDEwJTJDJTBBJTIwJTIwJTIwJTIwc2F2ZV9zdGVwcyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfc3RyYXRlZ3klM0QlMjJzdGVwcyUyMiUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfc3RlcHMlM0Q1MCUyQyUwQSklMEElMEElMjMlMjBJbml0aWFsaXplJTIwdHJhaW5lciUwQXRyYWluZXIlMjAlM0QlMjBTRlRUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RkYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHByb2Nlc3NpbmdfY2xhc3MlM0R0b2tlbml6ZXIlMkMlMEEpJTBBJTBBJTIzJTIwU3RhcnQlMjB0cmFpbmluZyUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">from</span> trl <span class="hljs-keyword">import</span> SFTConfig, SFTTrainer
<span class="hljs-keyword">import</span> torch

<span class="hljs-comment"># Set device</span>
device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

<span class="hljs-comment"># Load dataset</span>
dataset = load_dataset(<span class="hljs-string">&quot;HuggingFaceTB/smoltalk&quot;</span>, <span class="hljs-string">&quot;all&quot;</span>)

<span class="hljs-comment"># Configure trainer</span>
training_args = SFTConfig(
    output_dir=<span class="hljs-string">&quot;./sft_output&quot;</span>,
    max_steps=<span class="hljs-number">1000</span>,
    per_device_train_batch_size=<span class="hljs-number">4</span>,
    learning_rate=<span class="hljs-number">5e-5</span>,
    logging_steps=<span class="hljs-number">10</span>,
    save_steps=<span class="hljs-number">100</span>,
    eval_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
    eval_steps=<span class="hljs-number">50</span>,
)

<span class="hljs-comment"># Initialize trainer</span>
trainer = SFTTrainer(
    model=model,
    args=training_args,
    train_dataset=dataset[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=dataset[<span class="hljs-string">&quot;test&quot;</span>],
    processing_class=tokenizer,
)

<span class="hljs-comment"># Start training</span>
trainer.train()`,wrap:!1}}),U=new De({props:{$$slots:{default:[Pn]},$$scope:{ctx:y}}}),ee=new $({props:{title:"Packing the Dataset",local:"packing-the-dataset",headingTag:"h2"}}),ie=new Ii({props:{code:"JTIzJTIwQ29uZmlndXJlJTIwcGFja2luZyUwQXRyYWluaW5nX2FyZ3MlMjAlM0QlMjBTRlRDb25maWcocGFja2luZyUzRFRydWUpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFNGVFRyYWluZXIobW9kZWwlM0Rtb2RlbCUyQyUyMHRyYWluX2RhdGFzZXQlM0RkYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyklMEElMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-comment"># Configure packing</span>
training_args = SFTConfig(packing=<span class="hljs-literal">True</span>)

trainer = SFTTrainer(model=model, train_dataset=dataset[<span class="hljs-string">&quot;train&quot;</span>], args=training_args)

trainer.train()`,wrap:!1}}),ae=new Ii({props:{code:"ZGVmJTIwZm9ybWF0dGluZ19mdW5jKGV4YW1wbGUpJTNBJTBBJTIwJTIwJTIwJTIwdGV4dCUyMCUzRCUyMGYlMjIlMjMlMjMlMjMlMjBRdWVzdGlvbiUzQSUyMCU3QmV4YW1wbGUlNUIncXVlc3Rpb24nJTVEJTdEJTVDbiUyMCUyMyUyMyUyMyUyMEFuc3dlciUzQSUyMCU3QmV4YW1wbGUlNUInYW5zd2VyJyU1RCU3RCUyMiUwQSUyMCUyMCUyMCUyMHJldHVybiUyMHRleHQlMEElMEElMEF0cmFpbmluZ19hcmdzJTIwJTNEJTIwU0ZUQ29uZmlnKHBhY2tpbmclM0RUcnVlKSUwQXRyYWluZXIlMjAlM0QlMjBTRlRUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMCUyMmZhY2Vib29rJTJGb3B0LTM1MG0lMjIlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEZGF0YXNldCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjBmb3JtYXR0aW5nX2Z1bmMlM0Rmb3JtYXR0aW5nX2Z1bmMlMkMlMEEp",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">formatting_func</span>(<span class="hljs-params">example</span>):
    text = <span class="hljs-string">f&quot;### Question: <span class="hljs-subst">{example[<span class="hljs-string">&#x27;question&#x27;</span>]}</span>\\n ### Answer: <span class="hljs-subst">{example[<span class="hljs-string">&#x27;answer&#x27;</span>]}</span>&quot;</span>
    <span class="hljs-keyword">return</span> text


training_args = SFTConfig(packing=<span class="hljs-literal">True</span>)
trainer = SFTTrainer(
    <span class="hljs-string">&quot;facebook/opt-350m&quot;</span>,
    train_dataset=dataset[<span class="hljs-string">&quot;train&quot;</span>],
    args=training_args,
    formatting_func=formatting_func,
)`,wrap:!1}}),se=new $({props:{title:"Monitoring Training Progress",local:"monitoring-training-progress",headingTag:"h2"}}),re=new $({props:{title:"Understanding Loss Patterns",local:"understanding-loss-patterns",headingTag:"h3"}}),ue=new $({props:{title:"Metrics to Monitor",local:"metrics-to-monitor",headingTag:"h3"}}),j=new De({props:{warning:!0,$$slots:{default:[Zn]},$$scope:{ctx:y}}}),ce=new $({props:{title:"The Path to Convergence",local:"the-path-to-convergence",headingTag:"h3"}}),de=new $({props:{title:"Monitoring Training Progress",local:"monitoring-training-progress",headingTag:"h3"}}),we=new $({props:{title:"Warning Signs to Watch For",local:"warning-signs-to-watch-for",headingTag:"h3"}}),k=new De({props:{warning:!0,$$slots:{default:[Xn]},$$scope:{ctx:y}}}),Je=new $({props:{title:"Evaluation after SFT",local:"evaluation-after-sft",headingTag:"h2"}}),J=new De({props:{$$slots:{default:[Vn]},$$scope:{ctx:y}}}),Ie=new $({props:{title:"Quiz",local:"quiz",headingTag:"h2"}}),ze=new $({props:{title:"1. What parameters control the training duration in SFT?",local:"1-what-parameters-control-the-training-duration-in-sft",headingTag:"h3"}}),Ee=new it({props:{choices:[{text:"num_train_epochs and max_steps",explain:"Correct! These parameters determine how long the model will train, either by number of epochs or total steps.",correct:!0},{text:"batch_size and learning_rate",explain:"While these affect training, they don't directly control the duration."},{text:"gradient_checkpointing and warmup_ratio",explain:"These parameters affect training efficiency and stability, not duration."}]}}),We=new $({props:{title:"2. Which pattern in the loss curves indicates potential overfitting?",local:"2-which-pattern-in-the-loss-curves-indicates-potential-overfitting",headingTag:"h3"}}),Le=new it({props:{choices:[{text:"Validation loss increases while training loss continues to decrease",explain:"Correct! This divergence between training and validation loss is a classic sign of overfitting.",correct:!0},{text:"Both training and validation loss decrease steadily",explain:"This pattern actually indicates healthy training."},{text:"Training loss remains constant while validation loss decreases",explain:"This would be an unusual pattern and doesn't indicate overfitting."}]}}),He=new $({props:{title:"3. What is gradient_accumulation_steps used for?",local:"3-what-is-gradientaccumulationsteps-used-for",headingTag:"h3"}}),qe=new it({props:{choices:[{text:"To increase effective batch size without using more memory",explain:"Correct! It accumulates gradients across multiple forward passes before updating weights.",correct:!0},{text:"To save checkpoints during training",explain:"This is handled by save_steps and save_strategy parameters."},{text:"To control the learning rate schedule",explain:"Learning rate scheduling is controlled by learning_rate and warmup_ratio."}]}}),Be=new $({props:{title:"4. What should you monitor during SFT training?",local:"4-what-should-you-monitor-during-sft-training",headingTag:"h3"}}),Ge=new it({props:{choices:[{text:"Both quantitative metrics and qualitative outputs",explain:"Correct! Monitoring both types of metrics helps catch all potential issues.",correct:!0},{text:"Only the training loss",explain:"Training loss alone isn't sufficient to ensure good model behavior."},{text:"Only the model's output quality",explain:"While important, qualitative evaluation alone misses important training dynamics."}]}}),Qe=new $({props:{title:"5. What indicates healthy convergence during training?",local:"5-what-indicates-healthy-convergence-during-training",headingTag:"h3"}}),Pe=new it({props:{choices:[{text:"A small gap between training and validation loss",explain:"Correct! This indicates the model is learning generalizable patterns.",correct:!0},{text:"Training loss reaching zero",explain:"Extremely low loss values might indicate memorization rather than learning."},{text:"Validation loss being lower than training loss",explain:"This would be unusual and might indicate problems with the validation set."}]}}),Ze=new $({props:{title:"💐 Nice work!",local:"-nice-work",headingTag:"h2"}}),Ye=new $({props:{title:"Additional Resources",local:"additional-resources",headingTag:"h2"}}),Ne=new qn({props:{source:"https://github.com/huggingface/course/blob/main/chapters/en/chapter11/3.mdx"}}),{c(){p=r("meta"),l=a(),w=r("p"),v=a(),m(M.$$.fragment),nt=a(),m(F.$$.fragment),at=a(),R=r("p"),R.textContent=zi,st=a(),S=r("p"),S.innerHTML=Ei,lt=a(),m(I.$$.fragment),rt=a(),z=r("p"),z.textContent=Wi,ot=a(),m(C.$$.fragment),pt=a(),E=r("p"),E.textContent=Li,mt=a(),m(W.$$.fragment),ut=a(),L=r("p"),L.textContent=Hi,gt=a(),H=r("ol"),H.innerHTML=qi,ft=a(),m(q.$$.fragment),ct=a(),B=r("p"),B.textContent=Bi,ht=a(),G=r("ol"),G.innerHTML=Gi,dt=a(),m(x.$$.fragment),$t=a(),m(Q.$$.fragment),wt=a(),P=r("p"),P.textContent=Qi,yt=a(),Z=r("ol"),Z.innerHTML=Pi,Tt=a(),X=r("p"),X.textContent=Zi,vt=a(),b=r("iframe"),Mt=a(),m(V.$$.fragment),bt=a(),Y=r("p"),Y.textContent=Vi,Ct=a(),A=r("p"),A.textContent=Yi,xt=a(),N=r("ol"),N.innerHTML=Ai,_t=a(),m(_.$$.fragment),Ut=a(),m(D.$$.fragment),jt=a(),K=r("p"),K.innerHTML=Ni,kt=a(),m(O.$$.fragment),Jt=a(),m(U.$$.fragment),Ft=a(),m(ee.$$.fragment),Rt=a(),te=r("p"),te.innerHTML=Di,St=a(),m(ie.$$.fragment),It=a(),ne=r("p"),ne.textContent=Ki,zt=a(),m(ae.$$.fragment),Et=a(),m(se.$$.fragment),Wt=a(),le=r("p"),le.textContent=Oi,Lt=a(),m(re.$$.fragment),Ht=a(),oe=r("p"),oe.textContent=en,qt=a(),pe=r("ol"),pe.innerHTML=tn,Bt=a(),me=r("img"),Gt=a(),m(ue.$$.fragment),Qt=a(),ge=r("p"),ge.textContent=an,Pt=a(),fe=r("ul"),fe.innerHTML=sn,Zt=a(),m(j.$$.fragment),Xt=a(),m(ce.$$.fragment),Vt=a(),he=r("p"),he.textContent=ln,Yt=a(),m(de.$$.fragment),At=a(),$e=r("p"),$e.textContent=rn,Nt=a(),m(we.$$.fragment),Dt=a(),ye=r("p"),ye.textContent=on,Kt=a(),Te=r("img"),Ot=a(),ve=r("p"),ve.textContent=mn,ei=a(),Me=r("ul"),Me.innerHTML=un,ti=a(),be=r("img"),ii=a(),Ce=r("p"),Ce.textContent=fn,ni=a(),xe=r("ul"),xe.innerHTML=cn,ai=a(),_e=r("img"),si=a(),Ue=r("p"),Ue.textContent=dn,li=a(),je=r("ul"),je.innerHTML=$n,ri=a(),m(k.$$.fragment),oi=a(),ke=r("p"),ke.innerHTML=wn,pi=a(),m(Je.$$.fragment),mi=a(),Fe=r("p"),Fe.innerHTML=yn,ui=a(),Re=r("p"),Re.textContent=Tn,gi=a(),Se=r("ol"),Se.innerHTML=vn,fi=a(),m(J.$$.fragment),ci=a(),m(Ie.$$.fragment),hi=a(),m(ze.$$.fragment),di=a(),m(Ee.$$.fragment),$i=a(),m(We.$$.fragment),wi=a(),m(Le.$$.fragment),yi=a(),m(He.$$.fragment),Ti=a(),m(qe.$$.fragment),vi=a(),m(Be.$$.fragment),Mi=a(),m(Ge.$$.fragment),bi=a(),m(Qe.$$.fragment),Ci=a(),m(Pe.$$.fragment),xi=a(),m(Ze.$$.fragment),_i=a(),Xe=r("p"),Xe.textContent=Mn,Ui=a(),Ve=r("ol"),Ve.innerHTML=bn,ji=a(),m(Ye.$$.fragment),ki=a(),Ae=r("ul"),Ae.innerHTML=Cn,Ji=a(),m(Ne.$$.fragment),Fi=a(),et=r("p"),this.h()},l(e){const t=Wn("svelte-u9bgzb",document.head);p=o(t,"META",{name:!0,content:!0}),t.forEach(i),l=s(e),w=o(e,"P",{}),Si(w).forEach(i),v=s(e),u(M.$$.fragment,e),nt=s(e),u(F.$$.fragment,e),at=s(e),R=o(e,"P",{"data-svelte-h":!0}),d(R)!=="svelte-1r3e85q"&&(R.textContent=zi),st=s(e),S=o(e,"P",{"data-svelte-h":!0}),d(S)!=="svelte-1lbymgt"&&(S.innerHTML=Ei),lt=s(e),u(I.$$.fragment,e),rt=s(e),z=o(e,"P",{"data-svelte-h":!0}),d(z)!=="svelte-bzr0f8"&&(z.textContent=Wi),ot=s(e),u(C.$$.fragment,e),pt=s(e),E=o(e,"P",{"data-svelte-h":!0}),d(E)!=="svelte-1vu1858"&&(E.textContent=Li),mt=s(e),u(W.$$.fragment,e),ut=s(e),L=o(e,"P",{"data-svelte-h":!0}),d(L)!=="svelte-vqqipn"&&(L.textContent=Hi),gt=s(e),H=o(e,"OL",{"data-svelte-h":!0}),d(H)!=="svelte-f2jeai"&&(H.innerHTML=qi),ft=s(e),u(q.$$.fragment,e),ct=s(e),B=o(e,"P",{"data-svelte-h":!0}),d(B)!=="svelte-63mafi"&&(B.textContent=Bi),ht=s(e),G=o(e,"OL",{"data-svelte-h":!0}),d(G)!=="svelte-14ez77z"&&(G.innerHTML=Gi),dt=s(e),u(x.$$.fragment,e),$t=s(e),u(Q.$$.fragment,e),wt=s(e),P=o(e,"P",{"data-svelte-h":!0}),d(P)!=="svelte-1gnb02p"&&(P.textContent=Qi),yt=s(e),Z=o(e,"OL",{"data-svelte-h":!0}),d(Z)!=="svelte-1vwaxbl"&&(Z.innerHTML=Pi),Tt=s(e),X=o(e,"P",{"data-svelte-h":!0}),d(X)!=="svelte-irg7th"&&(X.textContent=Zi),vt=s(e),b=o(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),Si(b).forEach(i),Mt=s(e),u(V.$$.fragment,e),bt=s(e),Y=o(e,"P",{"data-svelte-h":!0}),d(Y)!=="svelte-ioywgh"&&(Y.textContent=Vi),Ct=s(e),A=o(e,"P",{"data-svelte-h":!0}),d(A)!=="svelte-14sqfj"&&(A.textContent=Yi),xt=s(e),N=o(e,"OL",{"data-svelte-h":!0}),d(N)!=="svelte-6ztbbs"&&(N.innerHTML=Ai),_t=s(e),u(_.$$.fragment,e),Ut=s(e),u(D.$$.fragment,e),jt=s(e),K=o(e,"P",{"data-svelte-h":!0}),d(K)!=="svelte-grvvks"&&(K.innerHTML=Ni),kt=s(e),u(O.$$.fragment,e),Jt=s(e),u(U.$$.fragment,e),Ft=s(e),u(ee.$$.fragment,e),Rt=s(e),te=o(e,"P",{"data-svelte-h":!0}),d(te)!=="svelte-1nxebfc"&&(te.innerHTML=Di),St=s(e),u(ie.$$.fragment,e),It=s(e),ne=o(e,"P",{"data-svelte-h":!0}),d(ne)!=="svelte-c7t1n6"&&(ne.textContent=Ki),zt=s(e),u(ae.$$.fragment,e),Et=s(e),u(se.$$.fragment,e),Wt=s(e),le=o(e,"P",{"data-svelte-h":!0}),d(le)!=="svelte-muo025"&&(le.textContent=Oi),Lt=s(e),u(re.$$.fragment,e),Ht=s(e),oe=o(e,"P",{"data-svelte-h":!0}),d(oe)!=="svelte-1kxz6c2"&&(oe.textContent=en),qt=s(e),pe=o(e,"OL",{"data-svelte-h":!0}),d(pe)!=="svelte-12kgh6p"&&(pe.innerHTML=tn),Bt=s(e),me=o(e,"IMG",{src:!0,alt:!0}),Gt=s(e),u(ue.$$.fragment,e),Qt=s(e),ge=o(e,"P",{"data-svelte-h":!0}),d(ge)!=="svelte-1y9ggj5"&&(ge.textContent=an),Pt=s(e),fe=o(e,"UL",{"data-svelte-h":!0}),d(fe)!=="svelte-acv7jp"&&(fe.innerHTML=sn),Zt=s(e),u(j.$$.fragment,e),Xt=s(e),u(ce.$$.fragment,e),Vt=s(e),he=o(e,"P",{"data-svelte-h":!0}),d(he)!=="svelte-ie5i5"&&(he.textContent=ln),Yt=s(e),u(de.$$.fragment,e),At=s(e),$e=o(e,"P",{"data-svelte-h":!0}),d($e)!=="svelte-1s6faap"&&($e.textContent=rn),Nt=s(e),u(we.$$.fragment,e),Dt=s(e),ye=o(e,"P",{"data-svelte-h":!0}),d(ye)!=="svelte-1yge1oh"&&(ye.textContent=on),Kt=s(e),Te=o(e,"IMG",{src:!0,alt:!0}),Ot=s(e),ve=o(e,"P",{"data-svelte-h":!0}),d(ve)!=="svelte-13ggrtv"&&(ve.textContent=mn),ei=s(e),Me=o(e,"UL",{"data-svelte-h":!0}),d(Me)!=="svelte-1a305az"&&(Me.innerHTML=un),ti=s(e),be=o(e,"IMG",{src:!0,alt:!0}),ii=s(e),Ce=o(e,"P",{"data-svelte-h":!0}),d(Ce)!=="svelte-176u6kl"&&(Ce.textContent=fn),ni=s(e),xe=o(e,"UL",{"data-svelte-h":!0}),d(xe)!=="svelte-1dkaf9f"&&(xe.innerHTML=cn),ai=s(e),_e=o(e,"IMG",{src:!0,alt:!0}),si=s(e),Ue=o(e,"P",{"data-svelte-h":!0}),d(Ue)!=="svelte-ilfaf"&&(Ue.textContent=dn),li=s(e),je=o(e,"UL",{"data-svelte-h":!0}),d(je)!=="svelte-99mvik"&&(je.innerHTML=$n),ri=s(e),u(k.$$.fragment,e),oi=s(e),ke=o(e,"P",{"data-svelte-h":!0}),d(ke)!=="svelte-ttgvgc"&&(ke.innerHTML=wn),pi=s(e),u(Je.$$.fragment,e),mi=s(e),Fe=o(e,"P",{"data-svelte-h":!0}),d(Fe)!=="svelte-1rfoj7z"&&(Fe.innerHTML=yn),ui=s(e),Re=o(e,"P",{"data-svelte-h":!0}),d(Re)!=="svelte-1028cbr"&&(Re.textContent=Tn),gi=s(e),Se=o(e,"OL",{"data-svelte-h":!0}),d(Se)!=="svelte-1irg2q8"&&(Se.innerHTML=vn),fi=s(e),u(J.$$.fragment,e),ci=s(e),u(Ie.$$.fragment,e),hi=s(e),u(ze.$$.fragment,e),di=s(e),u(Ee.$$.fragment,e),$i=s(e),u(We.$$.fragment,e),wi=s(e),u(Le.$$.fragment,e),yi=s(e),u(He.$$.fragment,e),Ti=s(e),u(qe.$$.fragment,e),vi=s(e),u(Be.$$.fragment,e),Mi=s(e),u(Ge.$$.fragment,e),bi=s(e),u(Qe.$$.fragment,e),Ci=s(e),u(Pe.$$.fragment,e),xi=s(e),u(Ze.$$.fragment,e),_i=s(e),Xe=o(e,"P",{"data-svelte-h":!0}),d(Xe)!=="svelte-11s8azl"&&(Xe.textContent=Mn),Ui=s(e),Ve=o(e,"OL",{"data-svelte-h":!0}),d(Ve)!=="svelte-eabkx7"&&(Ve.innerHTML=bn),ji=s(e),u(Ye.$$.fragment,e),ki=s(e),Ae=o(e,"UL",{"data-svelte-h":!0}),d(Ae)!=="svelte-1qwbi4x"&&(Ae.innerHTML=Cn),Ji=s(e),u(Ne.$$.fragment,e),Fi=s(e),et=o(e,"P",{}),Si(et).forEach(i),this.h()},h(){T(p,"name","hf:doc:metadata"),T(p,"content",An),tt(b.src,Xi="https://huggingface.co/datasets/HuggingFaceTB/smoltalk/embed/viewer/all/train?row=0")||T(b,"src",Xi),T(b,"frameborder","0"),T(b,"width","100%"),T(b,"height","360px"),tt(me.src,nn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/nlp_course_sft_loss_graphic.png")||T(me,"src",nn),T(me,"alt","SFTTrainer Training"),tt(Te.src,pn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sft_loss_1.png")||T(Te,"src",pn),T(Te,"alt","SFTTrainer Training"),tt(be.src,gn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sft_loss_2.png")||T(be,"src",gn),T(be,"alt","SFTTrainer Training"),tt(_e.src,hn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sft_loss_3.png")||T(_e,"src",hn),T(_e,"alt","SFTTrainer Training")},m(e,t){Ln(document.head,p),n(e,l,t),n(e,w,t),n(e,v,t),g(M,e,t),n(e,nt,t),g(F,e,t),n(e,at,t),n(e,R,t),n(e,st,t),n(e,S,t),n(e,lt,t),g(I,e,t),n(e,rt,t),n(e,z,t),n(e,ot,t),g(C,e,t),n(e,pt,t),n(e,E,t),n(e,mt,t),g(W,e,t),n(e,ut,t),n(e,L,t),n(e,gt,t),n(e,H,t),n(e,ft,t),g(q,e,t),n(e,ct,t),n(e,B,t),n(e,ht,t),n(e,G,t),n(e,dt,t),g(x,e,t),n(e,$t,t),g(Q,e,t),n(e,wt,t),n(e,P,t),n(e,yt,t),n(e,Z,t),n(e,Tt,t),n(e,X,t),n(e,vt,t),n(e,b,t),n(e,Mt,t),g(V,e,t),n(e,bt,t),n(e,Y,t),n(e,Ct,t),n(e,A,t),n(e,xt,t),n(e,N,t),n(e,_t,t),g(_,e,t),n(e,Ut,t),g(D,e,t),n(e,jt,t),n(e,K,t),n(e,kt,t),g(O,e,t),n(e,Jt,t),g(U,e,t),n(e,Ft,t),g(ee,e,t),n(e,Rt,t),n(e,te,t),n(e,St,t),g(ie,e,t),n(e,It,t),n(e,ne,t),n(e,zt,t),g(ae,e,t),n(e,Et,t),g(se,e,t),n(e,Wt,t),n(e,le,t),n(e,Lt,t),g(re,e,t),n(e,Ht,t),n(e,oe,t),n(e,qt,t),n(e,pe,t),n(e,Bt,t),n(e,me,t),n(e,Gt,t),g(ue,e,t),n(e,Qt,t),n(e,ge,t),n(e,Pt,t),n(e,fe,t),n(e,Zt,t),g(j,e,t),n(e,Xt,t),g(ce,e,t),n(e,Vt,t),n(e,he,t),n(e,Yt,t),g(de,e,t),n(e,At,t),n(e,$e,t),n(e,Nt,t),g(we,e,t),n(e,Dt,t),n(e,ye,t),n(e,Kt,t),n(e,Te,t),n(e,Ot,t),n(e,ve,t),n(e,ei,t),n(e,Me,t),n(e,ti,t),n(e,be,t),n(e,ii,t),n(e,Ce,t),n(e,ni,t),n(e,xe,t),n(e,ai,t),n(e,_e,t),n(e,si,t),n(e,Ue,t),n(e,li,t),n(e,je,t),n(e,ri,t),g(k,e,t),n(e,oi,t),n(e,ke,t),n(e,pi,t),g(Je,e,t),n(e,mi,t),n(e,Fe,t),n(e,ui,t),n(e,Re,t),n(e,gi,t),n(e,Se,t),n(e,fi,t),g(J,e,t),n(e,ci,t),g(Ie,e,t),n(e,hi,t),g(ze,e,t),n(e,di,t),g(Ee,e,t),n(e,$i,t),g(We,e,t),n(e,wi,t),g(Le,e,t),n(e,yi,t),g(He,e,t),n(e,Ti,t),g(qe,e,t),n(e,vi,t),g(Be,e,t),n(e,Mi,t),g(Ge,e,t),n(e,bi,t),g(Qe,e,t),n(e,Ci,t),g(Pe,e,t),n(e,xi,t),g(Ze,e,t),n(e,_i,t),n(e,Xe,t),n(e,Ui,t),n(e,Ve,t),n(e,ji,t),g(Ye,e,t),n(e,ki,t),n(e,Ae,t),n(e,Ji,t),g(Ne,e,t),n(e,Fi,t),n(e,et,t),Ri=!0},p(e,[t]){const xn={};t&2&&(xn.$$scope={dirty:t,ctx:e}),C.$set(xn);const _n={};t&2&&(_n.$$scope={dirty:t,ctx:e}),x.$set(_n);const Un={};t&2&&(Un.$$scope={dirty:t,ctx:e}),_.$set(Un);const jn={};t&2&&(jn.$$scope={dirty:t,ctx:e}),U.$set(jn);const kn={};t&2&&(kn.$$scope={dirty:t,ctx:e}),j.$set(kn);const Jn={};t&2&&(Jn.$$scope={dirty:t,ctx:e}),k.$set(Jn);const Fn={};t&2&&(Fn.$$scope={dirty:t,ctx:e}),J.$set(Fn)},i(e){Ri||(f(M.$$.fragment,e),f(F.$$.fragment,e),f(I.$$.fragment,e),f(C.$$.fragment,e),f(W.$$.fragment,e),f(q.$$.fragment,e),f(x.$$.fragment,e),f(Q.$$.fragment,e),f(V.$$.fragment,e),f(_.$$.fragment,e),f(D.$$.fragment,e),f(O.$$.fragment,e),f(U.$$.fragment,e),f(ee.$$.fragment,e),f(ie.$$.fragment,e),f(ae.$$.fragment,e),f(se.$$.fragment,e),f(re.$$.fragment,e),f(ue.$$.fragment,e),f(j.$$.fragment,e),f(ce.$$.fragment,e),f(de.$$.fragment,e),f(we.$$.fragment,e),f(k.$$.fragment,e),f(Je.$$.fragment,e),f(J.$$.fragment,e),f(Ie.$$.fragment,e),f(ze.$$.fragment,e),f(Ee.$$.fragment,e),f(We.$$.fragment,e),f(Le.$$.fragment,e),f(He.$$.fragment,e),f(qe.$$.fragment,e),f(Be.$$.fragment,e),f(Ge.$$.fragment,e),f(Qe.$$.fragment,e),f(Pe.$$.fragment,e),f(Ze.$$.fragment,e),f(Ye.$$.fragment,e),f(Ne.$$.fragment,e),Ri=!0)},o(e){c(M.$$.fragment,e),c(F.$$.fragment,e),c(I.$$.fragment,e),c(C.$$.fragment,e),c(W.$$.fragment,e),c(q.$$.fragment,e),c(x.$$.fragment,e),c(Q.$$.fragment,e),c(V.$$.fragment,e),c(_.$$.fragment,e),c(D.$$.fragment,e),c(O.$$.fragment,e),c(U.$$.fragment,e),c(ee.$$.fragment,e),c(ie.$$.fragment,e),c(ae.$$.fragment,e),c(se.$$.fragment,e),c(re.$$.fragment,e),c(ue.$$.fragment,e),c(j.$$.fragment,e),c(ce.$$.fragment,e),c(de.$$.fragment,e),c(we.$$.fragment,e),c(k.$$.fragment,e),c(Je.$$.fragment,e),c(J.$$.fragment,e),c(Ie.$$.fragment,e),c(ze.$$.fragment,e),c(Ee.$$.fragment,e),c(We.$$.fragment,e),c(Le.$$.fragment,e),c(He.$$.fragment,e),c(qe.$$.fragment,e),c(Be.$$.fragment,e),c(Ge.$$.fragment,e),c(Qe.$$.fragment,e),c(Pe.$$.fragment,e),c(Ze.$$.fragment,e),c(Ye.$$.fragment,e),c(Ne.$$.fragment,e),Ri=!1},d(e){e&&(i(l),i(w),i(v),i(nt),i(at),i(R),i(st),i(S),i(lt),i(rt),i(z),i(ot),i(pt),i(E),i(mt),i(ut),i(L),i(gt),i(H),i(ft),i(ct),i(B),i(ht),i(G),i(dt),i($t),i(wt),i(P),i(yt),i(Z),i(Tt),i(X),i(vt),i(b),i(Mt),i(bt),i(Y),i(Ct),i(A),i(xt),i(N),i(_t),i(Ut),i(jt),i(K),i(kt),i(Jt),i(Ft),i(Rt),i(te),i(St),i(It),i(ne),i(zt),i(Et),i(Wt),i(le),i(Lt),i(Ht),i(oe),i(qt),i(pe),i(Bt),i(me),i(Gt),i(Qt),i(ge),i(Pt),i(fe),i(Zt),i(Xt),i(Vt),i(he),i(Yt),i(At),i($e),i(Nt),i(Dt),i(ye),i(Kt),i(Te),i(Ot),i(ve),i(ei),i(Me),i(ti),i(be),i(ii),i(Ce),i(ni),i(xe),i(ai),i(_e),i(si),i(Ue),i(li),i(je),i(ri),i(oi),i(ke),i(pi),i(mi),i(Fe),i(ui),i(Re),i(gi),i(Se),i(fi),i(ci),i(hi),i(di),i($i),i(wi),i(yi),i(Ti),i(vi),i(Mi),i(bi),i(Ci),i(xi),i(_i),i(Xe),i(Ui),i(Ve),i(ji),i(ki),i(Ae),i(Ji),i(Fi),i(et)),i(p),h(M,e),h(F,e),h(I,e),h(C,e),h(W,e),h(q,e),h(x,e),h(Q,e),h(V,e),h(_,e),h(D,e),h(O,e),h(U,e),h(ee,e),h(ie,e),h(ae,e),h(se,e),h(re,e),h(ue,e),h(j,e),h(ce,e),h(de,e),h(we,e),h(k,e),h(Je,e),h(J,e),h(Ie,e),h(ze,e),h(Ee,e),h(We,e),h(Le,e),h(He,e),h(qe,e),h(Be,e),h(Ge,e),h(Qe,e),h(Pe,e),h(Ze,e),h(Ye,e),h(Ne,e)}}}const An='{"title":"Supervised Fine-Tuning","local":"supervised-fine-tuning","sections":[{"title":"When to Use SFT","local":"when-to-use-sft","sections":[{"title":"Template Control","local":"template-control","sections":[],"depth":3},{"title":"Domain Adaptation","local":"domain-adaptation","sections":[],"depth":3}],"depth":2},{"title":"Dataset Preparation","local":"dataset-preparation","sections":[],"depth":2},{"title":"Training Configuration","local":"training-configuration","sections":[],"depth":2},{"title":"Implementation with TRL","local":"implementation-with-trl","sections":[],"depth":2},{"title":"Packing the Dataset","local":"packing-the-dataset","sections":[],"depth":2},{"title":"Monitoring Training Progress","local":"monitoring-training-progress","sections":[{"title":"Understanding Loss Patterns","local":"understanding-loss-patterns","sections":[],"depth":3},{"title":"Metrics to Monitor","local":"metrics-to-monitor","sections":[],"depth":3},{"title":"The Path to Convergence","local":"the-path-to-convergence","sections":[],"depth":3},{"title":"Monitoring Training Progress","local":"monitoring-training-progress","sections":[],"depth":3},{"title":"Warning Signs to Watch For","local":"warning-signs-to-watch-for","sections":[],"depth":3}],"depth":2},{"title":"Evaluation after SFT","local":"evaluation-after-sft","sections":[],"depth":2},{"title":"Quiz","local":"quiz","sections":[{"title":"1. What parameters control the training duration in SFT?","local":"1-what-parameters-control-the-training-duration-in-sft","sections":[],"depth":3},{"title":"2. Which pattern in the loss curves indicates potential overfitting?","local":"2-which-pattern-in-the-loss-curves-indicates-potential-overfitting","sections":[],"depth":3},{"title":"3. What is gradient_accumulation_steps used for?","local":"3-what-is-gradientaccumulationsteps-used-for","sections":[],"depth":3},{"title":"4. What should you monitor during SFT training?","local":"4-what-should-you-monitor-during-sft-training","sections":[],"depth":3},{"title":"5. What indicates healthy convergence during training?","local":"5-what-indicates-healthy-convergence-during-training","sections":[],"depth":3}],"depth":2},{"title":"💐 Nice work!","local":"-nice-work","sections":[],"depth":2},{"title":"Additional Resources","local":"additional-resources","sections":[],"depth":2}],"depth":1}';function Nn(y){return Sn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class aa extends zn{constructor(p){super(),En(this,p,Nn,Yn,Rn,{})}}export{aa as component};
