import{s as Gt,n as N,e as br,o as vr,h as ya,b as _r,c as va,u as $a,g as Ja,d as Ca,f as jr}from"../chunks/scheduler.3e4cb221.js";import{S as Rt,i as qt,B as x,C as I,j as J,f as e,k as u,a as n,y as M,m as at,n as it,q as mr,g as m,r as C,s as r,h,u as U,c as o,v as b,D as ka,p as As,t as $,w as _,b as Qs,d as y,H as Ua,A as Ur,x as g,E as xa,l as Ia}from"../chunks/index.bc693fcb.js";import{H as B,T as Bt,E as xr}from"../chunks/getInferenceSnippets.65765a9b.js";import{C as vt}from"../chunks/CodeBlock.4d312707.js";import{g as Ir}from"../chunks/globals.7f7f1b26.js";import{w as kr}from"../chunks/index.926afeb3.js";var wt=(f=>(f.OPEN="OPEN",f.CLOSED="CLOSED",f.HASHASHLINK="HASHASHLINK",f))(wt||{});const hr={};function Lr(f){return hr[f]=hr[f]||kr("OPEN")}function Sr(f){let s,p,i,a,c,d;return{c(){s=x("svg"),p=x("defs"),i=x("clipPath"),a=x("rect"),c=x("g"),d=x("path"),this.h()},l(w){s=I(w,"svg",{class:!0,xmlns:!0,"xmlns:xlink":!0,"aria-hidden":!0,focusable:!0,role:!0,width:!0,height:!0,preserveAspectRatio:!0,viewBox:!0});var v=J(s);p=I(v,"defs",{});var T=J(p);i=I(T,"clipPath",{id:!0});var j=J(i);a=I(j,"rect",{x:!0,y:!0,width:!0,height:!0,fill:!0}),J(a).forEach(e),j.forEach(e),T.forEach(e),c=I(v,"g",{"clip-path":!0});var k=J(c);d=I(k,"path",{d:!0,fill:!0}),J(d).forEach(e),k.forEach(e),v.forEach(e),this.h()},h(){u(a,"x","3.05"),u(a,"y","0.5"),u(a,"width","25.73"),u(a,"height","31"),u(a,"fill","none"),u(i,"id","a"),u(d,"d","M24.94,9.51a12.81,12.81,0,0,1,0,18.16,12.68,12.68,0,0,1-18,0,12.81,12.81,0,0,1,0-18.16l9-9V5l-.84.83-6,6a9.58,9.58,0,1,0,13.55,0ZM20.44,9a1.68,1.68,0,1,1,1.67-1.67A1.68,1.68,0,0,1,20.44,9Z"),u(d,"fill","#ee4c2c"),u(c,"clip-path","url(#a)"),u(s,"class",f[0]),u(s,"xmlns","http://www.w3.org/2000/svg"),u(s,"xmlns:xlink","http://www.w3.org/1999/xlink"),u(s,"aria-hidden","true"),u(s,"focusable","false"),u(s,"role","img"),u(s,"width","1em"),u(s,"height","1em"),u(s,"preserveAspectRatio","xMidYMid meet"),u(s,"viewBox","0 0 32 32")},m(w,v){n(w,s,v),M(s,p),M(p,i),M(i,a),M(s,c),M(c,d)},p(w,[v]){v&1&&u(s,"class",w[0])},i:N,o:N,d(w){w&&e(s)}}}function Hr(f,s,p){let{classNames:i=""}=s;return f.$$set=a=>{"classNames"in a&&p(0,i=a.classNames)},[i]}class zr extends Rt{constructor(s){super(),qt(this,s,Hr,Sr,Gt,{classNames:0})}}function Fr(f){let s,p,i,a;return{c(){s=x("svg"),p=x("path"),i=x("path"),a=x("path"),this.h()},l(c){s=I(c,"svg",{class:!0,xmlns:!0,"xmlns:xlink":!0,"aria-hidden":!0,focusable:!0,role:!0,width:!0,height:!0,preserveAspectRatio:!0,viewBox:!0});var d=J(s);p=I(d,"path",{d:!0,fill:!0}),J(p).forEach(e),i=I(d,"path",{d:!0,fill:!0}),J(i).forEach(e),a=I(d,"path",{d:!0,fill:!0}),J(a).forEach(e),d.forEach(e),this.h()},h(){u(p,"d","M145.726 42.065v42.07l72.861 42.07v-42.07l-72.86-42.07zM0 84.135v42.07l36.43 21.03V105.17L0 84.135zm109.291 21.035l-36.43 21.034v126.2l36.43 21.035v-84.135l36.435 21.035v-42.07l-36.435-21.034V105.17z"),u(p,"fill","#E55B2D"),u(i,"d","M145.726 42.065L36.43 105.17v42.065l72.861-42.065v42.065l36.435-21.03v-84.14zM255.022 63.1l-36.435 21.035v42.07l36.435-21.035V63.1zm-72.865 84.135l-36.43 21.035v42.07l36.43-21.036v-42.07zm-36.43 63.104l-36.436-21.035v84.135l36.435-21.035V210.34z"),u(i,"fill","#ED8E24"),u(a,"d","M145.726 0L0 84.135l36.43 21.035l109.296-63.105l72.861 42.07L255.022 63.1L145.726 0zm0 126.204l-36.435 21.03l36.435 21.036l36.43-21.035l-36.43-21.03z"),u(a,"fill","#F8BF3C"),u(s,"class",f[0]),u(s,"xmlns","http://www.w3.org/2000/svg"),u(s,"xmlns:xlink","http://www.w3.org/1999/xlink"),u(s,"aria-hidden","true"),u(s,"focusable","false"),u(s,"role","img"),u(s,"width","0.94em"),u(s,"height","1em"),u(s,"preserveAspectRatio","xMidYMid meet"),u(s,"viewBox","0 0 256 274")},m(c,d){n(c,s,d),M(s,p),M(s,i),M(s,a)},p(c,[d]){d&1&&u(s,"class",c[0])},i:N,o:N,d(c){c&&e(s)}}}function Er(f,s,p){let{classNames:i=""}=s;return f.$$set=a=>{"classNames"in a&&p(0,i=a.classNames)},[i]}class Br extends Rt{constructor(s){super(),qt(this,s,Er,Fr,Gt,{classNames:0})}}function Gr(f){let s,p,i,a,c,d,w,v,T,j,k,H,z,q,R,D,S,F,W,Z,L,G,P,E,O,K,ct,tt,$t,mt,et,ht,Q,st,Jt,ft,lt,X,nt,Ct,gt;return{c(){s=x("svg"),p=x("style"),i=at(`.J {
			stroke: #dce0df;
		}
		.K {
			stroke-linejoin: round;
		}
	`),a=x("g"),c=x("path"),d=x("path"),w=x("path"),v=x("path"),T=x("path"),j=x("path"),k=x("path"),H=x("path"),z=x("g"),q=x("path"),R=x("path"),D=x("path"),S=x("g"),F=x("path"),W=x("path"),Z=x("path"),L=x("g"),G=x("path"),P=x("path"),E=x("g"),O=x("path"),K=x("path"),ct=x("path"),tt=x("path"),$t=x("path"),mt=x("path"),et=x("path"),ht=x("path"),Q=x("g"),st=x("path"),Jt=x("path"),ft=x("path"),lt=x("path"),X=x("g"),nt=x("path"),Ct=x("path"),gt=x("path"),this.h()},l(Y){s=I(Y,"svg",{class:!0,xmlns:!0,"xmlns:xlink":!0,"aria-hidden":!0,focusable:!0,role:!0,width:!0,height:!0,preserveAspectRatio:!0,viewBox:!0});var V=J(s);p=I(V,"style",{});var Nt=J(p);i=it(Nt,`.J {
			stroke: #dce0df;
		}
		.K {
			stroke-linejoin: round;
		}
	`),Nt.forEach(e),a=I(V,"g",{fill:!0,class:!0});var A=J(a);c=I(A,"path",{d:!0}),J(c).forEach(e),d=I(A,"path",{d:!0}),J(d).forEach(e),w=I(A,"path",{d:!0}),J(w).forEach(e),v=I(A,"path",{d:!0}),J(v).forEach(e),T=I(A,"path",{d:!0}),J(T).forEach(e),j=I(A,"path",{d:!0}),J(j).forEach(e),k=I(A,"path",{d:!0}),J(k).forEach(e),H=I(A,"path",{d:!0}),J(H).forEach(e),A.forEach(e),z=I(V,"g",{fill:!0,class:!0});var Wt=J(z);q=I(Wt,"path",{d:!0}),J(q).forEach(e),R=I(Wt,"path",{d:!0}),J(R).forEach(e),D=I(Wt,"path",{d:!0}),J(D).forEach(e),Wt.forEach(e),S=I(V,"g",{fill:!0,class:!0});var bt=J(S);F=I(bt,"path",{d:!0}),J(F).forEach(e),W=I(bt,"path",{d:!0}),J(W).forEach(e),bt.forEach(e),Z=I(V,"path",{d:!0,fill:!0,class:!0}),J(Z).forEach(e),L=I(V,"g",{fill:!0,class:!0});var pt=J(L);G=I(pt,"path",{d:!0}),J(G).forEach(e),P=I(pt,"path",{d:!0}),J(P).forEach(e),pt.forEach(e),E=I(V,"g",{fill:!0,class:!0});var ut=J(E);O=I(ut,"path",{d:!0}),J(O).forEach(e),K=I(ut,"path",{d:!0}),J(K).forEach(e),ct=I(ut,"path",{d:!0}),J(ct).forEach(e),tt=I(ut,"path",{d:!0}),J(tt).forEach(e),$t=I(ut,"path",{d:!0}),J($t).forEach(e),mt=I(ut,"path",{d:!0}),J(mt).forEach(e),et=I(ut,"path",{d:!0}),J(et).forEach(e),ut.forEach(e),ht=I(V,"path",{d:!0,fill:!0,class:!0}),J(ht).forEach(e),Q=I(V,"g",{fill:!0,class:!0});var dt=J(Q);st=I(dt,"path",{d:!0}),J(st).forEach(e),Jt=I(dt,"path",{d:!0}),J(Jt).forEach(e),ft=I(dt,"path",{d:!0}),J(ft).forEach(e),lt=I(dt,"path",{d:!0}),J(lt).forEach(e),dt.forEach(e),X=I(V,"g",{fill:!0,class:!0});var rt=J(X);nt=I(rt,"path",{d:!0}),J(nt).forEach(e),Ct=I(rt,"path",{d:!0}),J(Ct).forEach(e),gt=I(rt,"path",{d:!0}),J(gt).forEach(e),rt.forEach(e),V.forEach(e),this.h()},h(){u(c,"d","M50.5 130.4l-25 43.31h50l25-43.31h-50z"),u(d,"d","M.5 217.01l25-43.3h50l-25 43.3H.5z"),u(w,"d","M125.5 173.71h-50l-25 43.3h50l25-43.3z"),u(v,"d","M175.5 173.71h-50l-25 43.3h50l25-43.3z"),u(T,"d","M150.5 130.4l-25 43.31h50l25-43.31h-50z"),u(j,"d","M175.5 87.1l-25 43.3h50l25-43.3h-50z"),u(k,"d","M200.5 43.8l-25 43.3h50l25-43.3h-50z"),u(H,"d","M225.5.5l-25 43.3h50l25-43.3h-50z"),u(a,"fill","#5e97f6"),u(a,"class","J K"),u(q,"d","M.5 217.01l25 43.3h50l-25-43.3H.5z"),u(R,"d","M125.5 260.31h-50l-25-43.3h50l25 43.3z"),u(D,"d","M175.5 260.31h-50l-25-43.3h50l25 43.3z"),u(z,"fill","#2a56c6"),u(z,"class","J K"),u(F,"d","M200.5 217.01l-25-43.3-25 43.3 25 43.3 25-43.3zm50-86.61l-25-43.3-25 43.3h50z"),u(W,"d","M250.5 43.8l-25 43.3 25 43.3 25-43.3-25-43.3z"),u(S,"fill","#00796b"),u(S,"class","J K"),u(Z,"d","M125.5 173.71l-25-43.31-25 43.31h50z"),u(Z,"fill","#3367d6"),u(Z,"class","J K"),u(G,"d","M250.5 130.4h-50l-25 43.31h50l25-43.31z"),u(P,"d","M300.5 130.4h-50l-25 43.31h50l25-43.31z"),u(L,"fill","#26a69a"),u(L,"class","J K"),u(O,"d","M350.5 43.8L325.5.5l-25 43.3 25 43.3 25-43.3z"),u(K,"d","M375.5 87.1l-25-43.3-25 43.3 25 43.3 25-43.3z"),u(ct,"d","M400.5 130.4l-25-43.3-25 43.3 25 43.31 25-43.31z"),u(tt,"d","M425.5 173.71l-25-43.31-25 43.31 25 43.3 25-43.3z"),u($t,"d","M450.5 217.01l-25-43.3-25 43.3 25 43.3 25-43.3zM425.5.5l-25 43.3 25 43.3 25-43.3-25-43.3z"),u(mt,"d","M375.5 87.1l25-43.3 25 43.3-25 43.3-25-43.3zm-25 43.3l-25 43.31 25 43.3 25-43.3-25-43.31z"),u(et,"d","M325.5 260.31l-25-43.3 25-43.3 25 43.3-25 43.3z"),u(E,"fill","#9c27b0"),u(E,"class","J K"),u(ht,"d","M275.5 260.31l-25-43.3h50l25 43.3h-50z"),u(ht,"fill","#6a1b9a"),u(ht,"class","J K"),u(st,"d","M225.5 173.71h-50l25 43.3h50l-25-43.3z"),u(Jt,"d","M275.5 173.71h-50l25 43.3 25-43.3zm0-86.61l25 43.3h50l-25-43.3h-50z"),u(ft,"d","M300.5 43.8h-50l25 43.3h50l-25-43.3zm125 216.51l-25-43.3h-50l25 43.3h50z"),u(lt,"d","M375.5 173.71l-25 43.3h50l-25-43.3z"),u(Q,"fill","#00695c"),u(Q,"class","J K"),u(nt,"d","M325.5.5h-50l-25 43.3h50l25-43.3zm0 173.21h-50l-25 43.3h50l25-43.3z"),u(Ct,"d","M350.5 130.4h-50l-25 43.31h50l25-43.31zM425.5.5h-50l-25 43.3h50l25-43.3z"),u(gt,"d","M375.5 87.1l-25-43.3h50l-25 43.3z"),u(X,"fill","#ea80fc"),u(X,"class","J K"),u(s,"class",f[0]),u(s,"xmlns","http://www.w3.org/2000/svg"),u(s,"xmlns:xlink","http://www.w3.org/1999/xlink"),u(s,"aria-hidden","true"),u(s,"focusable","false"),u(s,"role","img"),u(s,"width","1.73em"),u(s,"height","1em"),u(s,"preserveAspectRatio","xMidYMid meet"),u(s,"viewBox","0 0 451 260.81")},m(Y,V){n(Y,s,V),M(s,p),M(p,i),M(s,a),M(a,c),M(a,d),M(a,w),M(a,v),M(a,T),M(a,j),M(a,k),M(a,H),M(s,z),M(z,q),M(z,R),M(z,D),M(s,S),M(S,F),M(S,W),M(s,Z),M(s,L),M(L,G),M(L,P),M(s,E),M(E,O),M(E,K),M(E,ct),M(E,tt),M(E,$t),M(E,mt),M(E,et),M(s,ht),M(s,Q),M(Q,st),M(Q,Jt),M(Q,ft),M(Q,lt),M(s,X),M(X,nt),M(X,Ct),M(X,gt)},p(Y,[V]){V&1&&u(s,"class",Y[0])},i:N,o:N,d(Y){Y&&e(s)}}}function Rr(f,s,p){let{classNames:i=""}=s;return f.$$set=a=>{"classNames"in a&&p(0,i=a.classNames)},[i]}class qr extends Rt{constructor(s){super(),qt(this,s,Rr,Gr,Gt,{classNames:0})}}function Nr(f){let s,p;return{c(){s=x("svg"),p=x("path"),this.h()},l(i){s=I(i,"svg",{class:!0,width:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var a=J(s);p=I(a,"path",{d:!0,fill:!0}),J(p).forEach(e),a.forEach(e),this.h()},h(){u(p,"d","M0 4.50001C0.390979 2.37042 2.25728 0.756592 4.5 0.756592C6.74272 0.756592 8.60861 2.37042 9 4.50001C8.60902 6.62959 6.74272 8.24342 4.5 8.24342C2.25728 8.24342 0.391395 6.62959 0 4.50001ZM4.5 6.57968C5.05156 6.57968 5.58054 6.36057 5.97055 5.97056C6.36057 5.58054 6.57967 5.05157 6.57967 4.50001C6.57967 3.94844 6.36057 3.41947 5.97055 3.02945C5.58054 2.63944 5.05156 2.42033 4.5 2.42033C3.94844 2.42033 3.41946 2.63944 3.02945 3.02945C2.63943 3.41947 2.42033 3.94844 2.42033 4.50001C2.42033 5.05157 2.63943 5.58054 3.02945 5.97056C3.41946 6.36057 3.94844 6.57968 4.5 6.57968ZM4.5 5.74781C4.16906 5.74781 3.85168 5.61635 3.61767 5.38234C3.38366 5.14833 3.2522 4.83094 3.2522 4.50001C3.2522 4.16907 3.38366 3.85168 3.61767 3.61767C3.85168 3.38367 4.16906 3.2522 4.5 3.2522C4.83094 3.2522 5.14832 3.38367 5.38233 3.61767C5.61634 3.85168 5.7478 4.16907 5.7478 4.50001C5.7478 4.83094 5.61634 5.14833 5.38233 5.38234C5.14832 5.61635 4.83094 5.74781 4.5 5.74781Z"),u(p,"fill","currentColor"),u(s,"class",f[0]),u(s,"width",f[1]),u(s,"height",f[1]),u(s,"viewBox","0 0 9 9"),u(s,"fill","currentColor"),u(s,"xmlns","http://www.w3.org/2000/svg")},m(i,a){n(i,s,a),M(s,p)},p(i,[a]){a&1&&u(s,"class",i[0]),a&2&&u(s,"width",i[1]),a&2&&u(s,"height",i[1])},i:N,o:N,d(i){i&&e(s)}}}function Wr(f,s,p){let{classNames:i=""}=s,{size:a="1em"}=s;return f.$$set=c=>{"classNames"in c&&p(0,i=c.classNames),"size"in c&&p(1,a=c.size)},[i,a]}class Pr extends Rt{constructor(s){super(),qt(this,s,Wr,Nr,Gt,{classNames:0,size:1})}}function Vr(f){let s,p;return{c(){s=x("svg"),p=x("path"),this.h()},l(i){s=I(i,"svg",{class:!0,width:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var a=J(s);p=I(a,"path",{d:!0,fill:!0}),J(p).forEach(e),a.forEach(e),this.h()},h(){u(p,"d","M1.39125 1.9725L0.0883333 0.669997L0.677917 0.0804138L8.9275 8.33041L8.33792 8.91958L6.95875 7.54041C6.22592 8.00523 5.37572 8.25138 4.50792 8.25C2.26125 8.25 0.392083 6.63333 0 4.5C0.179179 3.52946 0.667345 2.64287 1.39167 1.9725H1.39125ZM5.65667 6.23833L5.04667 5.62833C4.81335 5.73996 4.55116 5.77647 4.29622 5.73282C4.04129 5.68918 3.80617 5.56752 3.62328 5.38463C3.44039 5.20175 3.31874 4.96663 3.27509 4.71169C3.23144 4.45676 3.26795 4.19456 3.37958 3.96125L2.76958 3.35125C2.50447 3.75187 2.38595 4.2318 2.4341 4.70978C2.48225 5.18777 2.6941 5.63442 3.0338 5.97411C3.37349 6.31381 3.82015 6.52567 4.29813 6.57382C4.77611 6.62197 5.25605 6.50345 5.65667 6.23833ZM2.83042 1.06666C3.35 0.862497 3.91625 0.749997 4.50792 0.749997C6.75458 0.749997 8.62375 2.36666 9.01583 4.5C8.88816 5.19404 8.60119 5.84899 8.1775 6.41333L6.56917 4.805C6.61694 4.48317 6.58868 4.15463 6.48664 3.84569C6.3846 3.53675 6.21162 3.256 5.98156 3.02594C5.7515 2.79588 5.47075 2.6229 5.16181 2.52086C4.85287 2.41882 4.52433 2.39056 4.2025 2.43833L2.83042 1.06708V1.06666Z"),u(p,"fill","currentColor"),u(s,"class",f[0]),u(s,"width",f[1]),u(s,"height",f[1]),u(s,"viewBox","0 0 10 9"),u(s,"fill","currentColor"),u(s,"xmlns","http://www.w3.org/2000/svg")},m(i,a){n(i,s,a),M(s,p)},p(i,[a]){a&1&&u(s,"class",i[0]),a&2&&u(s,"width",i[1]),a&2&&u(s,"height",i[1])},i:N,o:N,d(i){i&&e(s)}}}function Zr(f,s,p){let{classNames:i=""}=s,{size:a="1em"}=s;return f.$$set=c=>{"classNames"in c&&p(0,i=c.classNames),"size"in c&&p(1,a=c.size)},[i,a]}class Ar extends Rt{constructor(s){super(),qt(this,s,Zr,Vr,Gt,{classNames:0,size:1})}}const{window:Qr}=Ir;function fr(f){let s,p,i,a,c,d,w,v,T,j;return p=new Ar({props:{size:"0.9em"}}),{c(){s=m("div"),C(p.$$.fragment),i=r(),a=m("span"),c=at("Hide "),d=at(f[3]),w=at(" content"),this.h()},l(k){s=h(k,"DIV",{class:!0});var H=J(s);U(p.$$.fragment,H),i=o(H),a=h(H,"SPAN",{});var z=J(a);c=it(z,"Hide "),d=it(z,f[3]),w=it(z," content"),z.forEach(e),H.forEach(e),this.h()},h(){u(s,"class","cursor-pointer flex items-center justify-center space-x-1 text-sm px-2 bg-white dark:bg-gray-950 hover:underline leading-none")},m(k,H){n(k,s,H),b(p,s,null),M(s,i),M(s,a),M(a,c),M(a,d),M(a,w),v=!0,T||(j=ka(s,"click",f[5]),T=!0)},p:N,i(k){v||(y(p.$$.fragment,k),v=!0)},o(k){$(p.$$.fragment,k),v=!1},d(k){k&&e(s),_(p),T=!1,j()}}}function Yr(f){let s,p;const i=f[10].default,a=va(i,f,f[9],null);return{c(){s=m("div"),a&&a.c(),this.h()},l(c){s=h(c,"DIV",{class:!0});var d=J(s);a&&a.l(d),d.forEach(e),this.h()},h(){u(s,"class","framework-content")},m(c,d){n(c,s,d),a&&a.m(s,null),p=!0},p(c,d){a&&a.p&&(!p||d&512)&&$a(a,i,c,c[9],p?Ca(i,c[9],d,null):Ja(c[9]),null)},i(c){p||(y(a,c),p=!0)},o(c){$(a,c),p=!1},d(c){c&&e(s),a&&a.d(c)}}}function Xr(f){let s,p,i,a,c,d,w,v,T,j;return p=new Pr({props:{size:"0.9em"}}),{c(){s=m("div"),C(p.$$.fragment),i=r(),a=m("span"),c=at("Show "),d=at(f[3]),w=at(" content"),this.h()},l(k){s=h(k,"DIV",{class:!0});var H=J(s);U(p.$$.fragment,H),i=o(H),a=h(H,"SPAN",{});var z=J(a);c=it(z,"Show "),d=it(z,f[3]),w=it(z," content"),z.forEach(e),H.forEach(e),this.h()},h(){u(s,"class","cursor-pointer mt-[-12.5px] flex items-center justify-center space-x-1 py-4 text-sm hover:underline leading-none")},m(k,H){n(k,s,H),b(p,s,null),M(s,i),M(s,a),M(a,c),M(a,d),M(a,w),v=!0,T||(j=ka(s,"click",f[5]),T=!0)},p:N,i(k){v||(y(p.$$.fragment,k),v=!0)},o(k){$(p.$$.fragment,k),v=!1},d(k){k&&e(s),_(p),T=!1,j()}}}function Dr(f){let s,p,i,a,c,d,w,v,T,j,k,H,z,q;var R=f[2];function D(L,G){return{}}R&&(a=mr(R,D()));let S=!f[1]&&fr(f);const F=[Xr,Yr],W=[];function Z(L,G){return L[1]?0:1}return j=Z(f),k=W[j]=F[j](f),{c(){s=m("div"),p=m("div"),i=m("div"),a&&C(a.$$.fragment),c=r(),d=m("span"),w=at(f[3]),v=r(),S&&S.c(),T=r(),k.c(),this.h()},l(L){s=h(L,"DIV",{class:!0});var G=J(s);p=h(G,"DIV",{class:!0});var P=J(p);i=h(P,"DIV",{class:!0});var E=J(i);a&&U(a.$$.fragment,E),c=o(E),d=h(E,"SPAN",{});var O=J(d);w=it(O,f[3]),O.forEach(e),E.forEach(e),v=o(P),S&&S.l(P),P.forEach(e),T=o(G),k.l(G),G.forEach(e),this.h()},h(){u(i,"class","flex px-1 items-center space-x-1 bg-white dark:bg-gray-950"),u(p,"class","flex h-[22px] mt-[-12.5px] justify-between leading-none"),u(s,"class","border border-gray-200 rounded-xl px-4 relative")},m(L,G){n(L,s,G),M(s,p),M(p,i),a&&b(a,i,null),M(i,c),M(i,d),M(d,w),M(p,v),S&&S.m(p,null),M(s,T),W[j].m(s,null),f[11](s),H=!0,z||(q=ka(Qr,"hashchange",f[6]),z=!0)},p(L,[G]){if(R!==(R=L[2])){if(a){As();const E=a;$(E.$$.fragment,1,0,()=>{_(E,1)}),Qs()}R?(a=mr(R,D()),C(a.$$.fragment),y(a.$$.fragment,1),b(a,i,c)):a=null}L[1]?S&&(As(),$(S,1,1,()=>{S=null}),Qs()):S?(S.p(L,G),G&2&&y(S,1)):(S=fr(L),S.c(),y(S,1),S.m(p,null));let P=j;j=Z(L),j===P?W[j].p(L,G):(As(),$(W[P],1,1,()=>{W[P]=null}),Qs(),k=W[j],k?k.p(L,G):(k=W[j]=F[j](L),k.c()),y(k,1),k.m(s,null))},i(L){H||(a&&y(a.$$.fragment,L),y(S),y(k),H=!0)},o(L){a&&$(a.$$.fragment,L),$(S),$(k),H=!1},d(L){L&&e(s),a&&_(a),S&&S.d(),W[j].d(),f[11](null),z=!1,q()}}}function Or(f,s,p){let i,a,{$$slots:c={},$$scope:d}=s,{framework:w}=s,v,T=new Set;const j={pytorch:{Icon:zr,label:"Pytorch"},tensorflow:{Icon:Br,label:"TensorFlow"},jax:{Icon:qr,label:"JAX"}},{Icon:k,label:H}=j[w],z=`hf_doc_framework_${w}_is_hidden`,q=Lr(w);br(f,q,F=>p(8,a=F));function R(){ya(q,a=a!==wt.CLOSED?wt.CLOSED:wt.OPEN,a),localStorage.setItem(z,a)}function D(){const F=window.location.hash.slice(1);T.has(F)&&(ya(q,a=wt.HASHASHLINK,a),localStorage.setItem(z,a))}vr(()=>{const F=window.location.hash.slice(1),W="header-link",Z=v.querySelectorAll(`.${W}`);T=new Set([...Z].map(G=>G.id));const L=localStorage.getItem(z);T.has(F)?ya(q,a=wt.HASHASHLINK,a):L===wt.CLOSED&&a!==wt.HASHASHLINK&&ya(q,a=wt.CLOSED,a)});function S(F){_r[F?"unshift":"push"](()=>{v=F,p(0,v)})}return f.$$set=F=>{"framework"in F&&p(7,w=F.framework),"$$scope"in F&&p(9,d=F.$$scope)},f.$$.update=()=>{f.$$.dirty&256&&p(1,i=a===wt.CLOSED)},[v,i,k,H,q,R,D,w,a,d,c,S]}class La extends Rt{constructor(s){super(),qt(this,s,Or,Dr,Gt,{framework:7})}}const Kr=f=>({}),gr=f=>({}),to=f=>({}),dr=f=>({}),eo=f=>({}),Tr=f=>({});function wr(f){let s,p;return s=new La({props:{framework:"pytorch",$$slots:{default:[so]},$$scope:{ctx:f}}}),{c(){C(s.$$.fragment)},l(i){U(s.$$.fragment,i)},m(i,a){b(s,i,a),p=!0},p(i,a){const c={};a&16&&(c.$$scope={dirty:a,ctx:i}),s.$set(c)},i(i){p||(y(s.$$.fragment,i),p=!0)},o(i){$(s.$$.fragment,i),p=!1},d(i){_(s,i)}}}function so(f){let s;const p=f[3].pytorch,i=va(p,f,f[4],Tr);return{c(){i&&i.c()},l(a){i&&i.l(a)},m(a,c){i&&i.m(a,c),s=!0},p(a,c){i&&i.p&&(!s||c&16)&&$a(i,p,a,a[4],s?Ca(p,a[4],c,eo):Ja(a[4]),Tr)},i(a){s||(y(i,a),s=!0)},o(a){$(i,a),s=!1},d(a){i&&i.d(a)}}}function Mr(f){let s,p;return s=new La({props:{framework:"tensorflow",$$slots:{default:[lo]},$$scope:{ctx:f}}}),{c(){C(s.$$.fragment)},l(i){U(s.$$.fragment,i)},m(i,a){b(s,i,a),p=!0},p(i,a){const c={};a&16&&(c.$$scope={dirty:a,ctx:i}),s.$set(c)},i(i){p||(y(s.$$.fragment,i),p=!0)},o(i){$(s.$$.fragment,i),p=!1},d(i){_(s,i)}}}function lo(f){let s;const p=f[3].tensorflow,i=va(p,f,f[4],dr);return{c(){i&&i.c()},l(a){i&&i.l(a)},m(a,c){i&&i.m(a,c),s=!0},p(a,c){i&&i.p&&(!s||c&16)&&$a(i,p,a,a[4],s?Ca(p,a[4],c,to):Ja(a[4]),dr)},i(a){s||(y(i,a),s=!0)},o(a){$(i,a),s=!1},d(a){i&&i.d(a)}}}function yr(f){let s,p;return s=new La({props:{framework:"jax",$$slots:{default:[no]},$$scope:{ctx:f}}}),{c(){C(s.$$.fragment)},l(i){U(s.$$.fragment,i)},m(i,a){b(s,i,a),p=!0},p(i,a){const c={};a&16&&(c.$$scope={dirty:a,ctx:i}),s.$set(c)},i(i){p||(y(s.$$.fragment,i),p=!0)},o(i){$(s.$$.fragment,i),p=!1},d(i){_(s,i)}}}function no(f){let s;const p=f[3].jax,i=va(p,f,f[4],gr);return{c(){i&&i.c()},l(a){i&&i.l(a)},m(a,c){i&&i.m(a,c),s=!0},p(a,c){i&&i.p&&(!s||c&16)&&$a(i,p,a,a[4],s?Ca(p,a[4],c,Kr):Ja(a[4]),gr)},i(a){s||(y(i,a),s=!0)},o(a){$(i,a),s=!1},d(a){i&&i.d(a)}}}function ao(f){let s,p,i,a,c=f[0]&&wr(f),d=f[1]&&Mr(f),w=f[2]&&yr(f);return{c(){s=m("div"),c&&c.c(),p=r(),d&&d.c(),i=r(),w&&w.c(),this.h()},l(v){s=h(v,"DIV",{class:!0});var T=J(s);c&&c.l(T),p=o(T),d&&d.l(T),i=o(T),w&&w.l(T),T.forEach(e),this.h()},h(){u(s,"class","space-y-10 py-6 2xl:py-8 2xl:-mx-4")},m(v,T){n(v,s,T),c&&c.m(s,null),M(s,p),d&&d.m(s,null),M(s,i),w&&w.m(s,null),a=!0},p(v,[T]){v[0]?c?(c.p(v,T),T&1&&y(c,1)):(c=wr(v),c.c(),y(c,1),c.m(s,p)):c&&(As(),$(c,1,1,()=>{c=null}),Qs()),v[1]?d?(d.p(v,T),T&2&&y(d,1)):(d=Mr(v),d.c(),y(d,1),d.m(s,i)):d&&(As(),$(d,1,1,()=>{d=null}),Qs()),v[2]?w?(w.p(v,T),T&4&&y(w,1)):(w=yr(v),w.c(),y(w,1),w.m(s,null)):w&&(As(),$(w,1,1,()=>{w=null}),Qs())},i(v){a||(y(c),y(d),y(w),a=!0)},o(v){$(c),$(d),$(w),a=!1},d(v){v&&e(s),c&&c.d(),d&&d.d(),w&&w.d()}}}function io(f,s,p){let{$$slots:i={},$$scope:a}=s,{pytorch:c=!1}=s,{tensorflow:d=!1}=s,{jax:w=!1}=s;return f.$$set=v=>{"pytorch"in v&&p(0,c=v.pytorch),"tensorflow"in v&&p(1,d=v.tensorflow),"jax"in v&&p(2,w=v.jax),"$$scope"in v&&p(4,a=v.$$scope)},[c,d,w,i,a]}class ro extends Rt{constructor(s){super(),qt(this,s,io,ao,Gt,{pytorch:0,tensorflow:1,jax:2})}}function oo(f){let s,p='Before starting SFT, 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. Learn more about this decision process in the <a href="https://huggingface.co/learn/llm-course/en/chapter11/3" rel="nofollow">Hugging Face LLM Course</a>.';return{c(){s=m("p"),s.innerHTML=p},l(i){s=h(i,"P",{"data-svelte-h":!0}),g(s)!=="svelte-eymiet"&&(s.innerHTML=p)},m(i,a){n(i,s,a)},p:N,d(i){i&&e(s)}}}function po(f){let s,p="SFT doesn’t teach new facts - it teaches new behaviors. The model already knows about the world from pre-training; SFT teaches it how to be a helpful assistant using that knowledge.";return{c(){s=m("p"),s.textContent=p},l(i){s=h(i,"P",{"data-svelte-h":!0}),g(s)!=="svelte-v6re1r"&&(s.textContent=p)},m(i,a){n(i,s,a)},p:N,d(i){i&&e(s)}}}function uo(f){let s,p="Dataset size guidelines:",i,a,c="<li>Minimum: 1,000 high-quality examples for basic fine-tuning.</li> <li>Recommended: 10,000+ examples for robust performance.</li> <li>Quality over quantity: 1,000 well-curated examples often outperform 10,000 mediocre ones.</li>",d,w,v="Remember: Your model will learn to mimic the patterns in your training data, so invest time in data curation.";return{c(){s=m("p"),s.textContent=p,i=r(),a=m("ul"),a.innerHTML=c,d=r(),w=m("p"),w.textContent=v},l(T){s=h(T,"P",{"data-svelte-h":!0}),g(s)!=="svelte-vgvi0u"&&(s.textContent=p),i=o(T),a=h(T,"UL",{"data-svelte-h":!0}),g(a)!=="svelte-o2u94w"&&(a.innerHTML=c),d=o(T),w=h(T,"P",{"data-svelte-h":!0}),g(w)!=="svelte-rw4s5f"&&(w.textContent=v)},m(T,j){n(T,s,j),n(T,i,j),n(T,a,j),n(T,d,j),n(T,w,j)},p:N,d(T){T&&(e(s),e(i),e(a),e(d),e(w))}}}function co(f){let s,p="Hyperparameter starting points for SmolLM3:",i,a,c="To bootstrap your training, you can use the following hyperparameters:",d,w,v;return w=new vt({props:{code:"JTIzJTIwQ29uc2VydmF0aXZlJTIwKHN0YWJsZSUyQyUyMHNsb3dlciklMEFsZWFybmluZ19yYXRlJTIwJTNEJTIwNWUtNSUwQXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUyMCUzRCUyMDIlMEFncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlMjAlM0QlMjA4JTBBJTBBJTIzJTIwQmFsYW5jZWQlMjAocmVjb21tZW5kZWQpJTBBbGVhcm5pbmdfcmF0ZSUyMCUzRCUyMDFlLTQlMEFwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlMjAlM0QlMjA0JTBBZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTIwJTNEJTIwNCUwQSUwQSUyMyUyMEFnZ3Jlc3NpdmUlMjAoZmFzdGVyJTJDJTIwbGVzcyUyMHN0YWJsZSklMEFsZWFybmluZ19yYXRlJTIwJTNEJTIwMmUtNCUwQXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUyMCUzRCUyMDglMEFncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlMjAlM0QlMjAy",highlighted:`<span class="hljs-comment"># Conservative (stable, slower)</span>
learning_rate = <span class="hljs-number">5e-5</span>
per_device_train_batch_size = <span class="hljs-number">2</span>
gradient_accumulation_steps = <span class="hljs-number">8</span>

<span class="hljs-comment"># Balanced (recommended)</span>
learning_rate = <span class="hljs-number">1e-4</span>
per_device_train_batch_size = <span class="hljs-number">4</span>
gradient_accumulation_steps = <span class="hljs-number">4</span>

<span class="hljs-comment"># Aggressive (faster, less stable)</span>
learning_rate = <span class="hljs-number">2e-4</span>
per_device_train_batch_size = <span class="hljs-number">8</span>
gradient_accumulation_steps = <span class="hljs-number">2</span>`,wrap:!1}}),{c(){s=m("p"),s.textContent=p,i=r(),a=m("p"),a.textContent=c,d=r(),C(w.$$.fragment)},l(T){s=h(T,"P",{"data-svelte-h":!0}),g(s)!=="svelte-1wwjtr2"&&(s.textContent=p),i=o(T),a=h(T,"P",{"data-svelte-h":!0}),g(a)!=="svelte-fz49y"&&(a.textContent=c),d=o(T),U(w.$$.fragment,T)},m(T,j){n(T,s,j),n(T,i,j),n(T,a,j),n(T,d,j),b(w,T,j),v=!0},p:N,i(T){v||(y(w.$$.fragment,T),v=!0)},o(T){$(w.$$.fragment,T),v=!1},d(T){T&&(e(s),e(i),e(a),e(d)),_(w,T)}}}function mo(f){let s,p='Learn more about loss interpretation in the <a href="https://huggingface.co/learn/llm-course/en/chapter11/3" rel="nofollow">Hugging Face LLM Course</a>.';return{c(){s=m("p"),s.innerHTML=p},l(i){s=h(i,"P",{"data-svelte-h":!0}),g(s)!=="svelte-w4xp8k"&&(s.innerHTML=p)},m(i,a){n(i,s,a)},p:N,d(i){i&&e(s)}}}function ho(f){let s,p="When using chat templates for training, be careful with special token handling.",i,a,c="When training on multiple datasets with different formats we need to standardize the format of the dataset. For example, if we are training on a dataset with instruction-following examples, we need to convert the dataset to a chat format.";return{c(){s=m("p"),s.textContent=p,i=r(),a=m("p"),a.textContent=c},l(d){s=h(d,"P",{"data-svelte-h":!0}),g(s)!=="svelte-10rkopk"&&(s.textContent=p),i=o(d),a=h(d,"P",{"data-svelte-h":!0}),g(a)!=="svelte-12boaq0"&&(a.textContent=c)},m(d,w){n(d,s,w),n(d,i,w),n(d,a,w)},p:N,d(d){d&&(e(s),e(i),e(a))}}}function fo(f){let s,p="TRL versus other training libraries:",i,a,c="<li>TRL: Specialized for LLM training, built for instruction tuning.</li> <li>Transformers Trainer: General purpose, suitable for basic fine-tuning.</li> <li>DeepSpeed: Focuses on large-scale distributed training.</li> <li>Accelerate: Provides low-level distributed training primitives.</li>",d,w,v='TRL provides the best balance of ease-of-use and advanced features for SFT. For more details on training approaches, see the <a href="https://huggingface.co/learn/llm-course/en/chapter11/3" rel="nofollow">Hugging Face LLM Course</a>.';return{c(){s=m("p"),s.textContent=p,i=r(),a=m("ul"),a.innerHTML=c,d=r(),w=m("p"),w.innerHTML=v},l(T){s=h(T,"P",{"data-svelte-h":!0}),g(s)!=="svelte-1j3qs8h"&&(s.textContent=p),i=o(T),a=h(T,"UL",{"data-svelte-h":!0}),g(a)!=="svelte-1aor2o2"&&(a.innerHTML=c),d=o(T),w=h(T,"P",{"data-svelte-h":!0}),g(w)!=="svelte-i2w11o"&&(w.innerHTML=v)},m(T,j){n(T,s,j),n(T,i,j),n(T,a,j),n(T,d,j),n(T,w,j)},p:N,d(T){T&&(e(s),e(i),e(a),e(d),e(w))}}}function go(f){let s,p='🎓 <strong>Continue Learning</strong>: This introduction covers the fundamentals, but SFT is a deep topic. For more advanced techniques, evaluation methods, and troubleshooting tips, explore the <a href="https://huggingface.co/learn/llm-course/en/chapter11/3?fw=pt" rel="nofollow">Hugging Face LLM Course</a> which provides comprehensive coverage of modern LLM training techniques.';return{c(){s=m("p"),s.innerHTML=p},l(i){s=h(i,"P",{"data-svelte-h":!0}),g(s)!=="svelte-1oxazjr"&&(s.innerHTML=p)},m(i,a){n(i,s,a)},p:N,d(i){i&&e(s)}}}function To(f){let s,p,i,a,c,d,w,v="Supervised Fine-Tuning (SFT) is the cornerstone of instruction tuning - it’s how we transform a base language model into an instruction-following assistant. In this section, you’ll learn to fine-tune <strong>SmolLM3</strong> using real-world datasets and production-ready tools.",T,j,k,H,z="SFT is the process of continuing to train a pre-trained model on task-specific datasets with labeled examples. Think of it as specialized education:",q,R,D="<li>Pre-training teaches the model general language understanding (like learning to read).</li> <li>Supervised fine-tuning teaches specific skills and behaviors (like learning to do a specific task).</li>",S,F,W="The key insight behind SFT is that we’re not teaching the model new knowledge from scratch. Instead, we’re <strong>reshaping how existing knowledge is applied</strong>. The pre-trained model already understands language, grammar, and has absorbed vast amounts of factual information. SFT focuses this general capability toward specific application patterns, response styles, and task-specific requirements.",Z,L,G="This approach is effective because it leverages the rich representations learned during pre-training while requiring significantly less computational resources than training from scratch. The model learns to recognize instruction patterns, maintain conversation context, follow safety guidelines, and generate responses in desired formats.",P,E,O,K,ct,tt,$t="SmolLM3’s instruction-following capabilities come from a sophisticated SFT process:",mt,et,ht="<li><strong>Base Model</strong> (<code>SmolLM3-3B-Base</code>): Trained on 11T tokens of general text</li> <li><strong>SFT Training</strong>: Fine-tuned on curated instruction datasets including SmolTalk2</li> <li><strong>Preference Alignment</strong>: Further refined using techniques like APO (Anchored Preference Optimization)</li>",Q,st,Jt="This multi-stage approach creates a model that’s both knowledgeable and helpful.",ft,lt,X,nt,Ct="SFT is effective because it leverages the rich representations learned during pre-training while adapting the model’s behavior patterns. During SFT, the model’s parameters are fine-tuned through gradient descent on task-specific examples, causing subtle but important changes in how the model processes and generates text.",gt,Y,V="Specifically, the process works through several key mechanisms:",Nt,A,Wt='<strong>Behavioral Adaptation</strong>: The model learns to recognize instruction patterns and respond appropriately. This involves updating the attention mechanisms to focus on instruction cues in language and adjusting the output distribution to favor the desired responses. Research has shown that instruction tuning primarily affects the model’s surface-level behavior rather than its underlying knowledge <a href="https://huggingface.co/papers/2109.01652" rel="nofollow">(Wei et al., 2021)</a>.',bt,pt,ut='<strong>Task Specialization</strong>: Rather than learning entirely new concepts, the model learns to apply its existing knowledge in specific contexts. This is why SFT is much more efficient than pre-training - we’re refining existing capabilities rather than building them from scratch. Studies indicate that most of the factual knowledge comes from pre-training, while SFT teaches the model how to format and present this knowledge appropriately <a href="https://huggingface.co/papers/2203.02155" rel="nofollow">(Ouyang et al., 2022)</a>.',dt,rt,Sa='<strong>Safety Alignment</strong>: Through exposure to carefully curated examples, the model learns to be more helpful, harmless, and honest. This involves both learning what to say and what not to say in various situations. The effectiveness of this approach has been demonstrated in works like InstructGPT <a href="https://huggingface.co/papers/2203.02155" rel="nofollow">(Ouyang et al., 2022)</a> and Constitutional AI <a href="https://huggingface.co/papers/2204.05862" rel="nofollow">(Bai et al., 2022)</a>.',Xs,_t,Ds,Pt,Ha="The mathematical foundation involves minimizing the cross-entropy loss between the model’s predictions and the target responses in your training dataset. This process gradually shifts the model’s probability distributions to favor the types of responses demonstrated in your training examples.",Os,Vt,Ks,Zt,za="The key question is: “Does my use case require behavior that differs significantly from general-purpose conversation?” If yes, SFT is likely beneficial.",tl,At,Fa="Decision framework: Use this checklist to determine if SFT is appropriate for your project:",el,Qt,Ea="<li>Have you tried prompt engineering with existing instruction-tuned models?</li> <li>Do you need consistent output formats that prompting cannot achieve?</li> <li>Is your domain specialized enough that general models struggle?</li> <li>Do you have high-quality training data (at least 1,000 examples)?</li> <li>Do you have the computational resources for training and evaluation?</li>",sl,Yt,Ba="If you answered “yes” to most of these, SFT is likely worth pursuing.",ll,Xt,nl,Dt,Ga="Now let’s move on to the process of SFT itself. The SFT process follows a systematic approach that ensures high-quality results:",al,Ot,il,Kt,Ra="The quality of your training data is the most critical factor for successful SFT. Unlike pre-training where quantity often matters most, SFT prioritizes quality and relevance. Your dataset should contain input-output pairs that demonstrate exactly the behavior you want your model to learn.",rl,te,qa="<strong>Choose the Right Dataset</strong>:",ol,ee,Na="<li>SmolTalk2: The dataset used to train SmolLM3, containing high-quality instruction-response pairs.</li> <li>Domain-specific datasets: For specialized applications (medical, legal, technical).</li> <li>Custom datasets: Your own curated examples for specific use cases.</li>",pl,se,Wa="Each training example should consist of:",ul,le,Pa="<li><strong>Input prompt</strong>: The user’s instruction or question</li> <li><strong>Expected response</strong>: The ideal assistant response</li> <li><strong>Context</strong> (optional): Any additional information needed</li>",cl,jt,ml,ne,hl,ae,Va="To set up an environment for SFT, we will need advance compute resources. We have three main options:",fl,ie,Za='<li><strong>Local GPU</strong>: If you are lucky enough to have a access to a GPU with (at least 16GB of VRAM), you can train your model locally!</li> <li><strong>Hugging Face Jobs</strong>: If you don’t have a GPU and don’t want to use a cloud provider, you can use Hugging Face Jobs! We’ll go into more detail about this in the <a href="./5">next section</a>.</li> <li><strong>Notebook GPUs</strong>: If you like to use a notebook provider like Google Colab, you can use their GPUs!</li> <li><strong>Cloud GPU</strong>: If you want to take control of your compute resources, you can use a cloud provider like AWS, GCP, or Azure.</li>',gl,re,Aa="In terms of hardware requirements, you will need a GPU with at least 16GB of VRAM, for example an Nvidia RTX 4080 or A10G.",dl,oe,Tl,pe,Qa="Choosing the right hyperparameters is crucial for successful SFT. The goal is to find the sweet spot where the model learns effectively without overfitting or becoming unstable. Here’s a detailed breakdown of each parameter and how to choose them:",wl,ue,Ya="<strong>Key Hyperparameters</strong>:",Ml,ce,Xa="<strong>Learning Rate</strong> (5e-5 to 1e-4): Controls how much the model weights change with each update",yl,me,Da="<li>Start with 5e-5 for SmolLM3; this is conservative and stable.</li> <li>Too high: The model becomes unstable; loss oscillates or explodes.</li> <li>Too low: The model learns very slowly and may not converge in reasonable time.</li>",vl,he,Oa="<strong>Batch Size</strong> (4-16): Number of examples processed simultaneously",$l,fe,Ka="<li>Larger batches: More stable gradients, but require more GPU memory.</li> <li>Smaller batches: Less memory usage, but noisier gradients.</li> <li>Use gradient accumulation to achieve larger effective batch sizes.</li>",Jl,ge,ti="<strong>Max Sequence Length</strong> (2048-4096): Maximum tokens per training example",Cl,de,ei="<li>Longer sequences: Can handle more complex conversations.</li> <li>Shorter sequences: Faster training, less memory usage.</li> <li>Match your use case: Use the typical length of your target conversations.</li>",bl,Te,si="<strong>Training Steps</strong> (1000-5000): Total number of parameter updates",_l,we,li="<li>Depends on dataset size: More data usually requires more steps.</li> <li>Monitor validation loss: Stop when it stops improving.</li> <li>Rule of thumb: Three to five epochs through your dataset.</li>",jl,Me,ni="<strong>Warmup Steps</strong> (10% of total): Gradual learning rate increase at start",Ul,ye,ai="<li>Prevents early instability: Helps the model adapt gradually.</li> <li>Typical range: 100-500 steps for most SFT tasks.</li>",xl,Ut,Il,ve,kl,$e,ii="Effective monitoring is crucial for successful SFT. Unlike pre-training where you primarily watch loss decrease, SFT requires careful attention to both quantitative metrics and qualitative outputs. The goal is to ensure your model is learning the desired behaviors without overfitting or developing unwanted patterns.",Ll,Je,ri="<strong>Key Metrics to Monitor</strong>:",Sl,Ce,oi="<strong>Training Loss</strong>: Should decrease steadily but not too rapidly",Hl,be,pi="<li>Healthy pattern: Smooth, gradual decrease.</li> <li>Warning signs: Sudden spikes, oscillations, or plateaus.</li> <li>Typical range: Starts around 2-4, should decrease to 0.5-1.5.</li>",zl,_e,ui="<strong>Validation Loss</strong>: Most important metric for preventing overfitting",Fl,je,ci="<li>Should track training loss: A small gap indicates good generalization.</li> <li>Growing gap: Sign of overfitting; the model may be memorizing training data.</li> <li>Use for early stopping: Stop training when validation loss stops improving.</li>",El,Ue,mi="<strong>Sample Outputs</strong>: Regular qualitative checks are essential",Bl,xe,hi="<li>Generate responses: Test the model on held-out prompts during training.</li> <li>Check format consistency: Ensure the model follows desired response patterns.</li> <li>Monitor for degradation: Watch for repetitive or nonsensical outputs.</li>",Gl,Ie,fi="<strong>Resource Usage</strong>: Track GPU memory and training speed",Rl,ke,gi="<li>Memory spikes: May indicate batch size is too large.</li> <li>Slow training: Could suggest inefficient data loading or processing.</li>",ql,Le,Nl,Se,di='Training loss typically follows three distinct phases, as illustrated in this example from the <a href="https://huggingface.co/learn/llm-course/en/chapter11/3" rel="nofollow">Hugging Face LLM Course</a>:',Wl,xt,Ti='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/nlp_course_sft_loss_graphic.png" alt="SFT Training Progress" width="80%"/>',Pl,He,wi="<li><strong>Initial Sharp Drop</strong>: Rapid adaptation to new data distribution</li> <li><strong>Gradual Stabilization</strong>: Learning rate slows as model fine-tunes</li> <li><strong>Convergence</strong>: Loss values stabilize, indicating training completion</li>",Vl,ze,Mi="<strong>Healthy Training Pattern</strong>: The key indicator of successful training is a small gap between training and validation loss, suggesting the model is learning generalizable patterns rather than memorizing specific examples.",Zl,Fe,Al,Ee,yi="Several patterns in the loss curves can indicate potential issues:",Ql,Be,Yl,It,vi='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sft_loss_1.png" alt="SFT Overfitting Pattern" width="80%"/>',Xl,Ge,$i="If validation loss increases while training loss continues to decrease, your model is overfitting. Consider:",Dl,Re,Ji="<li>Reducing training steps or epochs</li> <li>Increasing dataset size or diversity</li> <li>Adding regularization techniques</li> <li>Using early stopping based on validation loss</li>",Ol,qe,Kl,kt,Ci='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sft_loss_2.png" alt="SFT Underfitting Pattern" width="80%"/>',tn,Ne,bi="If loss doesn’t show significant improvement, the model might be:",en,We,_i="<li>Learning too slowly (try increasing learning rate)</li> <li>Struggling with task complexity (check data quality)</li> <li>Hitting architectural limitations (consider different model size)</li>",sn,Pe,ln,Lt,ji='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sft_loss_3.png" alt="SFT Memorization Pattern" width="80%"/>',nn,Ve,Ui="Extremely low loss values could suggest memorization rather than learning. This is concerning if:",an,Ze,xi="<li>Model performs poorly on new, similar examples</li> <li>Outputs lack diversity or creativity</li> <li>Responses are too similar to training examples</li>",rn,St,on,Ae,Ii=`<strong>Experiment Tracking with Trackio</strong>:
For comprehensive experiment tracking, we recommend <strong><a href="https://huggingface.co/docs/trackio" rel="nofollow">Trackio</a></strong> - a lightweight, free experiment tracking library built on Hugging Face infrastructure. Trackio provides:`,pn,Qe,ki="<li>Drop-in replacement: API compatible with <code>wandb.init</code>, <code>wandb.log</code>, and <code>wandb.finish</code>.</li> <li>Local-first design: Dashboard runs locally by default, with optional Hugging Face Spaces hosting.</li> <li>Free hosting: Everything, including hosting on Hugging Face Spaces, is free.</li> <li>Lightweight: Fewer than 3,000 lines of Python code, easily extensible.</li>",un,Ye,Li="We can track any metrics during training, for example:",cn,Xe,mn,De,Si="The most convenient way to track your training is to use trackio’s <code>transformers</code> integration. You can specify your Trackio project name and space ID using environment variables:",hn,Oe,fn,Ke,Hi="Or you can set them in your code:",gn,ts,dn,es,zi="Then you can use the <code>SFTTrainer</code> class from TRL to track your training and let it handle the tracking for you.",Tn,ss,wn,ls,Fi="Trackio will serve an application with the metrics from training that looks like this:",Mn,ot,Ei,yn,ns,vn,as,Bi="While training and evaluating we record the following reward metrics:",$n,is,Gi="<li><code>global_step</code>: The total number of optimizer steps taken so far.</li> <li><code>epoch</code>: The current epoch number, based on dataset iteration.</li> <li><code>num_tokens</code>: The total number of tokens processed so far.</li> <li><code>loss</code>: The average cross-entropy loss computed over non-masked tokens in the current logging interval.</li> <li><code>entropy</code>: The average entropy of the model’s predicted token distribution over non-masked tokens.</li> <li><code>mean_token_accuracy</code>: The proportion of non-masked tokens for which the model’s top-1 prediction matches the ground truth token.</li> <li><code>learning_rate</code>: The current learning rate, which may change dynamically if a scheduler is used.</li> <li><code>grad_norm</code>: The L2 norm of the gradients, computed before gradient clipping.</li>",Jn,rs,Cn,os,Ri='SFT supports both <a href="https://huggingface.co/docs/trl/dataset_formats#language-modeling" rel="nofollow">language modeling</a> and <a href="%5Bdataset_formats%5D(https://huggingface.co/docs/trl/dataset_formats)#prompt-completion">prompt-completion</a> datasets. The [<code>SFTTrainer</code>] is compatible with both <a href="%5Bdataset_formats%5D(https://huggingface.co/docs/trl/dataset_formats)#standard">standard</a> and <a href="%5Bdataset_formats%5D(https://huggingface.co/docs/trl/dataset_formats)#conversational">conversational</a> dataset formats. When provided with a conversational dataset, the trainer will automatically apply the chat template to the dataset.',bn,ps,_n,us,qi='If your dataset is not in one of these formats, you can preprocess it to convert it into the expected format. Here is an example with the <a href="https://huggingface.co/datasets/FreedomIntelligence/medical-o1-reasoning-SFT" rel="nofollow">FreedomIntelligence/medical-o1-reasoning-SFT</a> dataset:',jn,cs,Un,ms,xn,hs,In,fs,Ni="We’ll return briefly to chat templates in the context of training. Using chat templates correctly during training is crucial for model performance. Here are the key considerations and best practices:",kn,gs,Ln,ds,Wi=`During training, each example is expected to contain a <strong>text field</strong> or a <strong>(prompt, completion)</strong> pair, depending on the dataset format. For more details on the expected formats, see <a href="https://huggingface.co/docs/trl/dataset_formats" rel="nofollow">Dataset formats</a>.
The <a href="https://huggingface.co/docs/trl/sft_trainer" rel="nofollow"><code>SFTTrainer</code></a> tokenizes each input using the model’s tokenizer. If both prompt and completion are provided separately, they are concatenated before tokenization.`,Sn,Ts,Hn,ws,Pi='<img src="https://huggingface.co/datasets/trl-lib/documentation-images/resolve/main/sft_figure.png" alt="sft_figure"/>',zn,Mt,ba,Zs,Vi="token-level cross-entropy loss",_a,Fn,$r=`<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi mathvariant="script">L</mi><mtext>SFT</mtext></msub><mo stretchy="false">(</mo><mi>θ</mi><mo stretchy="false">)</mo><mo>=</mo><mo>−</mo><munderover><mo>∑</mo><mrow><mi>t</mi><mo>=</mo><mn>1</mn></mrow><mi>T</mi></munderover><mi>log</mi><mo>⁡</mo><msub><mi>p</mi><mi>θ</mi></msub><mo stretchy="false">(</mo><msub><mi>y</mi><mi>t</mi></msub><mo>∣</mo><msub><mi>y</mi><mrow><mo>&lt;</mo><mi>t</mi></mrow></msub><mo stretchy="false">)</mo><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">
\\mathcal{L}_{\\text{SFT}}(\\theta) = - \\sum_{t=1}^{T} \\log p_\\theta(y_t \\mid y_{&lt;t}),
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathcal">L</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">SFT</span></span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:3.0954em;vertical-align:-1.2671em;"></span><span class="mord">−</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop op-limits"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.8283em;"><span style="top:-1.8829em;margin-left:0em;"><span class="pstrut" style="height:3.05em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">t</span><span class="mrel mtight">=</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.05em;"><span class="pstrut" style="height:3.05em;"></span><span><span class="mop op-symbol large-op">∑</span></span></span><span style="top:-4.3em;margin-left:0em;"><span class="pstrut" style="height:3.05em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.13889em;">T</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.2671em;"><span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.02778em;">θ</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.2806em;"><span style="top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">t</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∣</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.2806em;"><span style="top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mrel mtight">&lt;</span><span class="mord mathnormal mtight">t</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1774em;"><span></span></span></span></span></span></span><span class="mclose">)</span><span class="mpunct">,</span></span></span></span></span>`,En,Tt,ja,Bn,Jr='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>y</mi><mi>t</mi></msub></mrow><annotation encoding="application/x-tex"> y_t </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.2806em;"><span style="top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">t</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>',Gn,Rn,Cr='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>t</mi></mrow><annotation encoding="application/x-tex"> t </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6151em;"></span><span class="mord mathnormal">t</span></span></span></span>',qn,Nn,Ms,Wn,ys,Zi="Specifically, we need to make sure that we are not adding special tokens twice. For example, if we are using a chat template, we should not add special tokens like <code>[BOS]</code> or <code>[EOS]</code> twice.",Pn,vs,Vn,Ht,Zn,$s,An,Js,Ai="<strong>TRL</strong> is the go-to toolkit for training language models, built specifically for instruction tuning and alignment. It’s what we’ll use throughout this course.",Qn,Cs,Yn,bs,Qi="<li>Production ready: Used by major organizations and research labs.</li> <li>Comprehensive: Supports SFT, DPO, ORPO, PPO, and more advanced techniques.</li> <li>Efficient: Optimized for memory usage and training speed.</li> <li>Flexible: Works with any Hugging Face model.</li> <li>CLI support: Command-line tools for scalable training workflows.</li>",Xn,_s,Dn,js,Yi="<li><strong>SFTTrainer</strong>: The core class for supervised fine-tuning</li> <li><strong>SFTConfig</strong>: Configuration management for training parameters</li> <li><strong>CLI Tools</strong>: Command-line interface for production workflows</li> <li><strong>Integration</strong>: Seamless integration with Hugging Face Hub, Trackio, Weights &amp; Biases, and more</li>",On,Us,Kn,xs,Xi="TRL is built on top of the Hugging Face ecosystem:",ta,Is,Di="<li>Transformers: Model loading and inference.</li> <li>Datasets: Data processing and management.</li> <li>Accelerate: Distributed training and optimization.</li> <li>PEFT: Parameter-efficient fine-tuning (LoRA, QLoRA).</li>",ea,ks,Oi="This integrated approach means you get all the benefits of the Hugging Face ecosystem while using state-of-the-art training techniques.",sa,zt,la,Ls,na,Ss,Ki="Ready to put theory into practice? Here’s a preview of what you’ll build in the exercises. You can use either Python or CLI approach:",aa,Hs,ia,zs,ra,Fs,tr="While you can train models locally, cloud infrastructure offers significant advantages for SFT training. For users who want to skip the complexity of GPU setup and environment management, <strong>Hugging Face Jobs</strong> provides a seamless solution.",oa,Es,er='See <a href="./5">Training with Hugging Face Jobs</a> for fully managed cloud infrastructure with high-end GPUs, automatic scaling, and integrated monitoring.',pa,Bs,ua,Gs,sr="<li><strong>SFT is Essential</strong>: It’s the bridge between base models and instruction-following assistants</li> <li><strong>Data Quality Matters</strong>: High-quality datasets lead to better fine-tuned models - invest time in curation</li> <li><strong>Monitor Carefully</strong>: Watch both loss curves and actual outputs to catch issues early</li> <li><strong>TRL Simplifies Everything</strong>: From research to production, TRL provides the tools you need</li> <li><strong>SmolLM3 is Perfect for Learning</strong>: Powerful enough to be useful, small enough to be accessible</li> <li><strong>Multiple Approaches</strong>: Both programmatic and CLI workflows for different use cases</li>",ca,Ft,ma,Rs,ha,qs,lr="Now that you understand the theory, choose your training approach:",fa,Ns,nr=`<a href="./5">Training with Hugging Face Jobs</a> - Use cloud infrastructure for training
<a href="./4">Hands-On Exercises</a> - Fine-tune your own SmolLM3 model locally or in the cloud`,ga,Ws,da,Ps,ar='<li><a href="./5">Training with Hugging Face Jobs</a> - Cloud-based training with managed infrastructure</li> <li><a href="https://huggingface.co/docs/trackio" rel="nofollow">Trackio Documentation</a> - Free, lightweight experiment tracking</li> <li><a href="https://huggingface.co/docs/trl" rel="nofollow">TRL Documentation</a> - Comprehensive guide to all TRL features</li> <li><a href="https://huggingface.co/docs/trl/sft_trainer" rel="nofollow">SFTTrainer API Reference</a> - Detailed parameter documentation</li> <li><a href="https://huggingface.co/datasets/HuggingFaceTB/smoltalk2" rel="nofollow">SmolTalk2 Dataset</a> - The dataset that trained SmolLM3</li> <li><a href="https://huggingface.co/HuggingFaceTB/SmolLM3-3B" rel="nofollow">SmolLM3 Model Card</a> - Official model documentation</li> <li><a href="https://huggingface.co/docs/trl/clis" rel="nofollow">TRL CLI Documentation</a> - Command-line interface guide</li>',Ta,Vs,wa,Ys,Ma;return c=new B({props:{title:"Supervised Fine-Tuning with SmolLM3",local:"supervised-fine-tuning-with-smollm3",headingTag:"h1"}}),j=new B({props:{title:"What is Supervised Fine-Tuning?",local:"what-is-supervised-fine-tuning",headingTag:"h2"}}),E=new Bt({props:{$$slots:{default:[oo]},$$scope:{ctx:f}}}),K=new B({props:{title:"The SmolLM3 SFT Journey",local:"the-smollm3-sft-journey",headingTag:"h3"}}),lt=new B({props:{title:"Why SFT Works: The Science Behind It",local:"why-sft-works-the-science-behind-it",headingTag:"h2"}}),_t=new Bt({props:{$$slots:{default:[po]},$$scope:{ctx:f}}}),Vt=new B({props:{title:"When to Use Supervised Fine-Tuning",local:"when-to-use-supervised-fine-tuning",headingTag:"h2"}}),Xt=new B({props:{title:"The SFT Process",local:"the-sft-process",headingTag:"h2"}}),Ot=new B({props:{title:"1. Dataset Preparation and Selection",local:"1-dataset-preparation-and-selection",headingTag:"h3"}}),jt=new Bt({props:{$$slots:{default:[uo]},$$scope:{ctx:f}}}),ne=new B({props:{title:"2. Environment Setup and Configuration",local:"2-environment-setup-and-configuration",headingTag:"h3"}}),oe=new B({props:{title:"3. Training Configuration",local:"3-training-configuration",headingTag:"h3"}}),Ut=new Bt({props:{$$slots:{default:[co]},$$scope:{ctx:f}}}),ve=new B({props:{title:"4. Monitoring and Evaluation",local:"4-monitoring-and-evaluation",headingTag:"h3"}}),Le=new B({props:{title:"Understanding Loss Patterns in SFT",local:"understanding-loss-patterns-in-sft",headingTag:"h2"}}),Fe=new B({props:{title:"Warning Signs to Watch For",local:"warning-signs-to-watch-for",headingTag:"h2"}}),Be=new B({props:{title:"Overfitting Pattern",local:"overfitting-pattern",headingTag:"h3"}}),qe=new B({props:{title:"Underfitting Pattern",local:"underfitting-pattern",headingTag:"h3"}}),Pe=new B({props:{title:"Potential Memorization",local:"potential-memorization",headingTag:"h3"}}),St=new Bt({props:{$$slots:{default:[mo]},$$scope:{ctx:f}}}),Xe=new vt({props:{code:"JTIzJTIwU2ltcGxlJTIwVHJhY2tpbyUyMGludGVncmF0aW9uJTBBaW1wb3J0JTIwdHJhY2tpbyUwQSUwQSUyMyUyMEluaXRpYWxpemUlMjB0cmFja2luZyUwQXRyYWNraW8uaW5pdChwcm9qZWN0JTNEJTIyc21vbGxtMy1zZnQlMjIpJTBBJTBBJTIzJTIwTG9nJTIwbWV0cmljcyUyMGR1cmluZyUyMHRyYWluaW5nJTBBdHJhY2tpby5sb2coJTdCJTIydHJhaW5faW5fbG9zcyUyMiUzQSUyMDAuNSUyQyUyMCUyMmxlYXJuaW5nX3JhdGUlMjIlM0ElMjA1ZS01JTdEKSUwQSUwQSUyMyUyMEZpbmlzaCUyMHRyYWNraW5nJTBBdHJhY2tpby5maW5pc2goKQ==",highlighted:`<span class="hljs-comment"># Simple Trackio integration</span>
<span class="hljs-keyword">import</span> trackio

<span class="hljs-comment"># Initialize tracking</span>
trackio.init(project=<span class="hljs-string">&quot;smollm3-sft&quot;</span>)

<span class="hljs-comment"># Log metrics during training</span>
trackio.log({<span class="hljs-string">&quot;train_in_loss&quot;</span>: <span class="hljs-number">0.5</span>, <span class="hljs-string">&quot;learning_rate&quot;</span>: <span class="hljs-number">5e-5</span>})

<span class="hljs-comment"># Finish tracking</span>
trackio.finish()`,wrap:!1}}),Oe=new vt({props:{code:"ZXhwb3J0JTIwVFJBQ0tJT19QUk9KRUNUX05BTUUlM0QlMjJteS1wcm9qZWN0JTIyJTBBZXhwb3J0JTIwVFJBQ0tJT19TUEFDRV9JRCUzRCUyMnVzZXJuYW1lJTJGc3BhY2VfaWQlMjI=",highlighted:`<span class="hljs-built_in">export</span> TRACKIO_PROJECT_NAME=<span class="hljs-string">&quot;my-project&quot;</span>
<span class="hljs-built_in">export</span> TRACKIO_SPACE_ID=<span class="hljs-string">&quot;username/space_id&quot;</span>`,wrap:!1}}),ts=new vt({props:{code:"aW1wb3J0JTIwb3MlMEElMEFvcy5lbnZpcm9uJTVCJTIyVFJBQ0tJT19QUk9KRUNUX05BTUUlMjIlNUQlMjAlM0QlMjAlMjJteS1wcm9qZWN0JTIyJTBBb3MuZW52aXJvbiU1QiUyMlRSQUNLSU9fU1BBQ0VfSUQlMjIlNUQlMjAlM0QlMjAlMjJ1c2VybmFtZSUyRnNwYWNlX2lkJTIy",highlighted:`<span class="hljs-keyword">import</span> os

os.environ[<span class="hljs-string">&quot;TRACKIO_PROJECT_NAME&quot;</span>] = <span class="hljs-string">&quot;my-project&quot;</span>
os.environ[<span class="hljs-string">&quot;TRACKIO_SPACE_ID&quot;</span>] = <span class="hljs-string">&quot;username/space_id&quot;</span>`,wrap:!1}}),ss=new vt({props:{code:"ZnJvbSUyMHRybCUyMGltcG9ydCUyMFNGVFRyYWluZXIlMEElMEF0cmFpbmVyJTIwJTNEJTIwU0ZUVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRGRhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0Rjb25maWclMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> trl <span class="hljs-keyword">import</span> SFTTrainer

trainer = SFTTrainer(
    model=model,
    tokenizer=tokenizer,
    train_dataset=dataset[<span class="hljs-string">&quot;train&quot;</span>],
    args=config,
)`,wrap:!1}}),ns=new B({props:{title:"Logged metrics",local:"logged-metrics",headingTag:"h2"}}),rs=new B({props:{title:"Expected dataset type and format",local:"expected-dataset-type-and-format",headingTag:"h2"}}),ps=new vt({props:{code:"JTIzJTIwU3RhbmRhcmQlMjBsYW5ndWFnZSUyMG1vZGVsaW5nJTBBJTdCJTIydGV4dCUyMiUzQSUyMCUyMlRoZSUyMHNreSUyMGlzJTIwYmx1ZS4lMjIlN0QlMEElMEElMjMlMjBDb252ZXJzYXRpb25hbCUyMGxhbmd1YWdlJTIwbW9kZWxpbmclMEElN0IlMjJtZXNzYWdlcyUyMiUzQSUyMCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMldoYXQlMjBjb2xvciUyMGlzJTIwdGhlJTIwc2t5JTNGJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMmFzc2lzdGFudCUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJJdCUyMGlzJTIwYmx1ZS4lMjIlN0QlNUQlN0QlMEElMEElMjMlMjBTdGFuZGFyZCUyMHByb21wdC1jb21wbGV0aW9uJTBBJTdCJTIycHJvbXB0JTIyJTNBJTIwJTIyVGhlJTIwc2t5JTIwaXMlMjIlMkMlMEElMjAlMjJjb21wbGV0aW9uJTIyJTNBJTIwJTIyJTIwYmx1ZS4lMjIlN0QlMEElMEElMjMlMjBDb252ZXJzYXRpb25hbCUyMHByb21wdC1jb21wbGV0aW9uJTBBJTdCJTIycHJvbXB0JTIyJTNBJTIwJTVCJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIyV2hhdCUyMGNvbG9yJTIwaXMlMjB0aGUlMjBza3klM0YlMjIlN0QlNUQlMkMlMEElMjAlMjJjb21wbGV0aW9uJTIyJTNBJTIwJTVCJTdCJTIycm9sZSUyMiUzQSUyMCUyMmFzc2lzdGFudCUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJJdCUyMGlzJTIwYmx1ZS4lMjIlN0QlNUQlN0Q=",highlighted:`<span class="hljs-comment"># Standard language modeling</span>
{<span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;The sky is blue.&quot;</span>}

<span class="hljs-comment"># Conversational language modeling</span>
{<span class="hljs-string">&quot;messages&quot;</span>: [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;What color is the sky?&quot;</span>},
              {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;It is blue.&quot;</span>}]}

<span class="hljs-comment"># Standard prompt-completion</span>
{<span class="hljs-string">&quot;prompt&quot;</span>: <span class="hljs-string">&quot;The sky is&quot;</span>,
 <span class="hljs-string">&quot;completion&quot;</span>: <span class="hljs-string">&quot; blue.&quot;</span>}

<span class="hljs-comment"># Conversational prompt-completion</span>
{<span class="hljs-string">&quot;prompt&quot;</span>: [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;What color is the sky?&quot;</span>}],
 <span class="hljs-string">&quot;completion&quot;</span>: [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;It is blue.&quot;</span>}]}`,wrap:!1}}),cs=new vt({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJGcmVlZG9tSW50ZWxsaWdlbmNlJTJGbWVkaWNhbC1vMS1yZWFzb25pbmctU0ZUJTIyJTJDJTIwJTIyZW4lMjIpJTBBJTBBZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlKSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnByb21wdCUyMiUzQSUyMCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMGV4YW1wbGUlNUIlMjJRdWVzdGlvbiUyMiU1RCU3RCU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmNvbXBsZXRpb24lMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIyYXNzaXN0YW50JTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMGYlMjIlM0N0aGluayUzRSU3QmV4YW1wbGUlNUInQ29tcGxleF9Db1QnJTVEJTdEJTNDJTJGdGhpbmslM0UlN0JleGFtcGxlJTVCJ1Jlc3BvbnNlJyU1RCU3RCUyMiU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBkYXRhc2V0Lm1hcChwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTIwcmVtb3ZlX2NvbHVtbnMlM0QlNUIlMjJRdWVzdGlvbiUyMiUyQyUyMCUyMlJlc3BvbnNlJTIyJTJDJTIwJTIyQ29tcGxleF9Db1QlMjIlNUQpJTBBcHJpbnQobmV4dChpdGVyKGRhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCkpKQ==",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

dataset = load_dataset(<span class="hljs-string">&quot;FreedomIntelligence/medical-o1-reasoning-SFT&quot;</span>, <span class="hljs-string">&quot;en&quot;</span>)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">example</span>):
    <span class="hljs-keyword">return</span> {
        <span class="hljs-string">&quot;prompt&quot;</span>: [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: example[<span class="hljs-string">&quot;Question&quot;</span>]}],
        <span class="hljs-string">&quot;completion&quot;</span>: [
            {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">f&quot;&lt;think&gt;<span class="hljs-subst">{example[<span class="hljs-string">&#x27;Complex_CoT&#x27;</span>]}</span>&lt;/think&gt;<span class="hljs-subst">{example[<span class="hljs-string">&#x27;Response&#x27;</span>]}</span>&quot;</span>}
        ],
    }

dataset = dataset.<span class="hljs-built_in">map</span>(preprocess_function, remove_columns=[<span class="hljs-string">&quot;Question&quot;</span>, <span class="hljs-string">&quot;Response&quot;</span>, <span class="hljs-string">&quot;Complex_CoT&quot;</span>])
<span class="hljs-built_in">print</span>(<span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataset[<span class="hljs-string">&quot;train&quot;</span>])))`,wrap:!1}}),ms=new vt({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJTIycHJvbXB0JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkdpdmVuJTIwdGhlJTIwc3ltcHRvbXMlMjBvZiUyMHN1ZGRlbiUyMHdlYWtuZXNzJTIwaW4lMjB0aGUlMjBsZWZ0JTIwYXJtJTIwYW5kJTIwbGVnJTJDJTIwcmVjZW50JTIwbG9uZy1kaXN0YW5jZSUyMHRyYXZlbCUyQyUyMGFuZCUyMHRoZSUyMHByZXNlbmNlJTIwb2YlMjBzd29sbGVuJTIwYW5kJTIwdGVuZGVyJTIwcmlnaHQlMjBsb3dlciUyMGxlZyUyQyUyMHdoYXQlMjBzcGVjaWZpYyUyMGNhcmRpYWMlMjBhYm5vcm1hbGl0eSUyMGlzJTIwbW9zdCUyMGxpa2VseSUyMHRvJTIwYmUlMjBmb3VuZCUyMHVwb24lMjBmdXJ0aGVyJTIwZXZhbHVhdGlvbiUyMHRoYXQlMjBjb3VsZCUyMGV4cGxhaW4lMjB0aGVzZSUyMGZpbmRpbmdzJTNGJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjJjb21wbGV0aW9uJTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMiUzQ3RoaW5rJTNFT2theSUyQyUyMGxldCdzJTIwc2VlJTIwd2hhdCdzJTIwZ29pbmclMjBvbiUyMGhlcmUuJTIwV2UndmUlMjBnb3QlMjBzdWRkZW4lMjB3ZWFrbmVzcyUyMCU1Qi4uLiU1RCUyMGNsaWNrcyUyMGludG8lMjBwbGFjZSElM0MlMkZ0aGluayUzRVRoZSUyMHNwZWNpZmljJTIwY2FyZGlhYyUyMGFibm9ybWFsaXR5JTIwbW9zdCUyMGxpa2VseSUyMHRvJTIwYmUlMjBmb3VuZCUyMGluJTIwJTVCLi4uJTVEJTIwdGhlJTIwcHJlc2VuY2UlMjBvZiUyMGElMjBQRk8lMjBmYWNpbGl0YXRpbmclMjBhJTIwcGFyYWRveGljYWwlMjBlbWJvbGlzbS4lMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIyYXNzaXN0YW50JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTdE",highlighted:`<span class="hljs-punctuation">{</span>
    <span class="hljs-attr">&quot;prompt&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
        <span class="hljs-punctuation">{</span>
            <span class="hljs-attr">&quot;content&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Given the symptoms of sudden weakness in the left arm and leg, recent long-distance travel, and the presence of swollen and tender right lower leg, what specific cardiac abnormality is most likely to be found upon further evaluation that could explain these findings?&quot;</span><span class="hljs-punctuation">,</span>
            <span class="hljs-attr">&quot;role&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;user&quot;</span><span class="hljs-punctuation">,</span>
        <span class="hljs-punctuation">}</span>
    <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;completion&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
        <span class="hljs-punctuation">{</span>
            <span class="hljs-attr">&quot;content&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;&lt;think&gt;Okay, let&#x27;s see what&#x27;s going on here. We&#x27;ve got sudden weakness [...] clicks into place!&lt;/think&gt;The specific cardiac abnormality most likely to be found in [...] the presence of a PFO facilitating a paradoxical embolism.&quot;</span><span class="hljs-punctuation">,</span>
            <span class="hljs-attr">&quot;role&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;assistant&quot;</span><span class="hljs-punctuation">,</span>
        <span class="hljs-punctuation">}</span>
    <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),hs=new B({props:{title:"Chat Templates in Training",local:"chat-templates-in-training",headingTag:"h2"}}),gs=new B({props:{title:"Preprocessing and tokenization",local:"preprocessing-and-tokenization",headingTag:"h3"}}),Ts=new B({props:{title:"Computing the loss",local:"computing-the-loss",headingTag:"h3"}}),Ms=new B({props:{title:"Handling Special Tokens During Training",local:"handling-special-tokens-during-training",headingTag:"h3"}}),vs=new vt({props:{code:"JTIzJTIwQ09SUkVDVCUzQSUyMExldCUyMHRoZSUyMHRlbXBsYXRlJTIwaGFuZGxlJTIwc3BlY2lhbCUyMHRva2VucyUwQWZvcm1hdHRlZF90ZXh0JTIwJTNEJTIwdG9rZW5pemVyLmFwcGx5X2NoYXRfdGVtcGxhdGUoJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZSUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNERmFsc2UlMEEpJTBBJTBBJTIzJTIwVGhlbiUyMHRva2VuaXplJTIwc2VwYXJhdGVseSUyMHdpdGglMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSUwQXRva2VucyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjBmb3JtYXR0ZWRfdGV4dCUyQyUwQSUyMCUyMCUyMCUyMGFkZF9zcGVjaWFsX3Rva2VucyUzREZhbHNlJTJDJTIwJTIwJTIzJTIwVGVtcGxhdGUlMjBhbHJlYWR5JTIwaW5jbHVkZXMlMjB3aGF0JTIwd2UlMjBuZWVkJTBBJTIwJTIwJTIwJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNEMjA0OCUwQSklMEElMEElMjMlMjBJTkNPUlJFQ1QlM0ElMjBBZGRpbmclMjBzcGVjaWFsJTIwdG9rZW5zJTIwdHdpY2UlMEElMjMlMjBUaGlzJTIwd2lsbCUyMGFkZCUyMEJPUyUyRkVPUyUyMHRva2VucyUyMGluJTIwYWRkaXRpb24lMjB0byUyMGNoYXQlMjB0ZW1wbGF0ZSUyMHRva2VucyUwQXRva2VucyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjBmb3JtYXR0ZWRfdGV4dCUyQyUwQSUyMCUyMCUyMCUyMGFkZF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjAlMjAlMjMlMjBEb24ndCUyMGRvJTIwdGhpcyUyMHdpdGglMjBjaGF0JTIwdGVtcGxhdGVzISUwQSUyMCUyMCUyMCUyMHRydW5jYXRpb24lM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwbWF4X2xlbmd0aCUzRDIwNDglMEEp",highlighted:`<span class="hljs-comment"># CORRECT: Let the template handle special tokens</span>
formatted_text = tokenizer.apply_chat_template(
    messages,
    tokenize=<span class="hljs-literal">False</span>,
    add_generation_prompt=<span class="hljs-literal">False</span>
)

<span class="hljs-comment"># Then tokenize separately with add_special_tokens=False</span>
tokens = tokenizer(
    formatted_text,
    add_special_tokens=<span class="hljs-literal">False</span>,  <span class="hljs-comment"># Template already includes what we need</span>
    truncation=<span class="hljs-literal">True</span>,
    max_length=<span class="hljs-number">2048</span>
)

<span class="hljs-comment"># INCORRECT: Adding special tokens twice</span>
<span class="hljs-comment"># This will add BOS/EOS tokens in addition to chat template tokens</span>
tokens = tokenizer(
    formatted_text,
    add_special_tokens=<span class="hljs-literal">True</span>,  <span class="hljs-comment"># Don&#x27;t do this with chat templates!</span>
    truncation=<span class="hljs-literal">True</span>,
    max_length=<span class="hljs-number">2048</span>
)`,wrap:!1}}),Ht=new Bt({props:{$$slots:{default:[ho]},$$scope:{ctx:f}}}),$s=new B({props:{title:"Supervised Fine-Tuning with TRL (Transformer Reinforcement Learning)",local:"supervised-fine-tuning-with-trl-transformer-reinforcement-learning",headingTag:"h2"}}),Cs=new B({props:{title:"Why TRL?",local:"why-trl",headingTag:"h3"}}),_s=new B({props:{title:"Key Components",local:"key-components",headingTag:"h3"}}),Us=new B({props:{title:"TRL’s Architecture",local:"trls-architecture",headingTag:"h3"}}),zt=new Bt({props:{$$slots:{default:[fo]},$$scope:{ctx:f}}}),Ls=new B({props:{title:"Hands-On: Your First SmolLM3 Fine-Tune",local:"hands-on-your-first-smollm3-fine-tune",headingTag:"h2"}}),Hs=new ro({props:{pytorch:!1,tensorflow:!1,jax:!1}}),zs=new B({props:{title:"Severless Training Options",local:"severless-training-options",headingTag:"h2"}}),Bs=new B({props:{title:"Key Takeaways",local:"key-takeaways",headingTag:"h2"}}),Ft=new Bt({props:{$$slots:{default:[go]},$$scope:{ctx:f}}}),Rs=new B({props:{title:"Next Steps",local:"next-steps",headingTag:"h2"}}),Ws=new B({props:{title:"Resources and Further Reading",local:"resources-and-further-reading",headingTag:"h2"}}),Vs=new xr({props:{source:"https://github.com/huggingface/smol-course/blob/main/units/en/unit1/3.md"}}),{c(){s=m("meta"),p=r(),i=m("p"),a=r(),C(c.$$.fragment),d=r(),w=m("p"),w.innerHTML=v,T=r(),C(j.$$.fragment),k=r(),H=m("p"),H.textContent=z,q=r(),R=m("ul"),R.innerHTML=D,S=r(),F=m("p"),F.innerHTML=W,Z=r(),L=m("p"),L.textContent=G,P=r(),C(E.$$.fragment),O=r(),C(K.$$.fragment),ct=r(),tt=m("p"),tt.textContent=$t,mt=r(),et=m("ol"),et.innerHTML=ht,Q=r(),st=m("p"),st.textContent=Jt,ft=r(),C(lt.$$.fragment),X=r(),nt=m("p"),nt.textContent=Ct,gt=r(),Y=m("p"),Y.textContent=V,Nt=r(),A=m("p"),A.innerHTML=Wt,bt=r(),pt=m("p"),pt.innerHTML=ut,dt=r(),rt=m("p"),rt.innerHTML=Sa,Xs=r(),C(_t.$$.fragment),Ds=r(),Pt=m("p"),Pt.textContent=Ha,Os=r(),C(Vt.$$.fragment),Ks=r(),Zt=m("p"),Zt.textContent=za,tl=r(),At=m("p"),At.textContent=Fa,el=r(),Qt=m("ul"),Qt.innerHTML=Ea,sl=r(),Yt=m("p"),Yt.textContent=Ba,ll=r(),C(Xt.$$.fragment),nl=r(),Dt=m("p"),Dt.textContent=Ga,al=r(),C(Ot.$$.fragment),il=r(),Kt=m("p"),Kt.textContent=Ra,rl=r(),te=m("p"),te.innerHTML=qa,ol=r(),ee=m("ul"),ee.innerHTML=Na,pl=r(),se=m("p"),se.textContent=Wa,ul=r(),le=m("ol"),le.innerHTML=Pa,cl=r(),C(jt.$$.fragment),ml=r(),C(ne.$$.fragment),hl=r(),ae=m("p"),ae.textContent=Va,fl=r(),ie=m("ol"),ie.innerHTML=Za,gl=r(),re=m("p"),re.textContent=Aa,dl=r(),C(oe.$$.fragment),Tl=r(),pe=m("p"),pe.textContent=Qa,wl=r(),ue=m("p"),ue.innerHTML=Ya,Ml=r(),ce=m("p"),ce.innerHTML=Xa,yl=r(),me=m("ul"),me.innerHTML=Da,vl=r(),he=m("p"),he.innerHTML=Oa,$l=r(),fe=m("ul"),fe.innerHTML=Ka,Jl=r(),ge=m("p"),ge.innerHTML=ti,Cl=r(),de=m("ul"),de.innerHTML=ei,bl=r(),Te=m("p"),Te.innerHTML=si,_l=r(),we=m("ul"),we.innerHTML=li,jl=r(),Me=m("p"),Me.innerHTML=ni,Ul=r(),ye=m("ul"),ye.innerHTML=ai,xl=r(),C(Ut.$$.fragment),Il=r(),C(ve.$$.fragment),kl=r(),$e=m("p"),$e.textContent=ii,Ll=r(),Je=m("p"),Je.innerHTML=ri,Sl=r(),Ce=m("p"),Ce.innerHTML=oi,Hl=r(),be=m("ul"),be.innerHTML=pi,zl=r(),_e=m("p"),_e.innerHTML=ui,Fl=r(),je=m("ul"),je.innerHTML=ci,El=r(),Ue=m("p"),Ue.innerHTML=mi,Bl=r(),xe=m("ul"),xe.innerHTML=hi,Gl=r(),Ie=m("p"),Ie.innerHTML=fi,Rl=r(),ke=m("ul"),ke.innerHTML=gi,ql=r(),C(Le.$$.fragment),Nl=r(),Se=m("p"),Se.innerHTML=di,Wl=r(),xt=m("div"),xt.innerHTML=Ti,Pl=r(),He=m("ol"),He.innerHTML=wi,Vl=r(),ze=m("p"),ze.innerHTML=Mi,Zl=r(),C(Fe.$$.fragment),Al=r(),Ee=m("p"),Ee.textContent=yi,Ql=r(),C(Be.$$.fragment),Yl=r(),It=m("div"),It.innerHTML=vi,Xl=r(),Ge=m("p"),Ge.textContent=$i,Dl=r(),Re=m("ul"),Re.innerHTML=Ji,Ol=r(),C(qe.$$.fragment),Kl=r(),kt=m("div"),kt.innerHTML=Ci,tn=r(),Ne=m("p"),Ne.textContent=bi,en=r(),We=m("ul"),We.innerHTML=_i,sn=r(),C(Pe.$$.fragment),ln=r(),Lt=m("div"),Lt.innerHTML=ji,nn=r(),Ve=m("p"),Ve.textContent=Ui,an=r(),Ze=m("ul"),Ze.innerHTML=xi,rn=r(),C(St.$$.fragment),on=r(),Ae=m("p"),Ae.innerHTML=Ii,pn=r(),Qe=m("ul"),Qe.innerHTML=ki,un=r(),Ye=m("p"),Ye.textContent=Li,cn=r(),C(Xe.$$.fragment),mn=r(),De=m("p"),De.innerHTML=Si,hn=r(),C(Oe.$$.fragment),fn=r(),Ke=m("p"),Ke.textContent=Hi,gn=r(),C(ts.$$.fragment),dn=r(),es=m("p"),es.innerHTML=zi,Tn=r(),C(ss.$$.fragment),wn=r(),ls=m("p"),ls.textContent=Fi,Mn=r(),ot=m("iframe"),yn=r(),C(ns.$$.fragment),vn=r(),as=m("p"),as.textContent=Bi,$n=r(),is=m("ul"),is.innerHTML=Gi,Jn=r(),C(rs.$$.fragment),Cn=r(),os=m("p"),os.innerHTML=Ri,bn=r(),C(ps.$$.fragment),_n=r(),us=m("p"),us.innerHTML=qi,jn=r(),C(cs.$$.fragment),Un=r(),C(ms.$$.fragment),xn=r(),C(hs.$$.fragment),In=r(),fs=m("p"),fs.textContent=Ni,kn=r(),C(gs.$$.fragment),Ln=r(),ds=m("p"),ds.innerHTML=Wi,Sn=r(),C(Ts.$$.fragment),Hn=r(),ws=m("p"),ws.innerHTML=Pi,zn=r(),Mt=m("p"),ba=at("The loss used in SFT is the "),Zs=m("strong"),Zs.textContent=Vi,_a=at(`, defined as:
`),Fn=new Ua(!1),En=r(),Tt=m("p"),ja=at("where "),Bn=new Ua(!1),Gn=at(" is the target token at timestep "),Rn=new Ua(!1),qn=at(", and the model is trained to predict the next token given the previous ones. In practice, padding tokens are masked out during loss computation."),Nn=r(),C(Ms.$$.fragment),Wn=r(),ys=m("p"),ys.innerHTML=Zi,Pn=r(),C(vs.$$.fragment),Vn=r(),C(Ht.$$.fragment),Zn=r(),C($s.$$.fragment),An=r(),Js=m("p"),Js.innerHTML=Ai,Qn=r(),C(Cs.$$.fragment),Yn=r(),bs=m("ul"),bs.innerHTML=Qi,Xn=r(),C(_s.$$.fragment),Dn=r(),js=m("ul"),js.innerHTML=Yi,On=r(),C(Us.$$.fragment),Kn=r(),xs=m("p"),xs.textContent=Xi,ta=r(),Is=m("ul"),Is.innerHTML=Di,ea=r(),ks=m("p"),ks.textContent=Oi,sa=r(),C(zt.$$.fragment),la=r(),C(Ls.$$.fragment),na=r(),Ss=m("p"),Ss.textContent=Ki,aa=r(),C(Hs.$$.fragment),ia=r(),C(zs.$$.fragment),ra=r(),Fs=m("p"),Fs.innerHTML=tr,oa=r(),Es=m("p"),Es.innerHTML=er,pa=r(),C(Bs.$$.fragment),ua=r(),Gs=m("ol"),Gs.innerHTML=sr,ca=r(),C(Ft.$$.fragment),ma=r(),C(Rs.$$.fragment),ha=r(),qs=m("p"),qs.textContent=lr,fa=r(),Ns=m("p"),Ns.innerHTML=nr,ga=r(),C(Ws.$$.fragment),da=r(),Ps=m("ul"),Ps.innerHTML=ar,Ta=r(),C(Vs.$$.fragment),wa=r(),Ys=m("p"),this.h()},l(t){const l=Ur("svelte-u9bgzb",document.head);s=h(l,"META",{name:!0,content:!0}),l.forEach(e),p=o(t),i=h(t,"P",{}),J(i).forEach(e),a=o(t),U(c.$$.fragment,t),d=o(t),w=h(t,"P",{"data-svelte-h":!0}),g(w)!=="svelte-1hvcf7e"&&(w.innerHTML=v),T=o(t),U(j.$$.fragment,t),k=o(t),H=h(t,"P",{"data-svelte-h":!0}),g(H)!=="svelte-1g5s605"&&(H.textContent=z),q=o(t),R=h(t,"UL",{"data-svelte-h":!0}),g(R)!=="svelte-134jdqf"&&(R.innerHTML=D),S=o(t),F=h(t,"P",{"data-svelte-h":!0}),g(F)!=="svelte-esn93p"&&(F.innerHTML=W),Z=o(t),L=h(t,"P",{"data-svelte-h":!0}),g(L)!=="svelte-6oflwk"&&(L.textContent=G),P=o(t),U(E.$$.fragment,t),O=o(t),U(K.$$.fragment,t),ct=o(t),tt=h(t,"P",{"data-svelte-h":!0}),g(tt)!=="svelte-7muruq"&&(tt.textContent=$t),mt=o(t),et=h(t,"OL",{"data-svelte-h":!0}),g(et)!=="svelte-18hqen9"&&(et.innerHTML=ht),Q=o(t),st=h(t,"P",{"data-svelte-h":!0}),g(st)!=="svelte-sxwgp4"&&(st.textContent=Jt),ft=o(t),U(lt.$$.fragment,t),X=o(t),nt=h(t,"P",{"data-svelte-h":!0}),g(nt)!=="svelte-e5cimt"&&(nt.textContent=Ct),gt=o(t),Y=h(t,"P",{"data-svelte-h":!0}),g(Y)!=="svelte-1mp5ko4"&&(Y.textContent=V),Nt=o(t),A=h(t,"P",{"data-svelte-h":!0}),g(A)!=="svelte-sieoh"&&(A.innerHTML=Wt),bt=o(t),pt=h(t,"P",{"data-svelte-h":!0}),g(pt)!=="svelte-ltbimo"&&(pt.innerHTML=ut),dt=o(t),rt=h(t,"P",{"data-svelte-h":!0}),g(rt)!=="svelte-g0yej4"&&(rt.innerHTML=Sa),Xs=o(t),U(_t.$$.fragment,t),Ds=o(t),Pt=h(t,"P",{"data-svelte-h":!0}),g(Pt)!=="svelte-je45mq"&&(Pt.textContent=Ha),Os=o(t),U(Vt.$$.fragment,t),Ks=o(t),Zt=h(t,"P",{"data-svelte-h":!0}),g(Zt)!=="svelte-41y7o6"&&(Zt.textContent=za),tl=o(t),At=h(t,"P",{"data-svelte-h":!0}),g(At)!=="svelte-1o0hk8z"&&(At.textContent=Fa),el=o(t),Qt=h(t,"UL",{"data-svelte-h":!0}),g(Qt)!=="svelte-193lxep"&&(Qt.innerHTML=Ea),sl=o(t),Yt=h(t,"P",{"data-svelte-h":!0}),g(Yt)!=="svelte-1mw4ht1"&&(Yt.textContent=Ba),ll=o(t),U(Xt.$$.fragment,t),nl=o(t),Dt=h(t,"P",{"data-svelte-h":!0}),g(Dt)!=="svelte-y72hqd"&&(Dt.textContent=Ga),al=o(t),U(Ot.$$.fragment,t),il=o(t),Kt=h(t,"P",{"data-svelte-h":!0}),g(Kt)!=="svelte-1xd7idi"&&(Kt.textContent=Ra),rl=o(t),te=h(t,"P",{"data-svelte-h":!0}),g(te)!=="svelte-1ntelr7"&&(te.innerHTML=qa),ol=o(t),ee=h(t,"UL",{"data-svelte-h":!0}),g(ee)!=="svelte-10adojx"&&(ee.innerHTML=Na),pl=o(t),se=h(t,"P",{"data-svelte-h":!0}),g(se)!=="svelte-w9ids"&&(se.textContent=Wa),ul=o(t),le=h(t,"OL",{"data-svelte-h":!0}),g(le)!=="svelte-1g7l6v"&&(le.innerHTML=Pa),cl=o(t),U(jt.$$.fragment,t),ml=o(t),U(ne.$$.fragment,t),hl=o(t),ae=h(t,"P",{"data-svelte-h":!0}),g(ae)!=="svelte-1sc5mop"&&(ae.textContent=Va),fl=o(t),ie=h(t,"OL",{"data-svelte-h":!0}),g(ie)!=="svelte-1n2jw16"&&(ie.innerHTML=Za),gl=o(t),re=h(t,"P",{"data-svelte-h":!0}),g(re)!=="svelte-g2j9dx"&&(re.textContent=Aa),dl=o(t),U(oe.$$.fragment,t),Tl=o(t),pe=h(t,"P",{"data-svelte-h":!0}),g(pe)!=="svelte-1jxm75p"&&(pe.textContent=Qa),wl=o(t),ue=h(t,"P",{"data-svelte-h":!0}),g(ue)!=="svelte-1xqd852"&&(ue.innerHTML=Ya),Ml=o(t),ce=h(t,"P",{"data-svelte-h":!0}),g(ce)!=="svelte-1viplg0"&&(ce.innerHTML=Xa),yl=o(t),me=h(t,"UL",{"data-svelte-h":!0}),g(me)!=="svelte-i98tnq"&&(me.innerHTML=Da),vl=o(t),he=h(t,"P",{"data-svelte-h":!0}),g(he)!=="svelte-1l3eo50"&&(he.innerHTML=Oa),$l=o(t),fe=h(t,"UL",{"data-svelte-h":!0}),g(fe)!=="svelte-160spmp"&&(fe.innerHTML=Ka),Jl=o(t),ge=h(t,"P",{"data-svelte-h":!0}),g(ge)!=="svelte-19f3nc0"&&(ge.innerHTML=ti),Cl=o(t),de=h(t,"UL",{"data-svelte-h":!0}),g(de)!=="svelte-8widrw"&&(de.innerHTML=ei),bl=o(t),Te=h(t,"P",{"data-svelte-h":!0}),g(Te)!=="svelte-185it8b"&&(Te.innerHTML=si),_l=o(t),we=h(t,"UL",{"data-svelte-h":!0}),g(we)!=="svelte-1ygxhhv"&&(we.innerHTML=li),jl=o(t),Me=h(t,"P",{"data-svelte-h":!0}),g(Me)!=="svelte-3jvb8b"&&(Me.innerHTML=ni),Ul=o(t),ye=h(t,"UL",{"data-svelte-h":!0}),g(ye)!=="svelte-vjhtjl"&&(ye.innerHTML=ai),xl=o(t),U(Ut.$$.fragment,t),Il=o(t),U(ve.$$.fragment,t),kl=o(t),$e=h(t,"P",{"data-svelte-h":!0}),g($e)!=="svelte-uqwm2f"&&($e.textContent=ii),Ll=o(t),Je=h(t,"P",{"data-svelte-h":!0}),g(Je)!=="svelte-13i4h58"&&(Je.innerHTML=ri),Sl=o(t),Ce=h(t,"P",{"data-svelte-h":!0}),g(Ce)!=="svelte-98pt3v"&&(Ce.innerHTML=oi),Hl=o(t),be=h(t,"UL",{"data-svelte-h":!0}),g(be)!=="svelte-lw98ss"&&(be.innerHTML=pi),zl=o(t),_e=h(t,"P",{"data-svelte-h":!0}),g(_e)!=="svelte-1j8nz3o"&&(_e.innerHTML=ui),Fl=o(t),je=h(t,"UL",{"data-svelte-h":!0}),g(je)!=="svelte-raw32m"&&(je.innerHTML=ci),El=o(t),Ue=h(t,"P",{"data-svelte-h":!0}),g(Ue)!=="svelte-spxpyx"&&(Ue.innerHTML=mi),Bl=o(t),xe=h(t,"UL",{"data-svelte-h":!0}),g(xe)!=="svelte-1agciyc"&&(xe.innerHTML=hi),Gl=o(t),Ie=h(t,"P",{"data-svelte-h":!0}),g(Ie)!=="svelte-1ane394"&&(Ie.innerHTML=fi),Rl=o(t),ke=h(t,"UL",{"data-svelte-h":!0}),g(ke)!=="svelte-1lb15bm"&&(ke.innerHTML=gi),ql=o(t),U(Le.$$.fragment,t),Nl=o(t),Se=h(t,"P",{"data-svelte-h":!0}),g(Se)!=="svelte-semm6q"&&(Se.innerHTML=di),Wl=o(t),xt=h(t,"DIV",{class:!0,"data-svelte-h":!0}),g(xt)!=="svelte-1hwvjks"&&(xt.innerHTML=Ti),Pl=o(t),He=h(t,"OL",{"data-svelte-h":!0}),g(He)!=="svelte-1ne7t84"&&(He.innerHTML=wi),Vl=o(t),ze=h(t,"P",{"data-svelte-h":!0}),g(ze)!=="svelte-1je78zu"&&(ze.innerHTML=Mi),Zl=o(t),U(Fe.$$.fragment,t),Al=o(t),Ee=h(t,"P",{"data-svelte-h":!0}),g(Ee)!=="svelte-1dki5s3"&&(Ee.textContent=yi),Ql=o(t),U(Be.$$.fragment,t),Yl=o(t),It=h(t,"DIV",{class:!0,"data-svelte-h":!0}),g(It)!=="svelte-r9mgcg"&&(It.innerHTML=vi),Xl=o(t),Ge=h(t,"P",{"data-svelte-h":!0}),g(Ge)!=="svelte-1igggnr"&&(Ge.textContent=$i),Dl=o(t),Re=h(t,"UL",{"data-svelte-h":!0}),g(Re)!=="svelte-n2t26q"&&(Re.innerHTML=Ji),Ol=o(t),U(qe.$$.fragment,t),Kl=o(t),kt=h(t,"DIV",{class:!0,"data-svelte-h":!0}),g(kt)!=="svelte-19j9kwt"&&(kt.innerHTML=Ci),tn=o(t),Ne=h(t,"P",{"data-svelte-h":!0}),g(Ne)!=="svelte-143mbts"&&(Ne.textContent=bi),en=o(t),We=h(t,"UL",{"data-svelte-h":!0}),g(We)!=="svelte-24wf1z"&&(We.innerHTML=_i),sn=o(t),U(Pe.$$.fragment,t),ln=o(t),Lt=h(t,"DIV",{class:!0,"data-svelte-h":!0}),g(Lt)!=="svelte-qxd2j9"&&(Lt.innerHTML=ji),nn=o(t),Ve=h(t,"P",{"data-svelte-h":!0}),g(Ve)!=="svelte-7lqy3p"&&(Ve.textContent=Ui),an=o(t),Ze=h(t,"UL",{"data-svelte-h":!0}),g(Ze)!=="svelte-1bluaso"&&(Ze.innerHTML=xi),rn=o(t),U(St.$$.fragment,t),on=o(t),Ae=h(t,"P",{"data-svelte-h":!0}),g(Ae)!=="svelte-1wm6ftv"&&(Ae.innerHTML=Ii),pn=o(t),Qe=h(t,"UL",{"data-svelte-h":!0}),g(Qe)!=="svelte-10kx6rd"&&(Qe.innerHTML=ki),un=o(t),Ye=h(t,"P",{"data-svelte-h":!0}),g(Ye)!=="svelte-1ip66cm"&&(Ye.textContent=Li),cn=o(t),U(Xe.$$.fragment,t),mn=o(t),De=h(t,"P",{"data-svelte-h":!0}),g(De)!=="svelte-13q11en"&&(De.innerHTML=Si),hn=o(t),U(Oe.$$.fragment,t),fn=o(t),Ke=h(t,"P",{"data-svelte-h":!0}),g(Ke)!=="svelte-1c1altp"&&(Ke.textContent=Hi),gn=o(t),U(ts.$$.fragment,t),dn=o(t),es=h(t,"P",{"data-svelte-h":!0}),g(es)!=="svelte-1dn2u5"&&(es.innerHTML=zi),Tn=o(t),U(ss.$$.fragment,t),wn=o(t),ls=h(t,"P",{"data-svelte-h":!0}),g(ls)!=="svelte-r082h"&&(ls.textContent=Fi),Mn=o(t),ot=h(t,"IFRAME",{src:!0,style:!0,height:!0,frameborder:!0}),J(ot).forEach(e),yn=o(t),U(ns.$$.fragment,t),vn=o(t),as=h(t,"P",{"data-svelte-h":!0}),g(as)!=="svelte-132s7j9"&&(as.textContent=Bi),$n=o(t),is=h(t,"UL",{"data-svelte-h":!0}),g(is)!=="svelte-57v9wg"&&(is.innerHTML=Gi),Jn=o(t),U(rs.$$.fragment,t),Cn=o(t),os=h(t,"P",{"data-svelte-h":!0}),g(os)!=="svelte-1sh3kvn"&&(os.innerHTML=Ri),bn=o(t),U(ps.$$.fragment,t),_n=o(t),us=h(t,"P",{"data-svelte-h":!0}),g(us)!=="svelte-i5vrs6"&&(us.innerHTML=qi),jn=o(t),U(cs.$$.fragment,t),Un=o(t),U(ms.$$.fragment,t),xn=o(t),U(hs.$$.fragment,t),In=o(t),fs=h(t,"P",{"data-svelte-h":!0}),g(fs)!=="svelte-15xutic"&&(fs.textContent=Ni),kn=o(t),U(gs.$$.fragment,t),Ln=o(t),ds=h(t,"P",{"data-svelte-h":!0}),g(ds)!=="svelte-8uqv55"&&(ds.innerHTML=Wi),Sn=o(t),U(Ts.$$.fragment,t),Hn=o(t),ws=h(t,"P",{"data-svelte-h":!0}),g(ws)!=="svelte-1nyghd"&&(ws.innerHTML=Pi),zn=o(t),Mt=h(t,"P",{});var Et=J(Mt);ba=it(Et,"The loss used in SFT is the "),Zs=h(Et,"STRONG",{"data-svelte-h":!0}),g(Zs)!=="svelte-ck6oz9"&&(Zs.textContent=Vi),_a=it(Et,`, defined as:
`),Fn=xa(Et,!1),Et.forEach(e),En=o(t),Tt=h(t,"P",{});var yt=J(Tt);ja=it(yt,"where "),Bn=xa(yt,!1),Gn=it(yt," is the target token at timestep "),Rn=xa(yt,!1),qn=it(yt,", and the model is trained to predict the next token given the previous ones. In practice, padding tokens are masked out during loss computation."),yt.forEach(e),Nn=o(t),U(Ms.$$.fragment,t),Wn=o(t),ys=h(t,"P",{"data-svelte-h":!0}),g(ys)!=="svelte-1rkkmgc"&&(ys.innerHTML=Zi),Pn=o(t),U(vs.$$.fragment,t),Vn=o(t),U(Ht.$$.fragment,t),Zn=o(t),U($s.$$.fragment,t),An=o(t),Js=h(t,"P",{"data-svelte-h":!0}),g(Js)!=="svelte-1ggdg9o"&&(Js.innerHTML=Ai),Qn=o(t),U(Cs.$$.fragment,t),Yn=o(t),bs=h(t,"UL",{"data-svelte-h":!0}),g(bs)!=="svelte-eqq1qj"&&(bs.innerHTML=Qi),Xn=o(t),U(_s.$$.fragment,t),Dn=o(t),js=h(t,"UL",{"data-svelte-h":!0}),g(js)!=="svelte-jj4h9l"&&(js.innerHTML=Yi),On=o(t),U(Us.$$.fragment,t),Kn=o(t),xs=h(t,"P",{"data-svelte-h":!0}),g(xs)!=="svelte-atcl90"&&(xs.textContent=Xi),ta=o(t),Is=h(t,"UL",{"data-svelte-h":!0}),g(Is)!=="svelte-16x1hpx"&&(Is.innerHTML=Di),ea=o(t),ks=h(t,"P",{"data-svelte-h":!0}),g(ks)!=="svelte-nz7cxt"&&(ks.textContent=Oi),sa=o(t),U(zt.$$.fragment,t),la=o(t),U(Ls.$$.fragment,t),na=o(t),Ss=h(t,"P",{"data-svelte-h":!0}),g(Ss)!=="svelte-n91lj1"&&(Ss.textContent=Ki),aa=o(t),U(Hs.$$.fragment,t),ia=o(t),U(zs.$$.fragment,t),ra=o(t),Fs=h(t,"P",{"data-svelte-h":!0}),g(Fs)!=="svelte-11r20hl"&&(Fs.innerHTML=tr),oa=o(t),Es=h(t,"P",{"data-svelte-h":!0}),g(Es)!=="svelte-em9smr"&&(Es.innerHTML=er),pa=o(t),U(Bs.$$.fragment,t),ua=o(t),Gs=h(t,"OL",{"data-svelte-h":!0}),g(Gs)!=="svelte-1sh48si"&&(Gs.innerHTML=sr),ca=o(t),U(Ft.$$.fragment,t),ma=o(t),U(Rs.$$.fragment,t),ha=o(t),qs=h(t,"P",{"data-svelte-h":!0}),g(qs)!=="svelte-9mxtw"&&(qs.textContent=lr),fa=o(t),Ns=h(t,"P",{"data-svelte-h":!0}),g(Ns)!=="svelte-iudtc0"&&(Ns.innerHTML=nr),ga=o(t),U(Ws.$$.fragment,t),da=o(t),Ps=h(t,"UL",{"data-svelte-h":!0}),g(Ps)!=="svelte-10f0kg7"&&(Ps.innerHTML=ar),Ta=o(t),U(Vs.$$.fragment,t),wa=o(t),Ys=h(t,"P",{}),J(Ys).forEach(e),this.h()},h(){u(s,"name","hf:doc:metadata"),u(s,"content",wo),u(xt,"class","flex justify-center"),u(It,"class","flex justify-center"),u(kt,"class","flex justify-center"),u(Lt,"class","flex justify-center"),jr(ot.src,Ei="https://trl-lib-trackio.hf.space/?project=trl-documentation&metrics=train/loss,train/mean_token_accuracy,train/num_tokens&sidebar=hidden")||u(ot,"src",Ei),Ia(ot,"width","100%"),Ia(ot,"min-width","300px"),Ia(ot,"max-width","800px"),u(ot,"height","830"),u(ot,"frameborder","0"),Fn.a=null,Bn.a=Gn,Rn.a=qn},m(t,l){M(document.head,s),n(t,p,l),n(t,i,l),n(t,a,l),b(c,t,l),n(t,d,l),n(t,w,l),n(t,T,l),b(j,t,l),n(t,k,l),n(t,H,l),n(t,q,l),n(t,R,l),n(t,S,l),n(t,F,l),n(t,Z,l),n(t,L,l),n(t,P,l),b(E,t,l),n(t,O,l),b(K,t,l),n(t,ct,l),n(t,tt,l),n(t,mt,l),n(t,et,l),n(t,Q,l),n(t,st,l),n(t,ft,l),b(lt,t,l),n(t,X,l),n(t,nt,l),n(t,gt,l),n(t,Y,l),n(t,Nt,l),n(t,A,l),n(t,bt,l),n(t,pt,l),n(t,dt,l),n(t,rt,l),n(t,Xs,l),b(_t,t,l),n(t,Ds,l),n(t,Pt,l),n(t,Os,l),b(Vt,t,l),n(t,Ks,l),n(t,Zt,l),n(t,tl,l),n(t,At,l),n(t,el,l),n(t,Qt,l),n(t,sl,l),n(t,Yt,l),n(t,ll,l),b(Xt,t,l),n(t,nl,l),n(t,Dt,l),n(t,al,l),b(Ot,t,l),n(t,il,l),n(t,Kt,l),n(t,rl,l),n(t,te,l),n(t,ol,l),n(t,ee,l),n(t,pl,l),n(t,se,l),n(t,ul,l),n(t,le,l),n(t,cl,l),b(jt,t,l),n(t,ml,l),b(ne,t,l),n(t,hl,l),n(t,ae,l),n(t,fl,l),n(t,ie,l),n(t,gl,l),n(t,re,l),n(t,dl,l),b(oe,t,l),n(t,Tl,l),n(t,pe,l),n(t,wl,l),n(t,ue,l),n(t,Ml,l),n(t,ce,l),n(t,yl,l),n(t,me,l),n(t,vl,l),n(t,he,l),n(t,$l,l),n(t,fe,l),n(t,Jl,l),n(t,ge,l),n(t,Cl,l),n(t,de,l),n(t,bl,l),n(t,Te,l),n(t,_l,l),n(t,we,l),n(t,jl,l),n(t,Me,l),n(t,Ul,l),n(t,ye,l),n(t,xl,l),b(Ut,t,l),n(t,Il,l),b(ve,t,l),n(t,kl,l),n(t,$e,l),n(t,Ll,l),n(t,Je,l),n(t,Sl,l),n(t,Ce,l),n(t,Hl,l),n(t,be,l),n(t,zl,l),n(t,_e,l),n(t,Fl,l),n(t,je,l),n(t,El,l),n(t,Ue,l),n(t,Bl,l),n(t,xe,l),n(t,Gl,l),n(t,Ie,l),n(t,Rl,l),n(t,ke,l),n(t,ql,l),b(Le,t,l),n(t,Nl,l),n(t,Se,l),n(t,Wl,l),n(t,xt,l),n(t,Pl,l),n(t,He,l),n(t,Vl,l),n(t,ze,l),n(t,Zl,l),b(Fe,t,l),n(t,Al,l),n(t,Ee,l),n(t,Ql,l),b(Be,t,l),n(t,Yl,l),n(t,It,l),n(t,Xl,l),n(t,Ge,l),n(t,Dl,l),n(t,Re,l),n(t,Ol,l),b(qe,t,l),n(t,Kl,l),n(t,kt,l),n(t,tn,l),n(t,Ne,l),n(t,en,l),n(t,We,l),n(t,sn,l),b(Pe,t,l),n(t,ln,l),n(t,Lt,l),n(t,nn,l),n(t,Ve,l),n(t,an,l),n(t,Ze,l),n(t,rn,l),b(St,t,l),n(t,on,l),n(t,Ae,l),n(t,pn,l),n(t,Qe,l),n(t,un,l),n(t,Ye,l),n(t,cn,l),b(Xe,t,l),n(t,mn,l),n(t,De,l),n(t,hn,l),b(Oe,t,l),n(t,fn,l),n(t,Ke,l),n(t,gn,l),b(ts,t,l),n(t,dn,l),n(t,es,l),n(t,Tn,l),b(ss,t,l),n(t,wn,l),n(t,ls,l),n(t,Mn,l),n(t,ot,l),n(t,yn,l),b(ns,t,l),n(t,vn,l),n(t,as,l),n(t,$n,l),n(t,is,l),n(t,Jn,l),b(rs,t,l),n(t,Cn,l),n(t,os,l),n(t,bn,l),b(ps,t,l),n(t,_n,l),n(t,us,l),n(t,jn,l),b(cs,t,l),n(t,Un,l),b(ms,t,l),n(t,xn,l),b(hs,t,l),n(t,In,l),n(t,fs,l),n(t,kn,l),b(gs,t,l),n(t,Ln,l),n(t,ds,l),n(t,Sn,l),b(Ts,t,l),n(t,Hn,l),n(t,ws,l),n(t,zn,l),n(t,Mt,l),M(Mt,ba),M(Mt,Zs),M(Mt,_a),Fn.m($r,Mt),n(t,En,l),n(t,Tt,l),M(Tt,ja),Bn.m(Jr,Tt),M(Tt,Gn),Rn.m(Cr,Tt),M(Tt,qn),n(t,Nn,l),b(Ms,t,l),n(t,Wn,l),n(t,ys,l),n(t,Pn,l),b(vs,t,l),n(t,Vn,l),b(Ht,t,l),n(t,Zn,l),b($s,t,l),n(t,An,l),n(t,Js,l),n(t,Qn,l),b(Cs,t,l),n(t,Yn,l),n(t,bs,l),n(t,Xn,l),b(_s,t,l),n(t,Dn,l),n(t,js,l),n(t,On,l),b(Us,t,l),n(t,Kn,l),n(t,xs,l),n(t,ta,l),n(t,Is,l),n(t,ea,l),n(t,ks,l),n(t,sa,l),b(zt,t,l),n(t,la,l),b(Ls,t,l),n(t,na,l),n(t,Ss,l),n(t,aa,l),b(Hs,t,l),n(t,ia,l),b(zs,t,l),n(t,ra,l),n(t,Fs,l),n(t,oa,l),n(t,Es,l),n(t,pa,l),b(Bs,t,l),n(t,ua,l),n(t,Gs,l),n(t,ca,l),b(Ft,t,l),n(t,ma,l),b(Rs,t,l),n(t,ha,l),n(t,qs,l),n(t,fa,l),n(t,Ns,l),n(t,ga,l),b(Ws,t,l),n(t,da,l),n(t,Ps,l),n(t,Ta,l),b(Vs,t,l),n(t,wa,l),n(t,Ys,l),Ma=!0},p(t,[l]){const Et={};l&2&&(Et.$$scope={dirty:l,ctx:t}),E.$set(Et);const yt={};l&2&&(yt.$$scope={dirty:l,ctx:t}),_t.$set(yt);const ir={};l&2&&(ir.$$scope={dirty:l,ctx:t}),jt.$set(ir);const rr={};l&2&&(rr.$$scope={dirty:l,ctx:t}),Ut.$set(rr);const or={};l&2&&(or.$$scope={dirty:l,ctx:t}),St.$set(or);const pr={};l&2&&(pr.$$scope={dirty:l,ctx:t}),Ht.$set(pr);const ur={};l&2&&(ur.$$scope={dirty:l,ctx:t}),zt.$set(ur);const cr={};l&2&&(cr.$$scope={dirty:l,ctx:t}),Ft.$set(cr)},i(t){Ma||(y(c.$$.fragment,t),y(j.$$.fragment,t),y(E.$$.fragment,t),y(K.$$.fragment,t),y(lt.$$.fragment,t),y(_t.$$.fragment,t),y(Vt.$$.fragment,t),y(Xt.$$.fragment,t),y(Ot.$$.fragment,t),y(jt.$$.fragment,t),y(ne.$$.fragment,t),y(oe.$$.fragment,t),y(Ut.$$.fragment,t),y(ve.$$.fragment,t),y(Le.$$.fragment,t),y(Fe.$$.fragment,t),y(Be.$$.fragment,t),y(qe.$$.fragment,t),y(Pe.$$.fragment,t),y(St.$$.fragment,t),y(Xe.$$.fragment,t),y(Oe.$$.fragment,t),y(ts.$$.fragment,t),y(ss.$$.fragment,t),y(ns.$$.fragment,t),y(rs.$$.fragment,t),y(ps.$$.fragment,t),y(cs.$$.fragment,t),y(ms.$$.fragment,t),y(hs.$$.fragment,t),y(gs.$$.fragment,t),y(Ts.$$.fragment,t),y(Ms.$$.fragment,t),y(vs.$$.fragment,t),y(Ht.$$.fragment,t),y($s.$$.fragment,t),y(Cs.$$.fragment,t),y(_s.$$.fragment,t),y(Us.$$.fragment,t),y(zt.$$.fragment,t),y(Ls.$$.fragment,t),y(Hs.$$.fragment,t),y(zs.$$.fragment,t),y(Bs.$$.fragment,t),y(Ft.$$.fragment,t),y(Rs.$$.fragment,t),y(Ws.$$.fragment,t),y(Vs.$$.fragment,t),Ma=!0)},o(t){$(c.$$.fragment,t),$(j.$$.fragment,t),$(E.$$.fragment,t),$(K.$$.fragment,t),$(lt.$$.fragment,t),$(_t.$$.fragment,t),$(Vt.$$.fragment,t),$(Xt.$$.fragment,t),$(Ot.$$.fragment,t),$(jt.$$.fragment,t),$(ne.$$.fragment,t),$(oe.$$.fragment,t),$(Ut.$$.fragment,t),$(ve.$$.fragment,t),$(Le.$$.fragment,t),$(Fe.$$.fragment,t),$(Be.$$.fragment,t),$(qe.$$.fragment,t),$(Pe.$$.fragment,t),$(St.$$.fragment,t),$(Xe.$$.fragment,t),$(Oe.$$.fragment,t),$(ts.$$.fragment,t),$(ss.$$.fragment,t),$(ns.$$.fragment,t),$(rs.$$.fragment,t),$(ps.$$.fragment,t),$(cs.$$.fragment,t),$(ms.$$.fragment,t),$(hs.$$.fragment,t),$(gs.$$.fragment,t),$(Ts.$$.fragment,t),$(Ms.$$.fragment,t),$(vs.$$.fragment,t),$(Ht.$$.fragment,t),$($s.$$.fragment,t),$(Cs.$$.fragment,t),$(_s.$$.fragment,t),$(Us.$$.fragment,t),$(zt.$$.fragment,t),$(Ls.$$.fragment,t),$(Hs.$$.fragment,t),$(zs.$$.fragment,t),$(Bs.$$.fragment,t),$(Ft.$$.fragment,t),$(Rs.$$.fragment,t),$(Ws.$$.fragment,t),$(Vs.$$.fragment,t),Ma=!1},d(t){t&&(e(p),e(i),e(a),e(d),e(w),e(T),e(k),e(H),e(q),e(R),e(S),e(F),e(Z),e(L),e(P),e(O),e(ct),e(tt),e(mt),e(et),e(Q),e(st),e(ft),e(X),e(nt),e(gt),e(Y),e(Nt),e(A),e(bt),e(pt),e(dt),e(rt),e(Xs),e(Ds),e(Pt),e(Os),e(Ks),e(Zt),e(tl),e(At),e(el),e(Qt),e(sl),e(Yt),e(ll),e(nl),e(Dt),e(al),e(il),e(Kt),e(rl),e(te),e(ol),e(ee),e(pl),e(se),e(ul),e(le),e(cl),e(ml),e(hl),e(ae),e(fl),e(ie),e(gl),e(re),e(dl),e(Tl),e(pe),e(wl),e(ue),e(Ml),e(ce),e(yl),e(me),e(vl),e(he),e($l),e(fe),e(Jl),e(ge),e(Cl),e(de),e(bl),e(Te),e(_l),e(we),e(jl),e(Me),e(Ul),e(ye),e(xl),e(Il),e(kl),e($e),e(Ll),e(Je),e(Sl),e(Ce),e(Hl),e(be),e(zl),e(_e),e(Fl),e(je),e(El),e(Ue),e(Bl),e(xe),e(Gl),e(Ie),e(Rl),e(ke),e(ql),e(Nl),e(Se),e(Wl),e(xt),e(Pl),e(He),e(Vl),e(ze),e(Zl),e(Al),e(Ee),e(Ql),e(Yl),e(It),e(Xl),e(Ge),e(Dl),e(Re),e(Ol),e(Kl),e(kt),e(tn),e(Ne),e(en),e(We),e(sn),e(ln),e(Lt),e(nn),e(Ve),e(an),e(Ze),e(rn),e(on),e(Ae),e(pn),e(Qe),e(un),e(Ye),e(cn),e(mn),e(De),e(hn),e(fn),e(Ke),e(gn),e(dn),e(es),e(Tn),e(wn),e(ls),e(Mn),e(ot),e(yn),e(vn),e(as),e($n),e(is),e(Jn),e(Cn),e(os),e(bn),e(_n),e(us),e(jn),e(Un),e(xn),e(In),e(fs),e(kn),e(Ln),e(ds),e(Sn),e(Hn),e(ws),e(zn),e(Mt),e(En),e(Tt),e(Nn),e(Wn),e(ys),e(Pn),e(Vn),e(Zn),e(An),e(Js),e(Qn),e(Yn),e(bs),e(Xn),e(Dn),e(js),e(On),e(Kn),e(xs),e(ta),e(Is),e(ea),e(ks),e(sa),e(la),e(na),e(Ss),e(aa),e(ia),e(ra),e(Fs),e(oa),e(Es),e(pa),e(ua),e(Gs),e(ca),e(ma),e(ha),e(qs),e(fa),e(Ns),e(ga),e(da),e(Ps),e(Ta),e(wa),e(Ys)),e(s),_(c,t),_(j,t),_(E,t),_(K,t),_(lt,t),_(_t,t),_(Vt,t),_(Xt,t),_(Ot,t),_(jt,t),_(ne,t),_(oe,t),_(Ut,t),_(ve,t),_(Le,t),_(Fe,t),_(Be,t),_(qe,t),_(Pe,t),_(St,t),_(Xe,t),_(Oe,t),_(ts,t),_(ss,t),_(ns,t),_(rs,t),_(ps,t),_(cs,t),_(ms,t),_(hs,t),_(gs,t),_(Ts,t),_(Ms,t),_(vs,t),_(Ht,t),_($s,t),_(Cs,t),_(_s,t),_(Us,t),_(zt,t),_(Ls,t),_(Hs,t),_(zs,t),_(Bs,t),_(Ft,t),_(Rs,t),_(Ws,t),_(Vs,t)}}}const wo='{"title":"Supervised Fine-Tuning with SmolLM3","local":"supervised-fine-tuning-with-smollm3","sections":[{"title":"What is Supervised Fine-Tuning?","local":"what-is-supervised-fine-tuning","sections":[{"title":"The SmolLM3 SFT Journey","local":"the-smollm3-sft-journey","sections":[],"depth":3}],"depth":2},{"title":"Why SFT Works: The Science Behind It","local":"why-sft-works-the-science-behind-it","sections":[],"depth":2},{"title":"When to Use Supervised Fine-Tuning","local":"when-to-use-supervised-fine-tuning","sections":[],"depth":2},{"title":"The SFT Process","local":"the-sft-process","sections":[{"title":"1. Dataset Preparation and Selection","local":"1-dataset-preparation-and-selection","sections":[],"depth":3},{"title":"2. Environment Setup and Configuration","local":"2-environment-setup-and-configuration","sections":[],"depth":3},{"title":"3. Training Configuration","local":"3-training-configuration","sections":[],"depth":3},{"title":"4. Monitoring and Evaluation","local":"4-monitoring-and-evaluation","sections":[],"depth":3}],"depth":2},{"title":"Understanding Loss Patterns in SFT","local":"understanding-loss-patterns-in-sft","sections":[],"depth":2},{"title":"Warning Signs to Watch For","local":"warning-signs-to-watch-for","sections":[{"title":"Overfitting Pattern","local":"overfitting-pattern","sections":[],"depth":3},{"title":"Underfitting Pattern","local":"underfitting-pattern","sections":[],"depth":3},{"title":"Potential Memorization","local":"potential-memorization","sections":[],"depth":3}],"depth":2},{"title":"Logged metrics","local":"logged-metrics","sections":[],"depth":2},{"title":"Expected dataset type and format","local":"expected-dataset-type-and-format","sections":[],"depth":2},{"title":"Chat Templates in Training","local":"chat-templates-in-training","sections":[{"title":"Preprocessing and tokenization","local":"preprocessing-and-tokenization","sections":[],"depth":3},{"title":"Computing the loss","local":"computing-the-loss","sections":[],"depth":3},{"title":"Handling Special Tokens During Training","local":"handling-special-tokens-during-training","sections":[],"depth":3}],"depth":2},{"title":"Supervised Fine-Tuning with TRL (Transformer Reinforcement Learning)","local":"supervised-fine-tuning-with-trl-transformer-reinforcement-learning","sections":[{"title":"Why TRL?","local":"why-trl","sections":[],"depth":3},{"title":"Key Components","local":"key-components","sections":[],"depth":3},{"title":"TRL’s Architecture","local":"trls-architecture","sections":[],"depth":3}],"depth":2},{"title":"Hands-On: Your First SmolLM3 Fine-Tune","local":"hands-on-your-first-smollm3-fine-tune","sections":[],"depth":2},{"title":"Severless Training Options","local":"severless-training-options","sections":[],"depth":2},{"title":"Key Takeaways","local":"key-takeaways","sections":[],"depth":2},{"title":"Next Steps","local":"next-steps","sections":[],"depth":2},{"title":"Resources and Further Reading","local":"resources-and-further-reading","sections":[],"depth":2}],"depth":1}';function Mo(f){return vr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _o extends Rt{constructor(s){super(),qt(this,s,Mo,To,Gt,{})}}export{_o as component};
