import{s as Rn,f as tt,o as Sn,n as zn}from"../chunks/scheduler.37c15a92.js";import{S as In,i as Wn,g as r,s as a,r as m,A as Bn,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 zi}from"../chunks/CodeBlock.4e987730.js";import{C as En}from"../chunks/CourseFloatingBanner.15ba07e6.js";import{Q as it}from"../chunks/Question.668688bc.js";import{H as $,E as Hn}from"../chunks/index.fb305b5e.js";function qn(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:zn,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 Zn(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 Pn(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 An(y){let p,l,w,v,M,nt,F,at,R,Ii="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,Wi='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,z,rt,I,Bi="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,W,Li="If you determine that SFT is necessary, the decision to proceed depends on two primary factors:",mt,B,ut,L,Ei="SFT allows precise control over the model’s output structure. This is particularly valuable when you need the model to:",gt,E,Hi="<li>Generate responses in a specific chat template format</li> <li>Follow strict output schemas</li> <li>Maintain consistent styling across responses</li>",ft,H,ct,q,qi="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,Z,Qi="The supervised fine-tuning process requires a task-specific dataset structured with input-output pairs. Each pair should consist of:",yt,P,Zi="<li>An input prompt</li> <li>The expected model response</li> <li>Any additional context or metadata</li>",Tt,X,Pi="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,A,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,Y,Ai="The SFTTrainer configuration requires consideration of several parameters that control the training process. Let’s explore each parameter and their purpose:",xt,N,Yi="<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,kt,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:",Jt,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,zt,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:",It,ae,Wt,se,Bt,le,Oi="Effective monitoring is crucial for successful fine-tuning. Let’s explore what to watch for during training:",Lt,re,Et,oe,en="Training loss typically follows three distinct phases:",Ht,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>",qt,me,nn,Gt,ue,Qt,ge,an="Effective monitoring involves tracking quantitative metrics, and evaluating qualitative metrics. Available metrics are:",Zt,fe,sn="<li>Training loss</li> <li>Validation loss</li> <li>Learning rate progression</li> <li>Gradient norms</li>",Pt,k,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.`,At,de,Yt,$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,ke,$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,J,oi,Je,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,ze,hi,Ie,di,We,$i,Be,wi,Le,yi,Ee,Ti,He,vi,qe,Mi,Ge,bi,Qe,Ci,Ze,xi,Pe,_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>",ki,Ae,Ji,Ye,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 En({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"}}),z=new $({props:{title:"When to Use SFT",local:"when-to-use-sft",headingTag:"h2"}}),C=new De({props:{$$slots:{default:[qn]},$$scope:{ctx:y}}}),B=new $({props:{title:"Template Control",local:"template-control",headingTag:"h3"}}),H=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 zi({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:[Zn]},$$scope:{ctx:y}}}),ee=new $({props:{title:"Packing the Dataset",local:"packing-the-dataset",headingTag:"h2"}}),ie=new zi({props:{code:"JTIzJTIwQ29uZmlndXJlJTIwcGFja2luZyUwQXRyYWluaW5nX2FyZ3MlMjAlM0QlMjBTRlRDb25maWcocGFja2luZyUzRFRydWUpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFNGVFRyYWluZXIobW9kZWwlM0Rtb2RlbCUyQyUyMHRyYWluX2RhdGFzZXQlM0RkYXRhc2V0JTJDJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MpJTBBJTBBdHJhaW5lci50cmFpbigp",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, args=training_args)

trainer.train()`,wrap:!1}}),ae=new zi({props:{code:"ZGVmJTIwZm9ybWF0dGluZ19mdW5jKGV4YW1wbGUpJTNBJTBBJTIwJTIwJTIwJTIwdGV4dCUyMCUzRCUyMGYlMjIlMjMlMjMlMjMlMjBRdWVzdGlvbiUzQSUyMCU3QmV4YW1wbGUlNUIncXVlc3Rpb24nJTVEJTdEJTVDbiUyMCUyMyUyMyUyMyUyMEFuc3dlciUzQSUyMCU3QmV4YW1wbGUlNUInYW5zd2VyJyU1RCU3RCUyMiUwQSUyMCUyMCUyMCUyMHJldHVybiUyMHRleHQlMEElMEElMEF0cmFpbmluZ19hcmdzJTIwJTNEJTIwU0ZUQ29uZmlnKHBhY2tpbmclM0RUcnVlKSUwQXRyYWluZXIlMjAlM0QlMjBTRlRUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMCUyMmZhY2Vib29rJTJGb3B0LTM1MG0lMjIlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEZGF0YXNldCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwZm9ybWF0dGluZ19mdW5jJTNEZm9ybWF0dGluZ19mdW5jJTJDJTBBKQ==",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,
    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"}}),k=new De({props:{warning:!0,$$slots:{default:[Pn]},$$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"}}),J=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}}}),ze=new $({props:{title:"Quiz",local:"quiz",headingTag:"h2"}}),Ie=new $({props:{title:"1. What parameters control the training duration in SFT?",local:"1-what-parameters-control-the-training-duration-in-sft",headingTag:"h3"}}),We=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."}]}}),Be=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."}]}}),Ee=new $({props:{title:"3. What is gradient_accumulation_steps used for?",local:"3-what-is-gradientaccumulationsteps-used-for",headingTag:"h3"}}),He=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."}]}}),qe=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"}}),Ze=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."}]}}),Pe=new $({props:{title:"💐 Nice work!",local:"-nice-work",headingTag:"h2"}}),Ae=new $({props:{title:"Additional Resources",local:"additional-resources",headingTag:"h2"}}),Ne=new Hn({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=Ii,st=a(),S=r("p"),S.innerHTML=Wi,lt=a(),m(z.$$.fragment),rt=a(),I=r("p"),I.textContent=Bi,ot=a(),m(C.$$.fragment),pt=a(),W=r("p"),W.textContent=Li,mt=a(),m(B.$$.fragment),ut=a(),L=r("p"),L.textContent=Ei,gt=a(),E=r("ol"),E.innerHTML=Hi,ft=a(),m(H.$$.fragment),ct=a(),q=r("p"),q.textContent=qi,ht=a(),G=r("ol"),G.innerHTML=Gi,dt=a(),m(x.$$.fragment),$t=a(),m(Q.$$.fragment),wt=a(),Z=r("p"),Z.textContent=Qi,yt=a(),P=r("ol"),P.innerHTML=Zi,Tt=a(),X=r("p"),X.textContent=Pi,vt=a(),b=r("iframe"),Mt=a(),m(V.$$.fragment),bt=a(),A=r("p"),A.textContent=Vi,Ct=a(),Y=r("p"),Y.textContent=Ai,xt=a(),N=r("ol"),N.innerHTML=Yi,_t=a(),m(_.$$.fragment),Ut=a(),m(D.$$.fragment),kt=a(),K=r("p"),K.innerHTML=Ni,Jt=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),zt=a(),ne=r("p"),ne.textContent=Ki,It=a(),m(ae.$$.fragment),Wt=a(),m(se.$$.fragment),Bt=a(),le=r("p"),le.textContent=Oi,Lt=a(),m(re.$$.fragment),Et=a(),oe=r("p"),oe.textContent=en,Ht=a(),pe=r("ol"),pe.innerHTML=tn,qt=a(),me=r("img"),Gt=a(),m(ue.$$.fragment),Qt=a(),ge=r("p"),ge.textContent=an,Zt=a(),fe=r("ul"),fe.innerHTML=sn,Pt=a(),m(k.$$.fragment),Xt=a(),m(ce.$$.fragment),Vt=a(),he=r("p"),he.textContent=ln,At=a(),m(de.$$.fragment),Yt=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(),ke=r("ul"),ke.innerHTML=$n,ri=a(),m(J.$$.fragment),oi=a(),Je=r("p"),Je.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(ze.$$.fragment),hi=a(),m(Ie.$$.fragment),di=a(),m(We.$$.fragment),$i=a(),m(Be.$$.fragment),wi=a(),m(Le.$$.fragment),yi=a(),m(Ee.$$.fragment),Ti=a(),m(He.$$.fragment),vi=a(),m(qe.$$.fragment),Mi=a(),m(Ge.$$.fragment),bi=a(),m(Qe.$$.fragment),Ci=a(),m(Ze.$$.fragment),xi=a(),m(Pe.$$.fragment),_i=a(),Xe=r("p"),Xe.textContent=Mn,Ui=a(),Ve=r("ol"),Ve.innerHTML=bn,ki=a(),m(Ae.$$.fragment),Ji=a(),Ye=r("ul"),Ye.innerHTML=Cn,ji=a(),m(Ne.$$.fragment),Fi=a(),et=r("p"),this.h()},l(e){const t=Bn("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=Ii),st=s(e),S=o(e,"P",{"data-svelte-h":!0}),d(S)!=="svelte-1lbymgt"&&(S.innerHTML=Wi),lt=s(e),u(z.$$.fragment,e),rt=s(e),I=o(e,"P",{"data-svelte-h":!0}),d(I)!=="svelte-bzr0f8"&&(I.textContent=Bi),ot=s(e),u(C.$$.fragment,e),pt=s(e),W=o(e,"P",{"data-svelte-h":!0}),d(W)!=="svelte-1vu1858"&&(W.textContent=Li),mt=s(e),u(B.$$.fragment,e),ut=s(e),L=o(e,"P",{"data-svelte-h":!0}),d(L)!=="svelte-vqqipn"&&(L.textContent=Ei),gt=s(e),E=o(e,"OL",{"data-svelte-h":!0}),d(E)!=="svelte-f2jeai"&&(E.innerHTML=Hi),ft=s(e),u(H.$$.fragment,e),ct=s(e),q=o(e,"P",{"data-svelte-h":!0}),d(q)!=="svelte-63mafi"&&(q.textContent=qi),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),Z=o(e,"P",{"data-svelte-h":!0}),d(Z)!=="svelte-1gnb02p"&&(Z.textContent=Qi),yt=s(e),P=o(e,"OL",{"data-svelte-h":!0}),d(P)!=="svelte-1vwaxbl"&&(P.innerHTML=Zi),Tt=s(e),X=o(e,"P",{"data-svelte-h":!0}),d(X)!=="svelte-irg7th"&&(X.textContent=Pi),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),A=o(e,"P",{"data-svelte-h":!0}),d(A)!=="svelte-ioywgh"&&(A.textContent=Vi),Ct=s(e),Y=o(e,"P",{"data-svelte-h":!0}),d(Y)!=="svelte-14sqfj"&&(Y.textContent=Ai),xt=s(e),N=o(e,"OL",{"data-svelte-h":!0}),d(N)!=="svelte-6ztbbs"&&(N.innerHTML=Yi),_t=s(e),u(_.$$.fragment,e),Ut=s(e),u(D.$$.fragment,e),kt=s(e),K=o(e,"P",{"data-svelte-h":!0}),d(K)!=="svelte-grvvks"&&(K.innerHTML=Ni),Jt=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),zt=s(e),ne=o(e,"P",{"data-svelte-h":!0}),d(ne)!=="svelte-c7t1n6"&&(ne.textContent=Ki),It=s(e),u(ae.$$.fragment,e),Wt=s(e),u(se.$$.fragment,e),Bt=s(e),le=o(e,"P",{"data-svelte-h":!0}),d(le)!=="svelte-muo025"&&(le.textContent=Oi),Lt=s(e),u(re.$$.fragment,e),Et=s(e),oe=o(e,"P",{"data-svelte-h":!0}),d(oe)!=="svelte-1kxz6c2"&&(oe.textContent=en),Ht=s(e),pe=o(e,"OL",{"data-svelte-h":!0}),d(pe)!=="svelte-12kgh6p"&&(pe.innerHTML=tn),qt=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),Zt=s(e),fe=o(e,"UL",{"data-svelte-h":!0}),d(fe)!=="svelte-acv7jp"&&(fe.innerHTML=sn),Pt=s(e),u(k.$$.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),At=s(e),u(de.$$.fragment,e),Yt=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),ke=o(e,"UL",{"data-svelte-h":!0}),d(ke)!=="svelte-99mvik"&&(ke.innerHTML=$n),ri=s(e),u(J.$$.fragment,e),oi=s(e),Je=o(e,"P",{"data-svelte-h":!0}),d(Je)!=="svelte-ttgvgc"&&(Je.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(ze.$$.fragment,e),hi=s(e),u(Ie.$$.fragment,e),di=s(e),u(We.$$.fragment,e),$i=s(e),u(Be.$$.fragment,e),wi=s(e),u(Le.$$.fragment,e),yi=s(e),u(Ee.$$.fragment,e),Ti=s(e),u(He.$$.fragment,e),vi=s(e),u(qe.$$.fragment,e),Mi=s(e),u(Ge.$$.fragment,e),bi=s(e),u(Qe.$$.fragment,e),Ci=s(e),u(Ze.$$.fragment,e),xi=s(e),u(Pe.$$.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),ki=s(e),u(Ae.$$.fragment,e),Ji=s(e),Ye=o(e,"UL",{"data-svelte-h":!0}),d(Ye)!=="svelte-1qwbi4x"&&(Ye.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",Yn),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(z,e,t),n(e,rt,t),n(e,I,t),n(e,ot,t),g(C,e,t),n(e,pt,t),n(e,W,t),n(e,mt,t),g(B,e,t),n(e,ut,t),n(e,L,t),n(e,gt,t),n(e,E,t),n(e,ft,t),g(H,e,t),n(e,ct,t),n(e,q,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,Z,t),n(e,yt,t),n(e,P,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,A,t),n(e,Ct,t),n(e,Y,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,kt,t),n(e,K,t),n(e,Jt,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,zt,t),n(e,ne,t),n(e,It,t),g(ae,e,t),n(e,Wt,t),g(se,e,t),n(e,Bt,t),n(e,le,t),n(e,Lt,t),g(re,e,t),n(e,Et,t),n(e,oe,t),n(e,Ht,t),n(e,pe,t),n(e,qt,t),n(e,me,t),n(e,Gt,t),g(ue,e,t),n(e,Qt,t),n(e,ge,t),n(e,Zt,t),n(e,fe,t),n(e,Pt,t),g(k,e,t),n(e,Xt,t),g(ce,e,t),n(e,Vt,t),n(e,he,t),n(e,At,t),g(de,e,t),n(e,Yt,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,ke,t),n(e,ri,t),g(J,e,t),n(e,oi,t),n(e,Je,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(ze,e,t),n(e,hi,t),g(Ie,e,t),n(e,di,t),g(We,e,t),n(e,$i,t),g(Be,e,t),n(e,wi,t),g(Le,e,t),n(e,yi,t),g(Ee,e,t),n(e,Ti,t),g(He,e,t),n(e,vi,t),g(qe,e,t),n(e,Mi,t),g(Ge,e,t),n(e,bi,t),g(Qe,e,t),n(e,Ci,t),g(Ze,e,t),n(e,xi,t),g(Pe,e,t),n(e,_i,t),n(e,Xe,t),n(e,Ui,t),n(e,Ve,t),n(e,ki,t),g(Ae,e,t),n(e,Ji,t),n(e,Ye,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 kn={};t&2&&(kn.$$scope={dirty:t,ctx:e}),U.$set(kn);const Jn={};t&2&&(Jn.$$scope={dirty:t,ctx:e}),k.$set(Jn);const jn={};t&2&&(jn.$$scope={dirty:t,ctx:e}),J.$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(z.$$.fragment,e),f(C.$$.fragment,e),f(B.$$.fragment,e),f(H.$$.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(k.$$.fragment,e),f(ce.$$.fragment,e),f(de.$$.fragment,e),f(we.$$.fragment,e),f(J.$$.fragment,e),f(je.$$.fragment,e),f(j.$$.fragment,e),f(ze.$$.fragment,e),f(Ie.$$.fragment,e),f(We.$$.fragment,e),f(Be.$$.fragment,e),f(Le.$$.fragment,e),f(Ee.$$.fragment,e),f(He.$$.fragment,e),f(qe.$$.fragment,e),f(Ge.$$.fragment,e),f(Qe.$$.fragment,e),f(Ze.$$.fragment,e),f(Pe.$$.fragment,e),f(Ae.$$.fragment,e),f(Ne.$$.fragment,e),Ri=!0)},o(e){c(M.$$.fragment,e),c(F.$$.fragment,e),c(z.$$.fragment,e),c(C.$$.fragment,e),c(B.$$.fragment,e),c(H.$$.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(k.$$.fragment,e),c(ce.$$.fragment,e),c(de.$$.fragment,e),c(we.$$.fragment,e),c(J.$$.fragment,e),c(je.$$.fragment,e),c(j.$$.fragment,e),c(ze.$$.fragment,e),c(Ie.$$.fragment,e),c(We.$$.fragment,e),c(Be.$$.fragment,e),c(Le.$$.fragment,e),c(Ee.$$.fragment,e),c(He.$$.fragment,e),c(qe.$$.fragment,e),c(Ge.$$.fragment,e),c(Qe.$$.fragment,e),c(Ze.$$.fragment,e),c(Pe.$$.fragment,e),c(Ae.$$.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(I),i(ot),i(pt),i(W),i(mt),i(ut),i(L),i(gt),i(E),i(ft),i(ct),i(q),i(ht),i(G),i(dt),i($t),i(wt),i(Z),i(yt),i(P),i(Tt),i(X),i(vt),i(b),i(Mt),i(bt),i(A),i(Ct),i(Y),i(xt),i(N),i(_t),i(Ut),i(kt),i(K),i(Jt),i(jt),i(Ft),i(Rt),i(te),i(St),i(zt),i(ne),i(It),i(Wt),i(Bt),i(le),i(Lt),i(Et),i(oe),i(Ht),i(pe),i(qt),i(me),i(Gt),i(Qt),i(ge),i(Zt),i(fe),i(Pt),i(Xt),i(Vt),i(he),i(At),i(Yt),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(ke),i(ri),i(oi),i(Je),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(ki),i(Ji),i(Ye),i(ji),i(Fi),i(et)),i(p),h(M,e),h(F,e),h(z,e),h(C,e),h(B,e),h(H,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(k,e),h(ce,e),h(de,e),h(we,e),h(J,e),h(je,e),h(j,e),h(ze,e),h(Ie,e),h(We,e),h(Be,e),h(Le,e),h(Ee,e),h(He,e),h(qe,e),h(Ge,e),h(Qe,e),h(Ze,e),h(Pe,e),h(Ae,e),h(Ne,e)}}}const Yn='{"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 In{constructor(p){super(),Wn(this,p,Nn,An,Rn,{})}}export{aa as component};
