<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Personal Blog]]></title><description><![CDATA[Personal Blog]]></description><link>https://vikasbhandary.com.np</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 23:40:16 GMT</lastBuildDate><atom:link href="https://vikasbhandary.com.np/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[InstructGPT: fine-tuned GPT-3]]></title><description><![CDATA[Large language models (LLMs) can frequently produce nonsensical, toxic, or made-up text that can easily fool typical users. These unintended behaviours…]]></description><link>https://vikasbhandary.com.np/instructgpt-fine-tuned-gpt-3</link><guid isPermaLink="true">https://vikasbhandary.com.np/instructgpt-fine-tuned-gpt-3</guid><category><![CDATA[llm]]></category><category><![CDATA[finetuning]]></category><dc:creator><![CDATA[Vikas Bhandary]]></dc:creator><pubDate>Tue, 02 Dec 2025 12:20:51 GMT</pubDate><content:encoded><![CDATA[<p>Large language models (LLMs) can frequently produce nonsensical, toxic, or made-up text that can easily fool typical users. These unintended behaviours stem from the inherent shortcomings of the language modelling objective: predicting the next token given a sequence of tokens. This objective is different from: following the user’s instructions helpfully and safely. To ensure LLMs are useful, they must produce helpful, honest, truthful, and harmless output in response to users’ instructions.</p>
<p>A useful LLM should meet the following criteria:</p>
<ul>
<li><p>Assist users in completing their tasks effectively.</p>
</li>
<li><p>Avoid fabricating information or misleading users.</p>
</li>
<li><p>Prevent causing physical or emotional harm to users or society.</p>
</li>
</ul>
<p>This article provides a brief introduction to the methodology used to train the <a target="_blank" href="https://arxiv.org/abs/2203.02155">InstructGPT</a> (1.3B) model, developed by the OpenAI team. InstructGPT was one of the first successful models, more capable than its predecessor, which was 100x larger. InstructGPT was better at following the human instructions more appropriately.</p>
<h2 id="heading-methodology">Methodology</h2>
<p><a target="_blank" href="https://arxiv.org/abs/2203.02155"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764676294246/22b378ea-4adf-49a2-9b89-3ce246c5620f.png" alt class="image--center mx-auto" /></a></p>
<p>OpenAI used the Reinforcement learning with Human Feedback (RLHF) method to fine-tune their GPT-3 model to follow user instructions. Human annotators labelled their data and created a dataset of the instructions and desired outputs. The dataset was used to train a baseline model and a reward model. The reward model was trained to score the instruction output according to human preferences.</p>
<p>This reward model was used to fine-tune the baseline model to follow instructions as evaluated by human evaluators. The Proximal Policy Optimisation (PPO) algorithm was used to maximise the reward. The process can be summarised as follows:</p>
<ol>
<li><p><strong>Collect demonstration data and train a supervised policy</strong>: The desired dataset is collected and annotated by human labellers. This dataset is then used to fine-tune a pre-trained GPT-3 model using supervised learning.</p>
</li>
<li><p><strong>Collect comparison data and train a reward model</strong>: The fine-tuned model generates instruction-output pairs, which are annotated by human labellers for instruction alignment. Human annotators rank the preferred outputs for each input. This dataset is then used to train a reward model (RM) to predict human-preferred outputs.</p>
</li>
<li><p><strong>Optimise a policy using PPO</strong>: fine-tune the base model using the reward model's outputs.</p>
</li>
</ol>
<p>Repeat steps two and three until the model achieves the desired level of performance.</p>
<h2 id="heading-improvements">Improvements</h2>
<p>This process improves the instruction-following capability of the resulting fine-tuned model. The following were the findings:</p>
<ul>
<li><p>Outputs from InstructGPT (1.3B) are preferred over those from GPT-3 (175B). This indicates that, despite having a hundred times as many parameters, GPT-3 outputs were not preferred over InstructGPT.</p>
</li>
<li><p>InstructGPT outperformed GPT-3 by a factor of two on the TruthfulQA dataset.</p>
</li>
<li><p>InstructGPT models generate approximately 25% fewer toxic outputs than GPT-3 when prompted to be respectful.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Instruction tuning LLMs]]></title><description><![CDATA[Large language models (LLMs), which are artificial intelligence (AI) systems trained to process and generate human language, are trained on vast amounts of…]]></description><link>https://vikasbhandary.com.np/instruction-tuning-llms</link><guid isPermaLink="true">https://vikasbhandary.com.np/instruction-tuning-llms</guid><category><![CDATA[llm]]></category><category><![CDATA[finetuning]]></category><dc:creator><![CDATA[Vikas Bhandary]]></dc:creator><pubDate>Sun, 30 Nov 2025 10:43:34 GMT</pubDate><content:encoded><![CDATA[<p>Large language models (LLMs), which are artificial intelligence (AI) systems trained to process and generate human language, are trained on vast amounts of data from the internet. They learn about language and other complex linguistic concepts by optimizing the model using the next-word-prediction objective, in which the model is initially trained to predict the next word in a sequence of tokens.  </p>
<p>Building upon this foundation, instruction tuning is a method that improves LLM usability by fine-tuning a pre-trained LLM on a dataset of instruction-response pairs. This approach makes pre-trained LLM models more efficient and better aligned with human-centric queries and outputs.</p>
<h3 id="heading-advantages-of-instruction-tuning">Advantages of Instruction Tuning</h3>
<ul>
<li><p>Better human preference alignment and model efficiency</p>
</li>
<li><p>Instruction tuning offers a more cost-efficient alternative to full model retraining.</p>
</li>
</ul>
<h3 id="heading-challenges-of-instruction-tuning">Challenges of Instruction Tuning</h3>
<ul>
<li><p>Creating high-quality instruction-output pairs is labor-intensive and requires significant expert involvement across both specific and general domains.</p>
</li>
<li><p>This approach is limited to models and applications that support supervised fine-tuning.</p>
</li>
<li><p>In academia, some argue that instruction tuning may only capture surface-level patterns.</p>
</li>
</ul>
<h3 id="heading-methodology">Methodology</h3>
<p><a target="_blank" href="https://github.com/xiaoya-li/Instruction-Tuning-Survey/blob/master/assets/method_overview.png"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764499102786/f9b98f80-9811-4adc-899f-dbac3176598a.png" alt="Instruction Tuning" class="image--center mx-auto" /></a></p>
<p>The instruction tuning methodology consists of two primary steps:</p>
<ul>
<li><p>Step 1: Instruction dataset creation. This step compiles entries that each contain a natural-language instruction specifying a task. An optional input may provide additional information, and the dataset includes the desired output for each task. Datasets can originate from human experts or from large language models (LLMs) capable of generating or understanding text.</p>
</li>
<li><p>Step 2: Supervised fine-tuning. In this step, the constructed dataset is used to further train a pre-trained model. The model learns to interpret instructions (and optional inputs) to predict the associated outputs, following a stepwise process.</p>
</li>
</ul>
<h3 id="heading-synthetic-data-via-distillation">Synthetic Data via Distillation</h3>
<p>Synthetic data generation is one of the fastest and most cost-efficient methods for creating a dataset of instruction-output pairs. This is important because creating data by human annotators or filtering data from the internet places a significant burden on time and human effort.</p>
<p>The distillation process involves imparting knowledge from a highly capable teacher model to a simpler one. The smaller model is more efficient to run on consumer-grade systems.</p>
<h3 id="heading-instructgpt">InstructGPT</h3>
<p>One of the earliest models to use Instruction fine-tuning (and various other reinforcement learning algorithms) was InstructGPT(176B), developed by OpenAI. It was initialized with GPT-3. The process of fine-tuning this model was:</p>
<ol>
<li><p>Supervised fine-tuning on a human-filtered instruction dataset</p>
</li>
<li><p>Training a reward model to predict human preference based on an already curated dataset, which ranks each solution from best to worst.</p>
</li>
<li><p>Use the proximal policy optimization (PPO) technique—an algorithm for training reinforcement learning models—to further train the model from step 1 and the reward model. Repeat the entire process until the desired output quality is achieved.</p>
</li>
</ol>
<p>After completing the fine-tuning process, InstructGPT outperformed GPT-3 by 10% on TruthfulQA in terms of truthfulness and by 7% on RealToxicityPrompts in terms of toxicity.</p>
]]></content:encoded></item><item><title><![CDATA[MT-Bench: LLM-as-a-judge benchmark]]></title><description><![CDATA[With the rapid growth of research on large language models (LLMs), we now have a diverse array of models capable of performing various tasks. Current…]]></description><link>https://vikasbhandary.com.np/mt-bench-llm-as-a-judge-benchmark</link><guid isPermaLink="true">https://vikasbhandary.com.np/mt-bench-llm-as-a-judge-benchmark</guid><category><![CDATA[llm]]></category><dc:creator><![CDATA[Vikas Bhandary]]></dc:creator><pubDate>Fri, 14 Nov 2025 10:12:23 GMT</pubDate><content:encoded><![CDATA[<p>With the rapid growth of research on large language models (LLMs), we now have a diverse array of models capable of performing various tasks. Current benchmarks for LLMs only focus on evaluating models on close-ended questions, with short responses. Which makes is extremely hard to accurately reflect how well LLMs can perform in real-world open-ended questions.</p>
<p>Following are the major benchmark categories which are generally used to evaluate LLMs:</p>
<ul>
<li><p><strong>Core-knowledge benchmark</strong>: require LLMs to generate short answer to predetermined set of questions that are easy to evaluate. HumanEval, MMLU, GSM-8k, AGIEval are some example of core knowledge benchmarks.</p>
</li>
<li><p><strong>Instruction-following benchmark</strong>: evaluate if LLMs are capable of following instructions properly. For-example: Flan, Self-Instruct, NaturalInstructions, Super-NaturalInstructions.</p>
</li>
<li><p><strong>Conversational benchmark</strong>: evaluate the LLM’s capability to handle conversations. CoQA, MMDialog, OpenAssistant are some example benchmarks.</p>
</li>
</ul>
<p>These benchmark greatly overlook open-ended nature of human-AI interactions. Human preference is one of the major factor in LLMs utility. To solve this issue, the concept of LLM-as-a-judge was introduced. Human preference is replaced with state-of-art LLM such as GPT-4, as they are fine tuned with Reinforcement Learning from Human Feedback (RLHF).</p>
<h3 id="heading-mt-bench">MT-Bench</h3>
<p>MT-Bench is a benchmark that is designed to test multi-turn conversations and instruction-following capabilities of chatbot on 8 common categories which include: writing, roleplay, extraction, reasoning, math, coding, knowledge I (STEM), knowledge II (humanities/social science). MT-Bench has 10 open-ended multi-turn questions for each categories.</p>
<p>MT-Bench benchmark was introduced in <a target="_blank" href="https://arxiv.org/abs/2306.05685">this</a> paper. Along with this, authors have introduced chatbot arena, a platform where human can score the anonymous LLMs outputs based on their response. These votes are helpful to test for human preference in LLM generated response.</p>
<h3 id="heading-types-of-llm-as-a-judge">Types of LLM-as-a-judge</h3>
<ul>
<li><p><strong>Pairwise comparison</strong>: An LLM judge is presented with a question and two answers, tasked to determine which is better or it is a tie.</p>
</li>
<li><p><strong>Single answer grading</strong>: An LLM judge is asked to directly assign a score to a single answer</p>
</li>
<li><p><strong>Reference-guided grading</strong>: In some cases reference solution is provided to make better judgement.</p>
</li>
</ul>
<h3 id="heading-advantages-of-llm-as-a-judge">Advantages of LLM-as-a-judge</h3>
<ul>
<li><p><strong>Scalability</strong>: With LLM-as-a-judge we can reduce the human involvement to a minimum and evaluate the LLMs in faster iterations.</p>
</li>
<li><p><strong>Explainability</strong>: By using LLM-as-a-judge, we can have detailed explanation for assigned scores as compared to human scoring.</p>
</li>
</ul>
<h3 id="heading-limitations-of-llm-as-a-judge">Limitations of LLM-as-a-Judge</h3>
<p><strong>Position bias</strong>: Sometimes LLMs exhibit inclination to favor certain position over others. This happens when judge LLM switches its answer based on which agent’s response is placed first. If the answer switches then it indicates position bias</p>
<p><strong>Verbosity bias</strong>: is when LLM judge favors longer, verbose response even if they are unclear or inaccurate as compared to shorter answer.</p>
<p><strong>Self-enhancement bias</strong>: is when judge LLM favors answers generated by itself.</p>
<p><strong>Limited capability to grade math and reasoning</strong>: LLMs are known to have limited math and reasoning capability. But sometimes judge LLMs can not grade solvable math problems.</p>
<h3 id="heading-addressing-limitations">Addressing limitations</h3>
<p><strong>Swapping position</strong>: Position bias is mitigated by running the same prompt twice with answers in different position. If the answer of the judge LLM switches then the both LLM are marked as tied.</p>
<p><strong>Few-shot judge</strong>: By using few-shot examples, the position bias issue decreased significantly. After using few-shot samples in testing, it was noted that the consistency of GPT-4 increased from 65.0% to 77.5%.</p>
<p><strong>Chain-of-thought and reference guide judge</strong>: To improve the math &amp; reasoning scoring issue, chain-of-thought and reference guid judge was introduced. After this, the error rate reduced significantly from 70% to 15%</p>
<p><strong>Fine-tuning a judge</strong>: Fine tuning Vicuna-13B on arena data, increased the consistency of evaluation to 65%.</p>
]]></content:encoded></item><item><title><![CDATA[Save your development time by using Amplication]]></title><description><![CDATA[If we talk about code generation tools, we can find many tools that won't require any domain expertise to go from an idea to a presentable website. We can…]]></description><link>https://vikasbhandary.com.np/save-your-development-time-by-using-amplication</link><guid isPermaLink="true">https://vikasbhandary.com.np/save-your-development-time-by-using-amplication</guid><category><![CDATA[amplication]]></category><dc:creator><![CDATA[Vikas Bhandary]]></dc:creator><pubDate>Wed, 11 Jan 2023 17:46:21 GMT</pubDate><content:encoded><![CDATA[<p>If we talk about code generation tools, we can find many tools that won't require any domain expertise to go from an idea to a presentable website.</p>
<p>We can try to use these tools to save some time, but most code generation tools take away the code extendability and can not deliver maintainable, understandable, and quality code.</p>
<p>I recently checked a code generation tool called Amplication, which helps developers generate NestJs backend and barebone admin UI. Here are some of the plus points of Amplication that could help you decide if you should try it in your next project.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1673459093169/72d56bf3-c12b-47ed-bd12-dd7cda2452ca.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-developer-friendliness">Developer friendliness</h2>
<p>It defines itself as an open-source development tool. This tool helps users create and update database entities, user roles, and permissions. It also facilitates the maintenance of data models even after custom changes.</p>
<p>All changes made using Amplication can be pushed directly to GitHub in the form of merge requests. You can test the changes right away by checking out the sandbox environment deployment URL.</p>
<h2 id="heading-easy-deployment">Easy deployment</h2>
<p>The delivered code contains DockerFile. Docker makes the deployment process very easy.</p>
<h2 id="heading-code-quality">Code quality</h2>
<p>The delivered code is arguably clean and understandable. Almost all of the code generated by amplication resides inside the base folder of each module. If we want to add custom code, we should add and update services, controllers, resolvers, and more.</p>
<p>As a fan of nestjs, I give it 100 points because of its extendability. DeepScan report raises some UNUSED_IMPORT issues.</p>
<h2 id="heading-rest-amp-graphql-support">REST &amp; GraphQL support</h2>
<p>The delivered code supports both REST and GraphQL APIs, which are the most used method of server communication. Having both ready as you start saves a lot of time.</p>
]]></content:encoded></item></channel></rss>