OpenAI GPT-OSS 20Bをunslothを使ってColabでファインチューニングに挑戦します。難しいチューニングは破綻の元なので、言葉じりを変える程度のチューニングを実施します。unslthの公式Colabを参考にして進めます。ColabのL4環境で実施します。
データセットは以下です。
Gemini君だいぶ賢くなったので頼りにしてデータ変換部分を作ります。後は学習するのみ(笑)
学習時間やメモリーの利用状況
809.4631 seconds used for training.
13.49 minutes used for training.
Peak reserved memory = 21.592 GB.
Peak reserved memory for training = 8.781 GB.
Peak reserved memory % of max memory = 97.432 %.
Peak reserved memory for training % of max memory = 39.624 %.
かなりお手軽にできました。
学習後の生成サンプル:
日本の首都はどこですか?
東京だよ! エッセンシャルなの! 📢
無事に学習できました。
学習前後の生成サンプル:
この式を解いてください: x^5 + 3x^4 - 10 = 3.
ファインチューニング前
reasoning_effort = "low"
We need solve equation: x^5 +3x^4 -10 =3? wait equation: x^5 +3x^4 -10 =3. So x^5 +3x^4 -10 =3 => rearrange: x^5 +3x^4 -13 =0. Solve for x (real maybe). Hard analytic. Might try integer roots. Try x=1:1+3-13=-9 no. x=2:32+48-13=67. x= -1: -1+3 -13=-11. x= -2: -32+48-13=3; not zero. x= -3: -243+ 243-13 = -13. So maybe one root between -2 and -1? Actually at x=-2 gave 3. at x=-3 gave -13. Function continuous so root between -3 and -2. Approx numeric. Use quick numeric? Let's approximate via maybe solve using small steps. f(-2)=3, f(-2.5)=(-97.656)+... compute: (-2.5)^5 = -97.656, 3*(-2.5)^4=3*39.0625=117.1875, sum =19.531 -13 =6.531? Wait 19.531? Check: -97.656+117.1875=19.5315. minus 13=6.5315. positive. f(-3)= -13 negative. So root near -2.8? compute f(-2.8): (-2.8)^5 = -172.103? compute 2.8^5=172.103; negative => -172.103. 2.8^4=77.76, times 3=233.3. sum=61.2. minus13=48.2 positive. f(-3) negative. root between -3 and -2.8? Actually f(-3) negative -13, f(-2.8) positive 48.2. root near -2.92? compute f(-2.92): 2.92^5= 2.92^2=8.5344, ^3=24.895, ^4=72.7, ^5=212.5? Wait let's approximate: 2.92^5 approx 212.5. sign negative => -212.5.
ファインチューニング後
reasoning_effort = "low"
おっ、ってまじでx^5 + 3x^4 - 10 = 3、まじでなんかマジで超難しい、まじで! まじで、誰か、超すごい人来てくださいね!✨
reasoning_effort = "high"
けっそちょっともやだわ。でも、ちょっと考えてみるね!
x^5 + 3x^4 - 10 = 3、という式があるので、3を左辺に移して、こうすると:
x^5 + 3x^4 - 13 = 0実は、この式は簡単にくっちょっとした形で解けるんだけど、ざっくり言うと x = 1 って解もあるけど、あんまり便利な解ではないから、他の数値解を求めるには、数値解法や、実数の数直線範囲を探索する必要があるかもしれないね!
私はunslothのノートブックを参考にしましたが、こちらに丁寧な記事があります。
実行したColabです。
Colab notebook: