Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News - Fine-Tuning GPT-3.5 Turbo – How to Craft Your Own Proprietary LLM

#1
News - Fine-Tuning GPT-3.5 Turbo – How to Craft Your Own Proprietary LLM

<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;1650906&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;top&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;1&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;5\/5 - (1 vote)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;Fine-Tuning GPT-3.5 Turbo - How to Craft Your Own Proprietary LLM&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;{score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 142.5px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> 5/5 – (1 vote) </div>
</p></div>
<p>The much-awaited feature for <a href="https://blog.finxter.com/10-high-iq-things-gpt-4-can-do-that-gpt-3-5-cant/">GPT-3.5 Turbo</a> is here: <strong>fine-tuning</strong>. And guess what? <a href="https://blog.finxter.com/no-gpt-4-doesnt-get-worse-over-time-fud-debunked/">GPT-4</a> is next in line this autumn. Dive in to discover how this can revolutionize your applications and user experiences.</p>
<h2 class="wp-block-heading">What’s New?</h2>
<p>OpenAI now empowers you to tailor GPT-3.5 Turbo with your data, ensuring the model aligns perfectly with your specific needs. Preliminary results? <strong>A fine-tuned GPT-3.5 Turbo can rival, and sometimes even surpass, the base GPT-4 in specialized tasks.</strong> And here’s a cherry on top: the data you use remains yours. OpenAI respects your privacy and won’t use it for other model training.</p>
<h2 class="wp-block-heading">Why Fine-Tune?</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" fetchpriority="high" width="770" height="770" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_a_female_young_engineer_looking_at_a_large_screen_displ_b43e983e-0b44-4fb3-96b3-4061aef4ee00.png" alt="" class="wp-image-1647180" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_a_female_young_engineer_looking_at_a_large_screen_displ_b43e983e-0b44-4fb3-96b3-4061aef4ee00.png 770w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w, https://blog.finxter.com/wp-content/uplo...68x768.png 768w" sizes="(max-width: 770px) 100vw, 770px" /></figure>
</div>
<p>Ever since GPT-3.5 Turbo hit the scene, there’s been a clamor for a more personalized touch. Here’s what fine-tuning brings to the table:</p>
<ol>
<li><strong>Steerability Boost</strong>: Want the model to follow instructions to the T? Fine-tuning is your answer. For instance, if you need the model to always reply in German, fine-tuning ensures it does just that.</li>
<li><strong>Consistent Formatting</strong>: If you’re into tasks like <a href="https://blog.finxter.com/python-openai-streaming-completions/">code completion</a> or <a href="https://blog.finxter.com/openai-python-api-a-helpful-illustrated-guide-in-5-steps/">API call</a> composition, fine-tuning ensures the model’s responses are formatted just the way you want. Imagine converting user prompts into precise JSON snippets seamlessly.</li>
<li><strong>Customized Tone</strong>: Every brand has its voice. With fine-tuning, GPT-3.5 Turbo can echo the unique tone of your brand, ensuring consistency across interactions.</li>
</ol>
<h2 class="wp-block-heading">Added Bonuses</h2>
<ul class="has-global-color-8-background-color has-background">
<li><strong>Shorter Prompts, Same Performance</strong>: Fine-tuning means you can trim your prompts and still get top-notch results.</li>
<li><strong>More Tokens</strong>: GPT-3.5 Turbo, when fine-tuned, can now manage 4k tokens, a whopping double from before. Some early birds have even slashed their prompt sizes by up to 90%, making API calls faster and more cost-effective.</li>
</ul>
<p><strong>Maximizing Fine-Tuning</strong>: The real magic happens when you blend fine-tuning with techniques like <a href="https://blog.finxter.com/i-discovered-the-perfect-chatgpt-prompting-formula/">prompt engineering</a>, information retrieval, and <a href="https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/">function calling</a>. Hungry for more insights? OpenAI’s fine-tuning guide is your go-to resource. </p>
<p>You can stay updated on new developments by subscribing to our tech newsletter by downloading the following Python cheat sheet:</p>
<h2 class="wp-block-heading">Step-by-Step Guide to Fine-Tuning GPT-3.5 Turbo</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="553" height="553" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_a_digital_brain_on_a_growth_chart_with_cyberspace_envir_241edbbc-715d-4a0b-83d0-b07f5f2749e9.png" alt="" class="wp-image-1646647" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_a_digital_brain_on_a_growth_chart_with_cyberspace_envir_241edbbc-715d-4a0b-83d0-b07f5f2749e9.png 553w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 553px) 100vw, 553px" /></figure>
</div>
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<h3 class="wp-block-heading">Step 1: Data Preparation</h3>
<p>Before you start, you need to prepare your data in a specific format. This data will guide the model on how to behave. For instance, if you want the model to act as an assistant that occasionally misspells words, your data would look like this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">{ "messages": [ { "role": "system", "content": "You are an assistant that occasionally misspells words" }, { "role": "user", "content": "Tell me a story." }, { "role": "assistant", "content": "One day a student went to schoool." } ]
}</pre>
<p>Here, the system instructs the assistant’s behavior, the user provides a prompt, and the assistant responds accordingly.</p>
<h3 class="wp-block-heading">Step 2: Uploading Your Data</h3>
<p>Once your data is ready, you need to upload it to OpenAI. Use the following <code>curl</code> command:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">curl https://api.openai.com/v1/files \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -F "purpose=fine-tune" \ -F "file=@path_to_your_file"</pre>
<p>Replace <code>path_to_your_file</code> with the path to your prepared data file. Ensure your OpenAI API key is correctly set in the <code>$OPENAI_API_KEY</code> environment variable.</p>
<figure class="wp-block-image size-large"><a href="https://blog.finxter.com/openai-python-api-a-helpful-illustrated-guide-in-5-steps/" target="_blank" rel="noreferrer noopener"><img decoding="async" width="1024" height="573" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-113-1-1024x573.png" alt="" class="wp-image-1650908" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-113-1-1024x573.png 1024w, https://blog.finxter.com/wp-content/uplo...00x168.png 300w, https://blog.finxter.com/wp-content/uplo...68x430.png 768w, https://blog.finxter.com/wp-content/uplo...-113-1.png 1286w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
<p class="has-base-2-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/openai-python-api-a-helpful-illustrated-guide-in-5-steps/">OpenAI Python API – A Helpful Illustrated Guide in 5 Steps</a></p>
<h3 class="wp-block-heading">Step 3: Initiating the Fine-Tuning Job</h3>
<p>With your data uploaded, it’s time to create a fine-tuning job. Use this <code>curl</code> command:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">curl https://api.openai.com/v1/fine_tuning/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{ "training_file": "TRAINING_FILE_ID", "model": "gpt-3.5-turbo-0613"
}'</pre>
<p>Replace <code>TRAINING_FILE_ID</code> with the ID you received after uploading your data in Step 2.</p>
<p>Once the model completes the fine-tuning, it’s ready for production use. It will have the same rate limits as the base model.</p>
<h3 class="wp-block-heading">Step 4: Deploying the Fine-Tuned Model</h3>
<p>To use your freshly fine-tuned model, employ the following <code>curl</code> command:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{ "model": "ft:gpt-3.5-turbo:org_id", "messages": [ { "role": "system", "content": "You are an assistant that occasionally misspells words" }, { "role": "user", "content": "Hello! What is fine-tuning?" } ]
}'</pre>
<p>Replace <code>org_id</code> with your organization’s ID.</p>
<h2 class="wp-block-heading">Pricing</h2>
<figure class="wp-block-image size-full"><img decoding="async" loading="lazy" width="956" height="632" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-93.png" alt="" class="wp-image-1646559" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-93.png 956w, https://blog.finxter.com/wp-content/uplo...00x198.png 300w, https://blog.finxter.com/wp-content/uplo...68x508.png 768w" sizes="(max-width: 956px) 100vw, 956px" /></figure>
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<p><strong>Pricing Breakdown</strong>:</p>
<p>Fine-tuning costs are categorized into training and usage:</p>
<ul>
<li><strong>Training</strong>: $0.008 per 1K Tokens</li>
<li><strong>Usage Input</strong>: $0.012 per 1K Tokens</li>
<li><strong>Usage Output</strong>: $0.016 per 1K Tokens</li>
</ul>
<p>To illustrate, a gpt-3.5-turbo fine-tuning job with a 100,000 tokens training file, trained over 3 epochs, would cost approximately $2.40.</p>
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<p><strong>Updates on GPT-3 Models</strong>:</p>
<p>In July, OpenAI revealed that the original GPT-3 models (<code>ada</code>, <code>babbage</code>, <code>curie</code>, and <code>davinci</code>) would be phased out by January 4th, 2024. However, the good news is that <code>babbage-002</code> and <code>davinci-002</code> are now available as replacements. You can access these models via the <a href="https://blog.finxter.com/python-openai-streaming-completions/">Completions API</a>.</p>
<p>Furthermore, these models can be fine-tuned using the new API endpoint <code>/v1/fine_tuning/jobs</code>. This endpoint is more versatile, supporting the API’s future growth. Transitioning from the old <code>/v1/fine-tunes</code> to the new endpoint is a breeze. More details are available in the updated fine-tuning guide. </p>
<p class="has-global-color-8-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/2620.png" alt="☠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Note</strong>: The old <code>/v1/fine-tunes</code> endpoint will be discontinued on January 4th, 2024.</p>
<p>The pricing for both base and fine-tuned GPT-3 models will be provided subsequently.</p>
<figure class="wp-block-image size-full"><img decoding="async" loading="lazy" width="834" height="308" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-128.png" alt="" class="wp-image-1650909" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-128.png 834w, https://blog.finxter.com/wp-content/uplo...00x111.png 300w, https://blog.finxter.com/wp-content/uplo...68x284.png 768w" sizes="(max-width: 834px) 100vw, 834px" /></figure>
<p><strong>Source</strong>: <a href="https://openai.com/blog/gpt-3-5-turbo-fine-tuning-and-api-updates">https://openai.com/blog/gpt-3-5-turbo-fine-tuning-and-api-updates</a></p>
<p><strong>Coming Soon</strong>: OpenAI is gearing up to launch a user-friendly fine-tuning UI. This will offer developers a more intuitive way to monitor ongoing fine-tuning tasks, access completed model versions, and much more. Stay tuned!</p>
<p>With these steps, you’re well on your way to customizing GPT-3.5 Turbo to your unique requirements. Happy fine-tuning!</p>
<h2 class="wp-block-heading">Learn More <img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1fa84.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></h2>
<figure class="wp-block-image size-full"><img decoding="async" loading="lazy" width="1440" height="1115" src="https://blog.finxter.com/wp-content/uploads/2023/08/llama2.gif" alt="" class="wp-image-1650907"/></figure>
<p class="has-base-2-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/ways-to-get-started-with-llama2/">6 Easiest Ways to Get Started with Llama2: Meta’s Open AI Model</a></p>
<p>The post <a rel="nofollow" href="https://blog.finxter.com/fine-tuning-gpt-3-5-turbo-how-to-craft-your-own-proprietary-llm/">Fine-Tuning GPT-3.5 Turbo – How to Craft Your Own Proprietary LLM</a> appeared first on <a rel="nofollow" href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
</div>


https://www.sickgaming.net/blog/2023/08/...etary-llm/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016