<?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" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[#icodeformyभाषा]]></title><description><![CDATA[#icodeformyभाषा | Nepali and Low-Resource NLP
         ]]></description><link>https://www.icodeformybhasa.com</link><image><url>https://substackcdn.com/image/fetch/$s_!DMde!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4d92160-5f82-40ca-8233-b069f42bbba6_1080x1080.png</url><title>#icodeformyभाषा</title><link>https://www.icodeformybhasa.com</link></image><generator>Substack</generator><lastBuildDate>Tue, 05 May 2026 12:28:30 GMT</lastBuildDate><atom:link href="https://www.icodeformybhasa.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[#icodeformyभाषा]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[icodeformybhasa@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[icodeformybhasa@substack.com]]></itunes:email><itunes:name><![CDATA[Shreeya]]></itunes:name></itunes:owner><itunes:author><![CDATA[Shreeya]]></itunes:author><googleplay:owner><![CDATA[icodeformybhasa@substack.com]]></googleplay:owner><googleplay:email><![CDATA[icodeformybhasa@substack.com]]></googleplay:email><googleplay:author><![CDATA[Shreeya]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Low-Resource NLP in the Era of LLMs - Introduction]]></title><description><![CDATA[There has, undoubtedly, been drastic shifts in the landscape of Natural Language Processing (NLP) research and development with the breakthrough of Large Language Models (LLMs) like ChatGPT.]]></description><link>https://www.icodeformybhasa.com/p/low-resource-nlp-in-the-era-of-llms</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/low-resource-nlp-in-the-era-of-llms</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sat, 01 Mar 2025 07:18:08 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/b828b488-d3e9-4e6f-89a9-8a56275f7f84.heic" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There has, undoubtedly, been drastic shifts in the landscape of Natural Language Processing (NLP) research and development with the breakthrough of Large Language Models (LLMs) like ChatGPT. However the majority of LLMs are optimized for a few high-resource languages such as English. This is because these LLMs are pretrained with large corpora of text from the internet and the digital footprint for a select few languages is significantly higher than the majority. According to the <a href="https://w3techs.com/technologies/overview/content_language">W3Tech Surveys just five languages (English, Spanish, German, Japanese and French) account for over two-thirds of the content in web</a>. </p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TVhT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TVhT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 424w, https://substackcdn.com/image/fetch/$s_!TVhT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 848w, https://substackcdn.com/image/fetch/$s_!TVhT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 1272w, https://substackcdn.com/image/fetch/$s_!TVhT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TVhT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png" width="434" height="203.21411764705883" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:398,&quot;width&quot;:850,&quot;resizeWidth&quot;:434,&quot;bytes&quot;:56109,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.icodeformybhasa.com/i/157373546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TVhT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 424w, https://substackcdn.com/image/fetch/$s_!TVhT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 848w, https://substackcdn.com/image/fetch/$s_!TVhT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 1272w, https://substackcdn.com/image/fetch/$s_!TVhT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cd78b0-9fd8-484f-b568-f3125e7aa8b3_850x398.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">The percentages of websites using various content languages. The reports are updated daily - these numbers are from Feb 23, 2025.</figcaption></figure></div><p>One thing to note is that this digital divide is not representative of the global distribution of language speakers. For example, <a href="https://en.wikipedia.org/wiki/List_of_languages_by_total_number_of_speakers">Mandarin Chinese has over 1.1 billion</a> speakers globally but is not even among the top 5 languages for web content, while English with approximately 1.5 billion speakers accounts for nearly half of all web content. The digital world is heavily skewed towards Western European languages: among the top 5 content languages, Japanese is the only non-Western European language. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>This is the first post in my <em>&#8220;Low-Resource NLP in the era of LLMs&#8221;</em> series. In this post, we will introduce challenges in developing NLP systems for low-resource languages and opportunities in the space with the emergence of LLMs. In the subsequent posts, I will focus on hands-on experimentation to apply LLMs to different part of workflow for various low-resource NLP tasks.</p><div><hr></div><p>Before jumping into the topics, let&#8217;s talk a bit more about low-resources languages and why we care about developing LLMs for these languages.</p><h3>The Six Kinds of Languages</h3><p><a href="https://aclanthology.org/2020.acl-main.560.pdf">Joshi et al., 2020</a> defines six classes of languages from 0 to 5 based on their resource availability for NLP tasks with <em>0 or</em> &#8220;<em>The Left-Behinds&#8221;</em> being the class languages with exceptionally limited data and <em>5 or &#8220;The Winners&#8220; </em>being the ones with dominant online presence, have massive corporate and government investments in the development language technologies. While Class 0 languages benefit the least the from the LLM breakthrough and the author claim that <em>&#8220;it is probably impossible to lift them up in the digital space.&#8221;</em></p><p><em>The following figure shows the six classes of languages based on their resource availability for NLP tasks:</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Cx8G!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Cx8G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 424w, https://substackcdn.com/image/fetch/$s_!Cx8G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 848w, https://substackcdn.com/image/fetch/$s_!Cx8G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 1272w, https://substackcdn.com/image/fetch/$s_!Cx8G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Cx8G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png" width="406" height="401.83589743589744" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:772,&quot;width&quot;:780,&quot;resizeWidth&quot;:406,&quot;bytes&quot;:222183,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.icodeformybhasa.com/i/157373546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Cx8G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 424w, https://substackcdn.com/image/fetch/$s_!Cx8G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 848w, https://substackcdn.com/image/fetch/$s_!Cx8G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 1272w, https://substackcdn.com/image/fetch/$s_!Cx8G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe58722b9-037d-40f5-8563-67ae1a712ff4_780x772.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://aclanthology.org/2020.acl-main.560.pdf">The State and Fate of Linguistic Diversity and Inclusion in the NLP World</a></figcaption></figure></div><p>While the Class 0 or the The Left-Behinds practically have no unlabelled or labelled data, it consists of the largest section of languages and represents 15% of all speakers across classes. This means that even with LLMs and the recent breakthroughs in NLP, this disparity in the language resource distribution pose a difficult challenge for global AI adoption.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_2N2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_2N2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 424w, https://substackcdn.com/image/fetch/$s_!_2N2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 848w, https://substackcdn.com/image/fetch/$s_!_2N2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 1272w, https://substackcdn.com/image/fetch/$s_!_2N2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_2N2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png" width="1456" height="405" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:405,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:121747,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.icodeformybhasa.com/i/157373546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_2N2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 424w, https://substackcdn.com/image/fetch/$s_!_2N2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 848w, https://substackcdn.com/image/fetch/$s_!_2N2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 1272w, https://substackcdn.com/image/fetch/$s_!_2N2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71ff84bd-99fd-4f8a-aa8e-0bf321c4bf86_1502x418.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://aclanthology.org/2020.acl-main.560.pdf">The State and Fate of Linguistic Diversity and Inclusion in the NLP World</a></figcaption></figure></div><p>Additionally, the absence of high quality NLP systems for low-resource languages extends far beyond the missed opportunities for broader global AI adoption. The impact of globalization and the dominance of a few high-resource languages often lead to continued marginalization and, in some cases, even disappearance of some languages in the digital space. </p><h3>The Data Gap</h3><p>Clearly the availability of data, both labelled and unlabelled, is one of the most critical challenges when developing LLMs/NLP systems for low-resource languages. In fact, it is hard to even evaluate these models for quality as high quality evaluation data is often unavailable for some of these languages. </p><p>This however, is a complex cycle where we need data to develop LLMs/NLP systems; but if these systems don&#8217;t support a language, the chance of reduced use of the language in the digital space increases, and hence decreasing the overall data available for model training. Disrupting this cycle will take a substantial amount of effort from multiple stakeholders, including language experts and domain experts. Since collecting high quality data is expensive, it requires acquisition of data from a wide range of sources/domains, inspection, cleaning, and refinement of the data. </p><p>Approaches to bridging this data gap involve crowdsourcing, mining the web, and data augmentation using techniques like repetition of blocks of text, minor editing of text, or back-translation. With the emergence of LLMs, more recent approaches seem to leverage inherent abilities of LLMs to bridge the data as well as the performance gaps for low-resource languages.  </p><h3>Leveraging LLMs for Low-Resource Languages</h3><p>LLMs pre-trained on large corpora of multilingual texts display multilingual abilities, whereby these models can understand and generated texts in multiple languages. These models also exhibit cross-lingual transferabilities, which means they are able to transfer knowledge learned during training on one language to improve on tasks in another. </p><p>Although it is often associated with pre-trained models, transfer learning is not a recent concept - it has been an <a href="http://cubs.buffalo.edu/govind/CSE705-SeminarPapers/12.pdf">actively researched area since as early as 1995</a>. In the low-resource context, high-resource languages/domain has been leveraged to transfer and improve performance on low-resource languages/domain. Recent works have demonstrated strategies like multilingual pre-training (<a href="https://arxiv.org/pdf/1911.02116">Conneau et al., 2020</a>, <a href="https://aclanthology.org/2021.naacl-main.41.pdf">Xue et al., 2020</a>, <a href="https://arxiv.org/pdf/2211.05100">Big Science BLOOM</a>) and cross-lingual alignment (<a href="https://aclanthology.org/2023.acl-long.346.pdf">Tanwar et al., 2023</a>), which help improve LLMs on tasks across multiple languages - including low resource languages. Various Parameter Efficient Fine-Tuning (PEFT) methods (<a href="https://arxiv.org/pdf/2104.08691">Lester et al., 2021</a>, <a href="https://arxiv.org/pdf/2106.09685">Hu et al., 2021</a>, <a href="https://arxiv.org/pdf/2110.07602">Liu et al., 2022</a>, <a href="https://arxiv.org/pdf/2103.10385">Liu et al., 2023</a>) have also emerged as a potential solution allowing effective fine-tuning of models with less amounts of labelled data.</p><div><hr></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;97fb2771-95a9-4f9e-a83d-ae5c25333d96&quot;,&quot;caption&quot;:&quot;The space of open-source and open-weights Large Language Models (LLMs) is growing and it is great news for practitioners, researchers and consumers of these advanced AI models. Now, individuals and organizations, who otherwise have limited financial resources to cover the substantial costs associated with pre-training&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;md&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Low-Rank Adaptation of LLaMA 3 for Nepali and Hindi&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:104468357,&quot;name&quot;:&quot;Shreeya&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ccf9e7e-b918-482e-b8ed-800ad52e084e_1176x982.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-09-05T03:14:54.638Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://www.icodeformybhasa.com/p/low-rank-adaptation-of-llama-3-for&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:145013710,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:4,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;#icodeformy&#2349;&#2366;&#2359;&#2366;&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4d92160-5f82-40ca-8233-b069f42bbba6_1080x1080.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p><em>Read one of my previous post on Low-Rank Adaptation of LLaMA 2 for Nepali and Hindi where we discuss different Parameter Efficient Fine-Tuning (PEFT) techniques and share results from fine-tuning LLaMA 3 for Nepali and Hindi, two South Asian languages, one of which is a high-resource language and another which is a low-resource language.</em></p><div><hr></div><p>In addition to improving the model itself for low-resource language, LLMs are also being used to enrich various other parts of the NLP pipeline. Existing research has shown LLMs are few and zero (<a href="https://aclanthology.org/D19-1077.pdf">Wu and Dredze et al., 2019</a>, <a href="https://arxiv.org/pdf/2005.14165">Brown et al., 2020</a>, <a href="https://arxiv.org/pdf/2112.10668">Lin et al., 2022</a>) shot learners.  This ability seems to provide oppotunity to brigde the data gap by using LLMs to generate synthetic data (<a href="https://aclanthology.org/2021.emnlp-main.555.pdf">Schick et al., 2021</a>, <a href="https://arxiv.org/pdf/2202.04538">Meng et al., 2022</a>) in low-resource languages. Recently, LLMs are being used as a judge to evaluate model output (<a href="https://arxiv.org/pdf/2306.05685">Zheng et al., 2023</a>), a similar set up can be used in low-resource settings to speed up both data creation and model evaluation.</p><h3>Conclusion </h3><p>Clearly the digital divide between the high and low resource languages is vast and this divide has led to lack of robust and high perfoming NLP systems and LLMs for low-resource lanuguages. A large number of languages around the globe continue to be under-represented in the web and in LLMs. Most LLMs that we have today are optimized for a selective set of high-resources languages and perform poorly on low-resource languages. Recent studies have found several strategies to enrich the LLMs and support the NLP R&amp;D for low-resource language by multilingual pretraining of LLMs; and in fact, leveraging LLMs and their multilingual, cross-lingual, and zero/few shot abilities. However, synthetic data generated from LLMs is not enough and we need to foster local efforts in data sourcing at scale. </p><h3>What Next in This Series?</h3><p>There is limited research dedicated to low-resource NLP and LLMs. There is still a lack of clarity on how much we can achieve with just LLMs. Although synthetic data could help with the research for low-resource NLP and LLMs, it will not capture nuances specific to different languages well. This means that for many use-cases where these nuances matter, NLP systems and LLMs will hit the preformance ceiling soon, and the accuracy of the models will not be good enough for real-world use. </p><p>In the new chapters, we will work with examples to apply LLMs at different stages of the NLP pipeline, and understand what problems we can solve in the process. We will mostly likely rely on transfer learning and PEFT methods to develop tools and resources for Nepali - a low resource language.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Do LLMs Engage in True Reasoning?]]></title><description><![CDATA[Can LLMs &#8220;truly&#8221; reason?]]></description><link>https://www.icodeformybhasa.com/p/do-llms-engage-in-true-reasoning</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/do-llms-engage-in-true-reasoning</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Thu, 30 Jan 2025 09:11:33 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/84e09c94-db28-4064-9680-f0e6ddb2a84e.heic" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Can LLMs <strong>&#8220;truly&#8221; </strong>reason? This question of whether LLMs are <em>truly</em> capable of reasoning is one of the widely discussed questions in the field of AI today. There are a significant number of studies and claims both in favor and against that LLMs exhibiting reasoning capabilities. This discussion is not limited within the AI research community but it extends to AI practitioners, adopters and general users. As the new LLMs are released that beat the existing benchmarks and solve a wider range of tasks - there are who believe that LLMs are capable of complex human-like reasoning; there are also those who doubt if the capabilities are true reasoning or pattern matching based on what the LLMs had seen during training. In this post I summarize some of the recent papers that discuss reasoning in LLMs.</p><h3>Reasoning</h3><p>Reasoning is a systematic and cognitive process of using existing knowledge to make inferences and evaluations for solving problems. Reasoning is a key aspect of human intelligence and one of the major goals of AI research includes enabling AI systems to exhibit human-like reasoning capabilities. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Based on philosophy and context in Natural Language Processing (NLP), authors in <a href="https://arxiv.org/pdf/2303.14725">Natural Language Reasoning, A Survey</a> define Natural Language Reasoning (NLR) as <em>&#8220;a process to integrate multiple knowledge to derive some new conclusions about the world. Knowledge can be from both explicit and implicit sources. Conclusions are assertions or events assumed to be true in the world, or practical actions.&#8221;</em></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hFgR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hFgR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 424w, https://substackcdn.com/image/fetch/$s_!hFgR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 848w, https://substackcdn.com/image/fetch/$s_!hFgR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 1272w, https://substackcdn.com/image/fetch/$s_!hFgR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hFgR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png" width="1456" height="332" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:332,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:156007,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hFgR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 424w, https://substackcdn.com/image/fetch/$s_!hFgR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 848w, https://substackcdn.com/image/fetch/$s_!hFgR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 1272w, https://substackcdn.com/image/fetch/$s_!hFgR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcad25dd2-d1ef-4190-b7ed-f55017e872eb_1940x442.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2303.14725">Natural Language Reasoning, A Survey</a></figcaption></figure></div><p>In this work, the authors also suggest <em>&#8220;what isn&#8217;t reasoning in NLP&#8221;</em> and <em>&#8220;what NLP reasoning can do.&#8221; </em>Reaching a solution based on memorization from training data, information from knowledge base and context is not considered reasoning. Reasoning in LLMs allows the models to solve complex and unique problems, make informed decisions, and generalize across a new domain and problem space.</p><blockquote><p><em>Definition 2.4 (NLP reasoning). Natural language reasoning is a process to integrate multiple knowledge (e.g. encyclopedic knowledge and commonsense knowledge) to derive some new conclusions about the (realistic or hypothetical) world. Knowledge can be from both explicit and implicit sources. Conclusions are assertions or events assumed to be true in the world, or practical actions.</em></p><p><em>Description 2.3 (NLP negation-based). Natural language reasoning is to derive new assertions, events, or actions without direct recourse to models&#8217; memorization, knowledge base storage and the provided context.</em></p><p><em>Description 2.4 (NLP task-based). Reasoning is an important method to arrive at the required answers or solutions. It is effective when what we need is neither provided by context nor memorized by models and stored by knowledge bases, but reachable by integrating available information.</em> </p><p>- <a href="https://arxiv.org/pdf/2303.14725">Natural Language Reasoning, A Survey</a></p></blockquote><h3>Reasoning in LLMs</h3><p>LLMs that can reason are robust and generalizable across domains while those that rely on pattern matching learned from training data exhibit high variance in their responses, lack generalizability and are not trustworthy.</p><p>Existing research has found that sufficiently large LLMs show <em><a href="https://arxiv.org/pdf/2206.07682">emergent abilities that are not present in smaller models</a>, </em>including complex multi-step reasoning abilities. These reasoning abilities in model can be unlocked with techniques like <em><a href="https://proceedings.neurips.cc/paper_files/paper/2022/file/9d5609613524ecf4f15af0f7b31abca4-Paper-Conference.pdf">chain-of-thought prompting</a> (CoT) </em>or similar techniques where model relies on prior reasoning steps to produce later steps and the final answer (<a href="https://arxiv.org/abs/2305.10601">Yao et al., 2023a</a>,<a href="https://arxiv.org/abs/2305.04091">Wang et al., 2023</a>). This works even in models that are not explicitly trained for reasoning.</p><p>A CoT prompting includes <em>input, chain of thought, and output, </em>where a chain of thought is a series of intermediate natural language reasoning steps that lead to the final output.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!U0Te!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!U0Te!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 424w, https://substackcdn.com/image/fetch/$s_!U0Te!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 848w, https://substackcdn.com/image/fetch/$s_!U0Te!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 1272w, https://substackcdn.com/image/fetch/$s_!U0Te!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!U0Te!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png" width="1345" height="740" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:740,&quot;width&quot;:1345,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:222130,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!U0Te!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 424w, https://substackcdn.com/image/fetch/$s_!U0Te!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 848w, https://substackcdn.com/image/fetch/$s_!U0Te!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 1272w, https://substackcdn.com/image/fetch/$s_!U0Te!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5d7143a-5c21-4b45-af85-10177185b70b_1345x740.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://proceedings.neurips.cc/paper_files/paper/2022/file/9d5609613524ecf4f15af0f7b31abca4-Paper-Conference.pdf">Chain-of-Thought Prompting Elicits Reasoning in Large Language Models</a></figcaption></figure></div><p>CoT prompts are carefully constructed and contain instructions and few-shot examples for the LLMs to learn from, however in <a href="https://openreview.net/pdf?id=e2TBb5y0yFf">Kojima et al. (2022)</a> the authors show that LLMs are <em>&#8220;zero-shot reasoners&#8221;</em> and can significantly improve performance on reasoning benchmarks by simply adding &#8220;Let&#8217;s think step by step&#8221; before each answer, which they call zero-shot-CoT.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mP1P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mP1P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 424w, https://substackcdn.com/image/fetch/$s_!mP1P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 848w, https://substackcdn.com/image/fetch/$s_!mP1P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 1272w, https://substackcdn.com/image/fetch/$s_!mP1P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mP1P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png" width="2311" height="1642" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1642,&quot;width&quot;:2311,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:816360,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mP1P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 424w, https://substackcdn.com/image/fetch/$s_!mP1P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 848w, https://substackcdn.com/image/fetch/$s_!mP1P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 1272w, https://substackcdn.com/image/fetch/$s_!mP1P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5babd082-ea38-4a70-a885-d5c1458ccb91_2311x1642.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://openreview.net/pdf?id=e2TBb5y0yFf">Large Language Models are Zero-Shot Reasoners</a></figcaption></figure></div><p>In both Wei et al. (2022b) and Kojima et al. (2022), the authors found that CoT and zero-shot-CoT prompting drastically improves LLMs&#8217; ability to perform complex reasoning and CoT reasoning is an emergent property of model scale that is not present in smaller models. While the authors in Wei et al. (2022b) show that CoT prompting improves reasoning in LLMs and reveals human-like reasoning processes in LLMs, they refrain from claiming that the model is actually reasoning.</p><blockquote><p><em>&#8220;As for limitations, we first qualify that although chain of thought emulates the thought processes of human reasoners, this does not answer whether the neural network is actually &#8220;reasoning,&#8221; which we leave as an open question.</em></p><p><em>- <a href="https://proceedings.neurips.cc/paper_files/paper/2022/file/9d5609613524ecf4f15af0f7b31abca4-Paper-Conference.pdf">Chain-of-Thought Prompting Elicits Reasoning in Large Language Models</a></em></p></blockquote><h3><strong>Reasoning or Reciting - How reliable are they?</strong></h3><p>Several works have evaluated LLMs on diverse set of reasoning tasks and while LLMs seem to be getting better at solving problems in diverse domains by generating  step-by-step chain-of-thought reasoning - existing research have argued if this step-by-step reasoning in LLMs is actual reasoning or repetition of patterns the models learned during training. </p><p><a href="https://arxiv.org/pdf/2307.02477">Wu et al. (2024)</a> designed a suite of 11 counterfactual tasks to evaluate if the reasoning abilities in LLMs are general and transferable, or specialized to specific tasks seen during pretraining. They found that the performance of the model degrades on the counterfactual tasks compared to the default version of the tasks. This shows that the reasoning and problem solving abilities the LLMs display often rely on narrow, non-transferable steps for solving problems that are learned during training. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0--g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0--g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 424w, https://substackcdn.com/image/fetch/$s_!0--g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 848w, https://substackcdn.com/image/fetch/$s_!0--g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 1272w, https://substackcdn.com/image/fetch/$s_!0--g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0--g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png" width="1456" height="1246" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1246,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:899398,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0--g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 424w, https://substackcdn.com/image/fetch/$s_!0--g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 848w, https://substackcdn.com/image/fetch/$s_!0--g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 1272w, https://substackcdn.com/image/fetch/$s_!0--g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29f7bbc7-bd13-4f9b-81a2-386c01e2a9fa_1568x1342.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/abs/2307.0247">Reasoning or Reciting? Exploring the Capabilities and Limitations of Language Models Through Counterfactual Tasks</a> </figcaption></figure></div><p>In<a href="https://arxiv.org/pdf/2406.11050"> Jiang et al (2024)</a> the authors generate synthetic data, perform systematic token perturbations, and evaluate an LLM for comparative studies to show that LLMs are subject to token bias which creates an illusion of reasoning in LLMs. The experiments in this work reveal that the reasoning abilities displayed by the LLMs are not consistent and rely heavily on token bias for response generation, which shows that the reasoning process in LLMs is more a pattern matching than genuine reasoning.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0oUd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0oUd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 424w, https://substackcdn.com/image/fetch/$s_!0oUd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 848w, https://substackcdn.com/image/fetch/$s_!0oUd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 1272w, https://substackcdn.com/image/fetch/$s_!0oUd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0oUd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png" width="314" height="512.9786096256685" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1222,&quot;width&quot;:748,&quot;resizeWidth&quot;:314,&quot;bytes&quot;:417848,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0oUd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 424w, https://substackcdn.com/image/fetch/$s_!0oUd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 848w, https://substackcdn.com/image/fetch/$s_!0oUd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 1272w, https://substackcdn.com/image/fetch/$s_!0oUd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b3c00ef-893f-4726-bf0c-004eec042d1d_748x1222.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2406.11050">A Peek into Token Bias: Large Language Models Are Not Yet Genuine Reasoners</a></figcaption></figure></div><p><a href="https://arxiv.org/pdf/2410.05229">Mirzadeh et al. 2024</a> conducted a large-scale study of 25 state-of-the-art open and closed models. In this work, they evaluate the models for their mathematical reasoning abilities. In this work they introduce GSM-Symbolic, an enhanced benchmark with diverse variants of GSM8K questions generated using symbolic templates.<a href="https://huggingface.co/datasets/openai/gsm8k"> GSM8K</a> is a popular evaluation benchmark of grade school Math questions and has been used by several existing studies to show Mathematical reasoning abilities in LLMs. Additionally, they also introduce the GSM-NoOp dataset, created by adding &#8220;<em>seemingly relevant but ultimately irrelevant information to problems.&#8221;</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kAjD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kAjD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 424w, https://substackcdn.com/image/fetch/$s_!kAjD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 848w, https://substackcdn.com/image/fetch/$s_!kAjD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 1272w, https://substackcdn.com/image/fetch/$s_!kAjD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kAjD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png" width="1456" height="1184" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1184,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:521360,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kAjD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 424w, https://substackcdn.com/image/fetch/$s_!kAjD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 848w, https://substackcdn.com/image/fetch/$s_!kAjD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 1272w, https://substackcdn.com/image/fetch/$s_!kAjD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83c87538-b704-4ec7-abac-827db245c2a0_1754x1426.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2410.05229">GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models</a></figcaption></figure></div><p>The findings from GSM-Symbolic experiments reveal that all state-of-the-art LLMs exhibit performance decline on GSM-Symbolic compared to original GSM8K benchmark, &#8220;<em>hinting at potential data contamination.&#8221;</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6v37!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6v37!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 424w, https://substackcdn.com/image/fetch/$s_!6v37!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 848w, https://substackcdn.com/image/fetch/$s_!6v37!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 1272w, https://substackcdn.com/image/fetch/$s_!6v37!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6v37!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png" width="1456" height="735" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:735,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:231775,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6v37!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 424w, https://substackcdn.com/image/fetch/$s_!6v37!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 848w, https://substackcdn.com/image/fetch/$s_!6v37!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 1272w, https://substackcdn.com/image/fetch/$s_!6v37!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49bb9b0d-7926-4de7-9b41-3ce225dc2e57_1770x894.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2410.05229">GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models</a></figcaption></figure></div><p>Additionally, they observed substantial performance drop (up to 65%) on the GSM-NoOp dataset, which shows that the models lack the ability to understand mathematical concepts and discern relevant information required for problem-solving. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JUC5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JUC5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 424w, https://substackcdn.com/image/fetch/$s_!JUC5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 848w, https://substackcdn.com/image/fetch/$s_!JUC5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 1272w, https://substackcdn.com/image/fetch/$s_!JUC5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JUC5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png" width="314" height="432.66279069767444" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:948,&quot;width&quot;:688,&quot;resizeWidth&quot;:314,&quot;bytes&quot;:146611,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JUC5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 424w, https://substackcdn.com/image/fetch/$s_!JUC5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 848w, https://substackcdn.com/image/fetch/$s_!JUC5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 1272w, https://substackcdn.com/image/fetch/$s_!JUC5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd27b9778-49ab-43f9-9484-c61630fb6ef4_688x948.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2410.05229">GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models</a></figcaption></figure></div><p>In addition to what seems like recitation than reasoning, existing studies have also shown that the LLM explanations in themselves might not be faithful <a href="https://arxiv.org/pdf/2305.04388">Turpin et al. (2023)</a>, <a href="https://arxiv.org/abs/2307.13702">Lanham et al. (2023)</a>, <a href="https://www.lesswrong.com/posts/FX5JmftqL2j6K8dn4/shapley-value-attribution-in-chain-of-thought">Shapley Value Attribution in Chain of Thought</a>. </p><p>Turpin et al. (2023) reveals that CoT explanations from LLMs can be systematically misleading and may not reflect the true reason for a model&#8217;s prediction. In their work they show that biasing the model&#8217;s input towards incorrect answers results in LLMs to fail and generate CoT explanations that rationalizes the incorrect answers. For example by just reordering the multiple-choice options in a few-shot prompt to make the answer always &#8220;(A)&#8221;, an LLM could be tricked into predicting A with a CoT explanation that is consistent with the prediction but is not faithful to the model's decision process.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!b6oH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b6oH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 424w, https://substackcdn.com/image/fetch/$s_!b6oH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 848w, https://substackcdn.com/image/fetch/$s_!b6oH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 1272w, https://substackcdn.com/image/fetch/$s_!b6oH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!b6oH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png" width="1456" height="568" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:568,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:425547,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b6oH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 424w, https://substackcdn.com/image/fetch/$s_!b6oH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 848w, https://substackcdn.com/image/fetch/$s_!b6oH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 1272w, https://substackcdn.com/image/fetch/$s_!b6oH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33f58436-7869-44a3-b0ad-96613f9b3150_2394x934.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2305.04388">Language Models Don&#8217;t Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Prompting</a></figcaption></figure></div><p>In contrast, Lanham et al. (2023) explores non-adversarial experiments to study CoT faithfulness in LLMs. They do it by truncating, adding mistakes/fillers or paraphrasing the original CoT prompt. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Z6CS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Z6CS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 424w, https://substackcdn.com/image/fetch/$s_!Z6CS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 848w, https://substackcdn.com/image/fetch/$s_!Z6CS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 1272w, https://substackcdn.com/image/fetch/$s_!Z6CS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Z6CS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png" width="322" height="491.81094527363183" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1228,&quot;width&quot;:804,&quot;resizeWidth&quot;:322,&quot;bytes&quot;:223673,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Z6CS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 424w, https://substackcdn.com/image/fetch/$s_!Z6CS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 848w, https://substackcdn.com/image/fetch/$s_!Z6CS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 1272w, https://substackcdn.com/image/fetch/$s_!Z6CS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094e566c-e2f2-431c-bbf6-ec480c37a40c_804x1228.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/abs/2307.13702">Measuring Faithfulness in Chain-of-Thought Reasoning</a></figcaption></figure></div><p>The authors found that some tasks rely heavily on reasoning steps to get to the final answer (e.g. <a href="https://aclanthology.org/P17-1015.pdf">AQuA</a>), while others don&#8217;t (e.g. <a href="https://arxiv.org/abs/1803.05457">ARC</a>) and reasoning faithfulness is significantly lower for some tasks. Surprisingly, they observed that the post-hoc reasoning (i.e. reasoning generated after an answer is decided, which is more likely to be unfaithful) increases with model size on each task, and increases with easier tasks at the same model size. They also observed that the amount of post-hoc reasoning doesn&#8217;t always predict how much CoT improves task performance. In fact, faithful reasoning does not always mean higher performance. </p><h3>Conclusion</h3><p>Existing research has shown LLMs can effectively mimic human reasoning processes when solving complex problems. By decomposing complex tasks into smaller and more manageable tasks, LLMs can solve the problems via a sequence of logical chain-of-thought (CoT). The chain-of-thought showcases how LLMs are able to engage in human-like step-by-step problem solving, which is often quoted as evidence of reasoning abilities in LLMs.</p><p>However, more recent studies found some CoT explanations to be unfaithful and post-hoc, meaning LLMs&#8217; reasoning was generated after an answer was decided. One could argue that the post-hoc explanations provide evidence for reasoning ability but there is mounting evidence that show LLMs rely heavily on token bias and are not true reasoners. They are susceptible to small changes in the input prompt and show high variance on different versions of a question from benchmarks they are good at, which suggests that they have memorized some of the solutions from training.</p><p>Yes, over the years, LLMs&#8217; performance on several benchmarks across various domains have significantly improved and they are now able to solve more complex tasks more efficiently. However, a simple adversarial prompting like reordering the multiple-choice options in a few-shot prompt to make the answer always &#8220;(A)&#8221; could trick a LLM into predicting A even when it is incorrect shows that LLMs are susceptible manipulation and are incapable of discerning misleading patterns, which shows LLMs rely heavily on patterns and input token biases rather than engaging in true reasoning.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Strawberry (o1) - Does changing language affect its reasoning?]]></title><description><![CDATA[What is going on inside OpenAI's o1 model and if changing language affect its reasoning - a short bilingual experiment.]]></description><link>https://www.icodeformybhasa.com/p/strawberry-o1-does-changing-language</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/strawberry-o1-does-changing-language</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sun, 22 Sep 2024 19:06:18 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/8a89e234-82e9-4f4e-90d7-807b66117c66_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On September 12, OpenAI<a href="https://openai.com/index/learning-to-reason-with-llms/"> </a><em><a href="https://openai.com/index/introducing-openai-o1-preview/">released</a></em> its new series of AI models trained with<a href="https://openai.com/index/learning-to-reason-with-llms/"> </a><em><a href="https://openai.com/index/learning-to-reason-with-llms/">reinforcement learning to perform complex reasoning</a> </em>- called o1.<em> </em>Two versions of the model were released, o1-preview and o1-mini. These models are trained to &#8220;think&#8221; before answering or it is trained to generate a long chain of thought (CoT) before answering. This allows the model to handle complex reasoning and solve tasks that require reasoning.<em> </em>With o1, we will see a shift in focus from scaling pretraining to inference compute.</p><blockquote><p><em>&#8220;o1 marks the start of a new era in AI, where models are trained to "think" before answering through a private chain of thought. The more time they take to think, the better they handle complex reasoning. We're no longer limited by pretraining paradigm; now, we can scale through inference compute, opening up new possibilities for capabilities and alignment.</em></p><p><em>- Part of a tweet by Mira Murati, CTO, OpenAI on <a href="https://x.com/miramurati/status/1834425979680555280">Twitter</a></em> </p></blockquote><p>There are many speculations on the o1 series of models and how the models were potentially trained to think, although the specific techniques used by OpenAI is still not public. In this post, we will first summarize what we know from official sources -<a href="https://openai.com/index/learning-to-reason-with-llms/"> release note</a> and AMA by OpenAI o1 team on<a href="https://x.com/OpenAIDevs/status/1834608585151594537"> Twitter</a>. We will also look into the<a href="https://arxiv.org/pdf/2305.20050"> </a><em><a href="https://arxiv.org/pdf/2305.20050">&#8220;Let&#8217;s Verify Step by Step&#8221;</a>, </em>which was published last year and many, including me, believe that this paper could provide insights into the techniques used in training the o1 family of models. Finally, I will share my experience with using the o1-mini model for Mathematics and Science questions from SEE exams in Nepal. I will also ask the same set of questions in Nepali and English to understand if changing language affects the model&#8217;s reasoning.</p><p>Before we jump into the rest of the blog - I highly recommend reading the following:</p><ul><li><p><a href="https://openai.com/index/learning-to-reason-with-llms/">Learning to Reason with LLMs</a>, September 12, 2024 by OpenAI</p></li><li><p><a href="https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/">OpenAI o1-mini, Advancing cost-efficient reasoning</a>, September 12, 2024 by OpenAI</p></li><li><p><a href="https://arxiv.org/pdf/2305.20050">Let&#8217;s Verify Step by Step</a>, 31 May 2023 by OpenAI</p></li><li><p><a href="https://www.interconnects.ai/p/reverse-engineering-openai-o1">Reverse engineering OpenAI&#8217;s o1</a>, September 16, 2024 by Nathan Lambert</p></li></ul><h3>Straight From The Source</h3><p>The o1 series models are trained with reinforcement learning to think before they answer, which allows for the model to perform sophisticated reasoning. They produce an internal chain of thought before responding, which allows these models to provide highly accurate results - especially for domains like science, mathematics, programming and analytics that require structured thinking and step-by-step problem solving.</p><blockquote><p>&#8220;<em>o1 ranks in the 89th percentile on competitive programming questions (Codeforces), places among the top 500 students in the US in a qualifier for the USA Math Olympiad (AIME), and exceeds human PhD-level accuracy on a benchmark of physics, biology, and chemistry problems (GPQA).</em></p><p>- <a href="https://openai.com/index/learning-to-reason-with-llms/">Learning to Reason with LLMs</a>, September 12, 2024 by OpenAI</p></blockquote><p>The o1 family of models are trained with reinforcement learning, where the models are likely trained using large datasets annotated for correctness at every step of its reasoning process. This allows that the model to learn to reason before returning the answer. In their research, they found that the performance of the model consistently<em> improved with more reinforcement learning (train-time compute) and with more time spent thinking (test-time compute).</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CA2L!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CA2L!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 424w, https://substackcdn.com/image/fetch/$s_!CA2L!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 848w, https://substackcdn.com/image/fetch/$s_!CA2L!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 1272w, https://substackcdn.com/image/fetch/$s_!CA2L!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CA2L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png" width="618" height="355.68956043956047" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:838,&quot;width&quot;:1456,&quot;resizeWidth&quot;:618,&quot;bytes&quot;:152127,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CA2L!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 424w, https://substackcdn.com/image/fetch/$s_!CA2L!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 848w, https://substackcdn.com/image/fetch/$s_!CA2L!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 1272w, https://substackcdn.com/image/fetch/$s_!CA2L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c5d88c0-4ffb-4b6c-8bf7-b9291b707b0c_1540x886.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://openai.com/index/learning-to-reason-with-llms/">Learning to Reason with LLMs</a></figcaption></figure></div><p>On contrary to the most of existing LLMs where a very little amount of compute is dedicated to inference, o1 spends more time on inference. o1 model is a paradigm shift in how compute resources are allocated in LLMs. As Jim Fan pointed out in his <a href="https://x.com/DrJimFan/status/1834279865933332752">Twitter post</a> - now we see a <em>paradigm of inference-time scaling deployed in production. </em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!T1YI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!T1YI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 424w, https://substackcdn.com/image/fetch/$s_!T1YI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 848w, https://substackcdn.com/image/fetch/$s_!T1YI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 1272w, https://substackcdn.com/image/fetch/$s_!T1YI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!T1YI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png" width="512" height="252.7058823529412" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:537,&quot;width&quot;:1088,&quot;resizeWidth&quot;:512,&quot;bytes&quot;:123776,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!T1YI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 424w, https://substackcdn.com/image/fetch/$s_!T1YI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 848w, https://substackcdn.com/image/fetch/$s_!T1YI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 1272w, https://substackcdn.com/image/fetch/$s_!T1YI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eee84ca-ce30-4a68-8eec-ad04399c63aa_1088x537.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From Jim Fan&#8217;s <a href="https://x.com/DrJimFan/status/1834279865933332752">Twitter post</a> </figcaption></figure></div><h3>In a League of Its Own</h3><p>The evaluation results shared in the blog shows that o1 has superior reasoning in comparison to GPT-4o. It significantly outperforms GPT-4o in 54 out of 57 MMLU subcategories. According to OpenAI - <em>&#8220;o1 models offer significant<a href="https://openai.com/index/introducing-openai-o1-preview/"> advancements</a> in reasoning, but they <strong>are not intended to replace GPT-4o in all use-cases</strong>.&#8221;</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9E2a!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9E2a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 424w, https://substackcdn.com/image/fetch/$s_!9E2a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 848w, https://substackcdn.com/image/fetch/$s_!9E2a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 1272w, https://substackcdn.com/image/fetch/$s_!9E2a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9E2a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png" width="1456" height="677" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:677,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:183781,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9E2a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 424w, https://substackcdn.com/image/fetch/$s_!9E2a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 848w, https://substackcdn.com/image/fetch/$s_!9E2a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 1272w, https://substackcdn.com/image/fetch/$s_!9E2a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ec37a5-a240-49d8-8f09-034824b69143_1458x678.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://openai.com/index/learning-to-reason-with-llms/">Learning to Reason with LLMs</a></figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fCvt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fCvt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 424w, https://substackcdn.com/image/fetch/$s_!fCvt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 848w, https://substackcdn.com/image/fetch/$s_!fCvt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 1272w, https://substackcdn.com/image/fetch/$s_!fCvt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fCvt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png" width="1456" height="1132" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1132,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:374283,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fCvt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 424w, https://substackcdn.com/image/fetch/$s_!fCvt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 848w, https://substackcdn.com/image/fetch/$s_!fCvt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 1272w, https://substackcdn.com/image/fetch/$s_!fCvt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97021f54-81b6-4d87-803b-967ba44770c8_1492x1160.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://openai.com/index/learning-to-reason-with-llms/">Learning to Reason with LLMs</a></figcaption></figure></div><p>The results are impressive, although the training process of the model remains undisclosed - there are speculations, nevertheless. In the next section, we will briefly discuss  <em><a href="https://arxiv.org/pdf/2305.20050">&#8220;Let&#8217;s Verify Step by Step&#8221;</a>, </em>which could potentially give away the techniques used in training the o1 family of models. </p><h3>Let&#8217;s Verify Step by Step</h3><p>Let&#8217;s Verify Step by Step, looks into methods to train reliable reward models that can detect hallucinations for LLMs. In this work, the researchers investigate two methods for training reward models: outcome supervision and process supervision. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Z38p!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Z38p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 424w, https://substackcdn.com/image/fetch/$s_!Z38p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 848w, https://substackcdn.com/image/fetch/$s_!Z38p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 1272w, https://substackcdn.com/image/fetch/$s_!Z38p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Z38p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png" width="468" height="417.991935483871" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:886,&quot;width&quot;:992,&quot;resizeWidth&quot;:468,&quot;bytes&quot;:101562,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Z38p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 424w, https://substackcdn.com/image/fetch/$s_!Z38p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 848w, https://substackcdn.com/image/fetch/$s_!Z38p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 1272w, https://substackcdn.com/image/fetch/$s_!Z38p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04e7da60-2753-49b2-a8f6-c837d8f21fc9_992x886.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Outcome supervision reward model provides feedback for a final result from LLMs. The LLM  tries different CoT paths and receives feedback based on the final outcome. The correct responses get rewarded while the incorrect ones get penalized and over time the model learns to discard paths that are unsuccessful and reinforce the ones that are successful. </p><p>Process supervision on the other hand provides feedback for each intermediate reasoning step, not just the final state. This trains the model to break down the problems into logical steps - similar to what a human would. This would allow the model to not just be structured and logical it would also be able to identify mistakes when they occur during a reasoning step.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YgPq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YgPq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 424w, https://substackcdn.com/image/fetch/$s_!YgPq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 848w, https://substackcdn.com/image/fetch/$s_!YgPq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 1272w, https://substackcdn.com/image/fetch/$s_!YgPq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YgPq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png" width="1456" height="1063" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1063,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:747673,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YgPq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 424w, https://substackcdn.com/image/fetch/$s_!YgPq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 848w, https://substackcdn.com/image/fetch/$s_!YgPq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 1272w, https://substackcdn.com/image/fetch/$s_!YgPq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4ffd95-492f-4721-ae40-7484a15847f9_1572x1148.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2305.20050">Let&#8217;s Verify Step by Step</a></figcaption></figure></div><p>So we know that o1 thinks before responding and this thinking process involves reinforcement learning to train the model to generate a private chain of thought (CoT). Based on this, it is fair to speculate that the o1 model likely iterates through and evaluates each action state in its CoT, which allows the model to reason and generate the best CoT path that leads to a correct solution. There is a possibility that OpenAI could have used either of the methods or a combination of both outcome and process supervision. I am leaning towards the latter because in their investigation in Let&#8217;s Verify Step by Step they found that models trained with process supervision significantly outperformed those trained with outcome supervision on challenging reasoning tasks.</p><p>However, with process supervision reward model alone, the model might keep generating paths that don&#8217;t lead to an answer - so an outcome supervision reward model might have been used in combination as well to give feedback on whether the LLMs got the answer right or some kind of stopping criterion could have been used. By combining these two models, the system gets feedback on each state and the final answer - this helps the model to correct its path if it gets any of the intermediary paths wrong. Additionally,<a href="https://arxiv.org/pdf/2406.14283"> Q*</a> framework could be employed during CoT generation to help the model choose the next best reasoning state, making the overall process more efficient and strategic.</p><h3>o1 Inference</h3><p>While o1 outperforms the existing models several on benchmarks, it is still an extremely expensive model in comparison. o1-preview available via chat completion endpoint and costs $15 per 1 million input tokens and $60 per 1 million output tokens, which is much higher than GPT-4o that costs $5 per 1 million input tokens and $15 per 1 million output tokens.</p><p><strong>Access. </strong>As of now there are two reasoning models available in beta versions: o1-preview and o1-mini with limited features. The preview model is only an early checkpoint of the o1 model. Many chat completion API parameters are <a href="https://platform.openai.com/docs/guides/reasoning">not available yet</a>. Additionally, if you want to access o1 models via chat completion API you need to be a Tier 5 user. </p><ul><li><p><code>o1-preview</code><strong>:</strong> o1 model, designed to reason about hard problems using broad general knowledge about the world; Limit: 30 messages a week.</p></li><li><p><code>o1-mini</code><strong>:</strong> a faster and cheaper version of o1, particularly adept at coding, math, and science tasks where extensive general knowledge isn't required; Limit: 50 messages a week.</p></li></ul><p>Scaling o1 for general use-case and a widespread deployment is hard, which is very likely the reason for limited access. The o1 model is also a lot more expensive than GPT-4o. The users are also charged for the reasoning tokens, which they don&#8217;t have access to. While the improvements are great - the inaccessibility - not so much.</p><blockquote><p>- &#8220;<em>While reasoning tokens are not visible via the API, they still occupy space in the model's context window and are billed as <a href="https://openai.com/pricing">output tokens</a>.</em></p><p><em>- <a href="https://platform.openai.com/docs/guides/reasoning/reasoning">Reasoning models</a> by OpenAI</em></p></blockquote><p>We know that o1 is 6x more expensive than GPT-4o but offers advanced reasoning capabilities. While tokenization and pricing have improved for GPT-4o, especially with recent tokenizer updates, tokenization in diverse, non-Latin languages like Nepali<a href="https://www.icodeformybhasa.com/p/beyond-the-abcs-exploring-the-nuances"> remains suboptimal and more expensive</a>. So now, let's test if o1 is worth the extra cost for a non-Latin language like Nepali. Also, if changing language affects o1&#8217;s reasoning ability?</p><h3>A Short Bilingual Experiment</h3><p>In this brief experiment, I will present GPT-4o and o1-preview with 10 SEE examination questions via the chat application - consisting of 5 questions in science and 5 in mathematics. Each question is in Nepali and English. This will help us explore o1&#8217;s reasoning abilities and assess how it handles questions in a non-Latin low-resource language compared to English.</p><p>Note: I am OpenAI-poor, so these examples were run through the regular chatGPT with GPT-4o and o1-preview and not via the API and the total output tokens are the tokens generated via tiktoken for comparison, so this is just an estimated difference and not an actual one.</p><p><strong>Correctness. </strong>Out of the 5 general science questions in English and Nepali, both GPT-4o and o1-preview got all 5 questions right. For 5 mathematics questions both the models got one question wrong each, different questions. Upon inspection, I found that the cause of mistake in o1-preview was not because of the reasoning or any steps in problem solving but because of a translation error that propagated to the error in the final answer. However, the error with GPT-4o was actually due to a failure in understanding a parameter in the question.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0KYa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0KYa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 424w, https://substackcdn.com/image/fetch/$s_!0KYa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 848w, https://substackcdn.com/image/fetch/$s_!0KYa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 1272w, https://substackcdn.com/image/fetch/$s_!0KYa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0KYa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png" width="1456" height="1153" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1153,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:264443,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0KYa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 424w, https://substackcdn.com/image/fetch/$s_!0KYa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 848w, https://substackcdn.com/image/fetch/$s_!0KYa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 1272w, https://substackcdn.com/image/fetch/$s_!0KYa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05d78b16-0717-432e-bea7-a102ab745a94_1556x1232.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">o1-preview failing to correctly translate &#8220;&#2309;&#2352;&#2381;&#2328;&#2357;&#2381;&#2351;&#2366;&#2360;&#8221; which results in the error in the final answer but pretty impressive that it did try to clarify the terminology although it failed</figcaption></figure></div><blockquote><p>For Example:</p><p>&#2319;&#2313;&#2335;&#2366; &#2348;&#2375;&#2354;&#2344;&#2366;&#2325;&#2379; &#2309;&#2352;&#2381;&#2328;&#2357;&#2381;&#2351;&#2366;&#2360; 35 &#2360;&#2375;.&#2350;&#2367;. &#2352; &#2309;&#2352;&#2381;&#2343;&#2357;&#2381;&#2351;&#2366;&#2360; &#2352; &#2313;&#2330;&#2366;&#2311;&#2325;&#2379; &#2351;&#2379;&#2327;&#2347;&#2354; 65 &#2360;&#2375;.&#2350;&#2367;. &#2349;&#2319; &#2360;&#2379; &#2348;&#2375;&#2354;&#2344;&#2366;&#2325;&#2379; &#2357;&#2325;&#2381;&#2352;&#2360;&#2340;&#2361;&#2325;&#2379; &#2325;&#2381;&#2359;&#2375;&#2340;&#2381;&#2352;&#2347;&#2354; &#2346;&#2340;&#2381;&#2340;&#2366; &#2354;&#2327;&#2366;&#2313;&#2344;&#2369;&#2361;&#2379;&#2360;&#2381;&#8204; &#2404;</p><p>The question translates to: The radius of a cylinder is 35 cm, and the sum of its radius and height is 65 cm. Find the curved surface area of the cylinder.</p><p>However when asked this to o1-preview, &#2309;&#2352;&#2381;&#2328;&#2357;&#2381;&#2351;&#2366;&#2360; was translated to diameter instead of radius. Also, looking at the following block from reasoning section (refer above image to see the reasoning summary):</p><p><em><strong>Revisiting the measure</strong></em></p><p><em>I&#8217;m clarifying the terminology in Nepali, noting that "&#2309;&#2352;&#2381;&#2341;&#2357;&#2381;&#2351;&#2366;&#2360;" means diameter and "&#2309;&#2352;&#2381;&#2343;&#2357;&#2381;&#2351;&#2366;&#2360;" means radius, likely a typo. The diameter is 35 cm, and the sum of the radius and height is 65 cm.</em></p><p>&#2309;&#2352;&#2381;&#2343;&#2357;&#2381;&#2351;&#2366;&#2360; was was somehow mapped to &#2309;&#2352;&#2381;&#2341;&#2357;&#2381;&#2351;&#2366;&#2360;, which was then translated to diameter - which anyway is incorrect. Since, we don&#8217;t see the full reasoning stack - it is hard to say what happened here. My guess is &#2309;&#2352;&#2381;&#2343;&#2357;&#2381;&#2351;&#2366;&#2360; could have been tokenized incorrectly by the model, which may have confused the model when interpreting the word.</p></blockquote><p><strong>Output token and word count. </strong>For both Nepali and English variants of the questions, o1-preview generated significantly more output tokens and words compared to GPT-4o. In English, o1-preview generated 4.5 times more tokens (711.9 vs 158.9) and 3 times more words (344.3 vs 112.9) than GPT-4o. Although less pronounced, a similar trend was observed in Nepali, where o1-preview produced 1.8 times more tokens (495.2 vs 270.4) and 1.6 times more words (150.7 vs 91.4) than GPT-4o. This shows that o1-preview has a tendency to return detailed responses, which is inline with what I observed during my manual analysis of the output. My observation Note: These numbers exclude the thinking tokens that are visible to users. Including these tokens would further increase the counts for o1-preview. Given that the actual reasoning tokens exceed  what is shown to users, the true difference in token count - and hence, the cost of solving the same problem - is substantially higher for o1-preview compared to GPT-4o. </p><p><strong>Thinking or reasoning token and word count. </strong>With o1-preview you get &#8220;<em>a summary&#8221;</em> of the model&#8217;s reasoning process. We know that the actual reasoning tokens are hidden from the users so this looks like a summarized version of the model's reasoning stack.</p><p>Interestingly, despite the output token and word counts being significantly higher for English compared to Nepali, the reasoning token and word counts are only slightly higher for English. This suggests that while the model engages in more extensive reasoning and elaboration when generating English responses, the underlying reasoning steps might be more consistent across both languages. One thing that I did notice during my qualitative analysis was that queries in Nepali were often translated to English, which means even when the query is in Nepali the model reasoning happens in English. As a result, while the model can still handle Nepali input, it is likely to lose some of the original context during translation that leads to errors or less precise responses. This probably happens with GPT-4o as well.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ny5f!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ny5f!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 424w, https://substackcdn.com/image/fetch/$s_!Ny5f!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 848w, https://substackcdn.com/image/fetch/$s_!Ny5f!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 1272w, https://substackcdn.com/image/fetch/$s_!Ny5f!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ny5f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png" width="654" height="496.8232044198895" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1100,&quot;width&quot;:1448,&quot;resizeWidth&quot;:654,&quot;bytes&quot;:219784,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ny5f!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 424w, https://substackcdn.com/image/fetch/$s_!Ny5f!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 848w, https://substackcdn.com/image/fetch/$s_!Ny5f!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 1272w, https://substackcdn.com/image/fetch/$s_!Ny5f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88836825-fae7-4c8c-9cae-6e33310ad0d5_1448x1100.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">o1-preview first translating a Nepali question to English and then reasoning through the solution.</figcaption></figure></div><p><strong>Reasoning time. </strong>Given how the reasoning unfolds in English regardless of the language of the original query - the reasoning time is similar 8.9 seconds for Nepali v/s 8.6 seconds for English.</p><h3>Conclusion</h3><p>The o1 family of models are a new class of models that are trained with the ability to reason. While there is little to no information on how the model was trained - adding up the recent publications, theories of LLMs and information released on the model&#8217;s release notes there are speculations that point to how the o1 models were potentially trained. The models could have been trained using either process supervision and outcome supervision reward models or a combination of both. A short bilingual experimentation with 5 science and 5 mathematics questions in Nepali and English shows that the models, both GPT-4o and o1-preview, generate a more verbose response for English. This shows that the models are better at explaining output and generating response in English than in Nepali. However, most of the reasoning happens in English - regardless of the language of the query, so an error in translation in the beginning can cause the entire reasoning chain to be futile. Also, for this use-case I tested the model in GPT-4o was almost as good as o1-preview, however this is a very small experiment and the questions are on the simpler side. It would be fun to test this on more challenging Nepali questions.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Low-Rank Adaptation of LLaMA 3 for Nepali and Hindi]]></title><description><![CDATA[PEFT Techniques and Findings from Fine-tuning LLaMA 3 with Low-Rank Adaptation for Nepali and Hindi]]></description><link>https://www.icodeformybhasa.com/p/low-rank-adaptation-of-llama-3-for</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/low-rank-adaptation-of-llama-3-for</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Thu, 05 Sep 2024 03:14:54 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!CgGo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The space of open-source and open-weights Large Language Models (LLMs) is growing and it is great news for practitioners, researchers and consumers of these advanced AI models. Now, individuals and organizations, who otherwise have limited financial resources to cover the substantial costs associated with pre-training <em>&#8220;can leverage&#8221;</em> these open-source and open-weights LLMs for their specialized use cases.<em> </em>However, adapting these LLMs for specialized use cases remains an involved and expensive process, especially when it comes to implementing them in low-resource settings. A lot of times, these adaptations require significant computational resources and expertise, which can be challenging to obtain in resource-constrained environments. This is particularly true when dealing with low-resource languages and domains that have not been seen or have had little exposure during the pre-training process. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CgGo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CgGo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 424w, https://substackcdn.com/image/fetch/$s_!CgGo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 848w, https://substackcdn.com/image/fetch/$s_!CgGo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 1272w, https://substackcdn.com/image/fetch/$s_!CgGo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CgGo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png" width="488" height="488" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:488,&quot;bytes&quot;:5495310,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CgGo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 424w, https://substackcdn.com/image/fetch/$s_!CgGo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 848w, https://substackcdn.com/image/fetch/$s_!CgGo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 1272w, https://substackcdn.com/image/fetch/$s_!CgGo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26100a98-0095-4445-9e2c-b7e803777258_2048x2048.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Generated using Midjourney</figcaption></figure></div><p>In the <a href="https://www.icodeformybhasa.com/p/aligning-llms-fine-tuning-llama-with">previous post</a>, we discussed different methods used in aligning LLMs to specific tasks and desired behaviors, including Supervised Fine-Tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF), both of which are expensive and challenging tasks that involves a complex process and a carefully curate high quality dataset.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;64b8177d-33d7-4564-8852-63822216f179&quot;,&quot;caption&quot;:&quot;Large Language Models (LLMs) like LLaMA are pretrained with large amounts of unlabeled text with self-supervised training objectives like next token prediction. Pretraining LLMs with self-supervised objectives allows the model to learn rich representation in language and across different domain from the large volume of unlabeled text that is readily ava&#8230;&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;md&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Aligning LLMs - Fine-Tuning LLaMA with SFT and RHLF &quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:104468357,&quot;name&quot;:&quot;Shreeya Dhakal&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ccf9e7e-b918-482e-b8ed-800ad52e084e_1176x982.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-07-04T05:15:36.608Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://www.icodeformybhasa.com/p/aligning-llms-fine-tuning-llama-with&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:145452654,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:1,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;#icodeformy&#2349;&#2366;&#2359;&#2366;&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4d92160-5f82-40ca-8233-b069f42bbba6_1080x1080.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>In this post, we will focus on methods for fine-tuning LLMs to adapt them to specific domains and use cases in resource constraint settings. We will discuss different Parameter Efficient Fine-Tuning (PEFT) techniques. We will share our results from fine-tuning LLaMA 3 for Nepali and Hindi, two South Asian languages, one of which is a high-resource language and another is a low-resource language. </p><h3>Fine-Tuning LLMs</h3><p>A language model is pretrained on massive corpora of unlabelled texts, during which it learns rich representations about language and acquires general knowledge across multiple domains without relying on explicit annotations. After the initial pretraining, LLMs are fine-tuned, often using human-curated data for specialized goals and use cases. Fine-tuning is computationally cheaper than pretraining the model, but full fine-tuning of LLMs can still be computationally unachievable for a large number of individuals and institutions. As pretrained language models continue to grow in size, research into computationally efficient methods to fine-tune these LLMs is also evolving.</p><h3>Parameter Efficient Fine-Tuning</h3><p>During a full fine-tuning, a pretrained model is initialized with the pretrained weights and all of the model parameters and layers are trained and updated. This requires a substantial amount of curated data and computational resources as the model is trained from scratch for specific use cases. In contrast, Parameter Efficient Fine-Tuning (PEFT) methods aim to adapt LLMs by reducing the number of trainable parameters or update a small number of additional parameters or modifying only a subset of the pretrained parameters - all while maintaining the comparable performance of a full fine-tuning.</p><h4>PEFT Methods</h4><p>Several PEFT methods have evolved over the years, each offering a way to adapt large pretrained models without the need for full fine-tuning of the model parameters.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EjSk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EjSk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 424w, https://substackcdn.com/image/fetch/$s_!EjSk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 848w, https://substackcdn.com/image/fetch/$s_!EjSk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 1272w, https://substackcdn.com/image/fetch/$s_!EjSk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EjSk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png" width="1456" height="1050" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1050,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:461142,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EjSk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 424w, https://substackcdn.com/image/fetch/$s_!EjSk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 848w, https://substackcdn.com/image/fetch/$s_!EjSk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 1272w, https://substackcdn.com/image/fetch/$s_!EjSk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e88d32d-54f9-4d6c-b331-3d909c9deead_1910x1378.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2312.12148">Parameter-Efficient Fine-Tuning Methods for Pretrained Language Models: A Critical Review and Assessment</a></figcaption></figure></div><p>Some popular PEFT methods as also discussed in <a href="https://arxiv.org/pdf/2312.12148">Parameter-Efficient Fine-Tuning Methods for Pretrained Language Models: A Critical Review and Assessment</a> involve:</p><p><strong>Additive fine-tuning</strong> involves adding new trainable parameters to the pretrained models while keeping the original pre-trained weights frozen. Some popular examples of additive fine-tuning include adapters, prefix tuning and prompt-based fine-tuning. </p><p><strong>Partial or selective fine-tuning </strong>involves selecting and updating only a subset of pretrained model parameters. Layer-wise bias update, sparse fine-tuning of selected weights are some methods of partial fine-tuning of pretrained models. </p><p><strong>Reparameterized fine-tuning </strong>methods<strong> </strong>leverage low-rank transformations of high-dimensional matrices enabling the efficient adaptation of LLMs by introducing a small number of new parameters that interact with the original model weights. Low-Rank Decomposition and LoRA are popular examples of reparameterized fine-tuning.</p><p>For this work, we will be fine-tuning a quantized LLaMA 3 8B model using a efficient reparameterized fine-tuning method called Low-Rank Adaptation (LoRA).</p><h4>Low-Rank Adaptation (LoRA)</h4><p>Low-Rank Adaptation, proposed in <a href="https://arxiv.org/pdf/2106.09685">LORA: LOW-RANK ADAPTATION OF LARGE LANGUAGE MODELS</a>,  is one of the popular PEFT methods used in adapting LLMs. LoRA is based on the concept of intrinsic dimensionality and draws on the findings from two key studies: <a href="https://arxiv.org/pdf/1804.08838">MEASURING THE INTRINSIC DIMENSION OF OBJECTIVE LANDSCAPES</a> and <a href="https://arxiv.org/pdf/2012.13255">INTRINSIC DIMENSIONALITY EXPLAINS THE EFFECTIVENESS OF LANGUAGE MODEL FINE-TUNING</a>.&#8221; These studies demonstrated that over-parameterized pre-trained models possess very low intrinsic dimensions, i.e., the minimum number of parameters needed to achieve optimal performance is significantly lower than the total parameter count of the models.</p><blockquote><p><em>&#8220;We take inspiration from Li et al. (2018a); Aghajanyan et al. (2020) which show that the learned over-parametrized models in fact reside on a low intrinsic dimension. <br>- </em><a href="https://arxiv.org/pdf/2106.09685">LORA: LOW-RANK ADAPTATION OF LARGE LANGUAGE MODELS</a></p></blockquote><p>LoRA allows efficient finetuning of large over-parameterized models like LLMs by focusing on the low intrinsic dimensionality. It works by decomposing the weight update matrices into two low-rank matrices, which drastically reduces the number of parameters that needs to be trained during model fine-tuning. Hence, also decreasing the amount of compute required in adapting the model, while maintaining the model performance.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!00Aa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!00Aa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 424w, https://substackcdn.com/image/fetch/$s_!00Aa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 848w, https://substackcdn.com/image/fetch/$s_!00Aa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 1272w, https://substackcdn.com/image/fetch/$s_!00Aa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!00Aa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png" width="252" height="292.9386281588448" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:644,&quot;width&quot;:554,&quot;resizeWidth&quot;:252,&quot;bytes&quot;:67698,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!00Aa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 424w, https://substackcdn.com/image/fetch/$s_!00Aa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 848w, https://substackcdn.com/image/fetch/$s_!00Aa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 1272w, https://substackcdn.com/image/fetch/$s_!00Aa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a9c342f-786e-4bc9-82d8-eb693fa9956d_554x644.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2106.09685">LORA: LOW-RANK ADAPTATION OF LARGE LANGUAGE MODELS</a></figcaption></figure></div><p><strong>Full fine-tuning v/s LoRA.</strong> During full fine-tuning of LLMs, the weight changes &#916;W is computed and applied directly to the pretrained weights. </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;W := W + &#916;W&quot;,&quot;id&quot;:&quot;IQZYUJPRNZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>In case of LoRA, the weight update matrices is decomposed into two low-rank matrices, A and B. Thus, the weight update can be generalized as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;W := W + BA, \n\\;where \\; B&#8712;R^{d&#215;r},A&#8712;R^{r&#215;k}, \\; and \\; r&#8810;min(d,k)&quot;,&quot;id&quot;:&quot;PVEUCUIKKE&quot;}" data-component-name="LatexBlockToDOM"></div><p> This decomposition drastically reduces the number of parameters that need to be updated. </p><p>Let&#8217;s consider LLaMA 3 8B model for example. The model has ~8 billion parameters, i.e. <em>n &#8776; 8 &#215; 10^9 parameters. </em>For simplicity, we will assume we have a single weight matrix with ~<em>8 &#215; 10^9 parameters </em>that needs to be updated. </p><p>During a full fine-tuning:</p><ul><li><p>We would update all 8 billion parameters.</p></li><li><p>The weight change matrix, <em>&#916;W, would</em> also be an 8 billion parameter matrix.</p></li><li><p>Both <em>W</em> and <em>&#916;W </em>are<em> </em>8&nbsp;billion parameters.</p></li></ul><p>Since, LoRA decomposes the weight change into two low-rank matrices, A and B.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;B&#8712;R^{d&#215;r}, \\;A&#8712;R^{r&#215;k}, \\; and \\; r&#8810;min(d,k)&quot;,&quot;id&quot;:&quot;OCPJRELSCE&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where d is the number of rows and k is the number of columns in the original matrix; and r is the rank of the decomposition, which is much smaller than the original <em>8 &#215; 10^9</em>. The weight update is approximated as: &#916;W &#8776; AB. The number of parameters in A and B combined (d&#215;r + r&#215;k) is much smaller than the original 8 &#215; 10^9 parameters.</p><ul><li><p>Say, the dimensions of the original matrix is d = 80,000 and k = 100,000, for the full fine-tuning, the number of trainable parameters is: d &#215; k = 80,000 &#215; 100,000 = 8,000,000,000 (8 billion).</p></li><li><p>In case of LoRA with r=16, the number of trainable parameters is: 80,000*16+16*100,000 = 2,880,000.</p></li></ul><p>Thus, the number of trainable parameters is reduced drastically using LoRA, which offers memory and compute efficiency during fine-tuning. However, it's important to note that in practice, the percentage reduction would differ from our simplified example given the real models have multiple weight matrices distributed across different layers of the large models instead of just one.</p><p>In addition to reducing the number of trainable parameters, LoRA has added advantages including:</p><ul><li><p>A pre-trained model can be frozen and shared across smaller LoRA modules and efficiently switched for different tasks. This reduces the storage requirement and overhead with respect to switching tasks significantly.</p></li><li><p>Since, LoRA only optimizes the low-rank decomposition matrices, the memory requirement is much lower and training is more efficient.</p></li><li><p>LoRA does not add any inference latency since the trainable matrices can be merged with the frozen pretrained weights.</p></li><li><p>LoRA finetuning can be combined with other PEFT methods like prefix tuning.</p></li></ul><h4>Quantized Low-Rank Adaptation (QLoRA)</h4><p>Quantized Low-Rank Adaptation, introduced in <a href="https://arxiv.org/pdf/2305.14314">QLORA: Efficient Finetuning of Quantized LLMs</a>, is a variant of LoRA which further reduces the memory used during model fine-tuning. Pretrained model weights are stored in 32-bit precision, which consumes significant memory. While LoRA reduces the memory requirement in comparison to full fine-tuning, it does not suffice for training very large models on consumer devices.  QLoRA addresses this by first quantizing a pretrained model to 4-bit precision and then training LoRA on top of this. </p><blockquote><p><em>&#8220;QLORA reduces the average memory requirements of finetuning a 65B parameter model from &gt;780GB of GPU memory to &lt;48GB without degrading the runtime or predictive performance compared to a 16- bit fully finetuned baseline.</em></p><p><em>- <a href="https://arxiv.org/pdf/2305.14314">QLORA: Efficient Finetuning of Quantized LLMs</a></em></p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-8LK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-8LK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 424w, https://substackcdn.com/image/fetch/$s_!-8LK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 848w, https://substackcdn.com/image/fetch/$s_!-8LK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 1272w, https://substackcdn.com/image/fetch/$s_!-8LK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-8LK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png" width="1456" height="734" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:734,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:231193,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-8LK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 424w, https://substackcdn.com/image/fetch/$s_!-8LK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 848w, https://substackcdn.com/image/fetch/$s_!-8LK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 1272w, https://substackcdn.com/image/fetch/$s_!-8LK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86629e53-54de-44e9-ba98-78d20b1b3b86_1948x982.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2305.14314">QLORA: Efficient Finetuning of Quantized LLMs</a></figcaption></figure></div><p>QLoRA offers reduced memory usage without sacrificing performance and it achieves this through three key techniques: <strong>4-bit NormalFloat Quantization, Double Quantization, and Paged Optimizers.</strong></p><blockquote><p><em>&#8220;QLORA introduces a number of innovations to save memory without sacrificing performance: (a) 4-bit NormalFloat (NF4), a new data type that is information theoretically optimal for normally distributed weights (b) Double Quantization to reduce the average memory footprint by quantizing the quantization constants, and (c) Paged Optimizers to manage memory spikes. </em></p><p><em>- <a href="https://arxiv.org/pdf/2305.14314">QLORA: Efficient Finetuning of Quantized LLMs</a></em></p></blockquote><p><em>More on model quantization on the upcoming series &#8220;TinyBits&#8221;, where I will explore tiny models, and discuss the latest techniques and research focused on optimizing smaller models for performance and efficiency!</em></p><p>In the following sections, we will present our experiments and findings from LoRA fine-tuning of the LLaMA 3 8B model for Hindi and Nepali, two South Asian languages written using Devanagari script. Our previous analysis of the LLaMA 3 tokenizer revealed improved tokenization for these languages compared to the LLaMA 2 variant.  However, we also observed that the tokenization quality still lags significantly behind that of English. For more details on this tokenization analysis refer to the post below.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;eeb50cf1-5f26-49ff-9e25-635f64ef0776&quot;,&quot;caption&quot;:&quot;Meta AI launched LLaMA 3 earlier on Thursday: LLaMA-8B and 70B models. While I can't wait to conduct a comprehensive study of the model's multilingual abilities, in this introductory blog post, I will briefly discuss how it differs from LLaMA 2. Much of the information shared here is already available as part of the model's release notes. However, this&#8230;&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;md&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Exploring multilingual aspects and vocabulary of LLaMA 3 compared to LLaMA 2&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:104468357,&quot;name&quot;:&quot;Shreeya Dhakal&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ccf9e7e-b918-482e-b8ed-800ad52e084e_1176x982.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-04-22T05:04:38.990Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://www.icodeformybhasa.com/p/exploring-multilingual-aspects-and&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:143725873,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:1,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;#icodeformy&#2349;&#2366;&#2359;&#2366;&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4d92160-5f82-40ca-8233-b069f42bbba6_1080x1080.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><h3>Experiment: QLoRA Fine-tuning LLaMA 3 8B Model</h3><p>The next set of experiments is to assess the baseline capabilities of LLaMA 3  for Hindi and Nepali and evaluate the effectiveness of QLoRA fine-tuning for these languages.  We have strategically chosen these two languages to explore the model's capabilities in non-Latin scripts, representing different resource scenarios:</p><ul><li><p>Hindi: A high-resource language with a significant amount of digital content.</p></li><li><p>Nepali: A comparatively low-resource language with limited digital content.</p></li></ul><p>We used <a href="https://github.com/unslothai/unsloth">usloth library</a> for our experiments, because it offers a straight-forward way of fine-tuning LLMs along with enhanced speed during fine-tuning. Additionally, the availability of pre-quantized models makes unsloth an attractive choice for our experiments.</p><h4>Experimental Setup</h4><p><strong>Dataset. </strong>We utilized Hindi and Nepali translations of the <a href="https://github.com/tatsu-lab/stanford_alpaca">Alpaca Dataset</a>, a popular instruction-tuning dataset released as a part of the Stanford Alpaca Project, which aims to build an instruction-following LLaMA model. We split this dataset into train and test sets and fine-tune the models using the train split.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-b57!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-b57!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 424w, https://substackcdn.com/image/fetch/$s_!-b57!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 848w, https://substackcdn.com/image/fetch/$s_!-b57!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 1272w, https://substackcdn.com/image/fetch/$s_!-b57!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-b57!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png" width="1456" height="317" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:317,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:161840,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-b57!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 424w, https://substackcdn.com/image/fetch/$s_!-b57!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 848w, https://substackcdn.com/image/fetch/$s_!-b57!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 1272w, https://substackcdn.com/image/fetch/$s_!-b57!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81ce5e2d-90b9-4595-8f4f-e831b22ff75b_1966x428.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Samples from Alpaca Dataset translated to Nepali</figcaption></figure></div><p><strong>QLoRA Setup. </strong>All the experiments and results in this post uses the following configuration for QLoRA finetuning:</p><pre><code>model = FastLanguageModel.get_peft_model(
    model,
    r = 16, 
    target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
                      "gate_proj", "up_proj", "down_proj",],
    lora_alpha = 16,
    lora_dropout = 0, 
    bias = "none",
    use_gradient_checkpointing = "unsloth", 
    random_state = 3407,
    use_rslora = False, 
    loftq_config = None,
)</code></pre><p><strong>Metrics and Evaluation Criteria.</strong> We calculated rougeL and BLEURT scores with respect to the ground truth responses. In addition, we used ChatGPT as a judge to grade the responses for each of the following criteria. We manually reviewed the scores from different GPT versions and found that GPT-4-o is relatively more reliable in grading the responses, so the results that are posted/discussed below are from GPT-4-o. The responses will be graded on a 10-point scale, with 1 being the lowest and 5 being the highest score.</p><ul><li><p><strong>Relevance to instruction: </strong>How relevant is the response generated by LLaMA 3 to the instruction and input to the model.</p></li><li><p><strong>Clarity and coherence: </strong>How clear and coherent is the response generated by LLaMA 3.</p></li><li><p><strong>Syntax and grammar: </strong>How correct is the syntax and grammar of the generated response.</p></li><li><p><strong>Completeness: </strong>How complete is the response.</p></li></ul><p>Since in our early analysis we observed several instances of hallucinations, we also asked GPT to identify if any hallucination exists in the response.</p><ul><li><p><strong>Hallucination Type: </strong>Identify if the model response has any type of hallucination: factual inaccuracies, nonsensical responses, contradictions, repetitions or others.</p></li></ul><h4>Results</h4><p>Overall, the baseline LLaMA 3 4-bit model showed a poor ability at generating both Nepali and Hindi, with low scores across all metrics and criterias. Surprisingly, the performance in Hindi (high-resource and one of the eight languages supported by LLaMA 3) was sometimes worse than Nepali (low-resource). This suggests that the challenges in adapting to non-English languages extend beyond resource availability. </p><blockquote><p><em>&#8220;Llama 3 supports 8 languages &#8212; English, German, French, Italian, Portuguese, Hindi, Spanish, and Thai, although the underlying foundation model has been trained on a broader collection of languages.</em></p><p><em>- <a href="https://scontent-sea1-1.xx.fbcdn.net/v/t39.2365-6/453304228_1160109801904614_7143520450792086005_n.pdf?_nc_cat=108&amp;ccb=1-7&amp;_nc_sid=3c67a6&amp;_nc_ohc=HbUYp0un48IQ7kNvgEZ74Dq&amp;_nc_ht=scontent-sea1-1.xx&amp;oh=00_AYCjzpR8D31rp8pyDB6TEjXpysFaKb9944AZBQ4fetflgQ&amp;oe=66DDE0C7">The Llama 3 Herd of Models</a></em></p></blockquote><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/LccDR/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa7652d2-acc4-490e-997e-9f299d37875c_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:468,&quot;title&quot;:&quot;Table 1:  Results for Baseline LLaMA 3 and Fine-tuned QLoRA Model for Nepali and Hindi&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/LccDR/1/" width="730" height="468" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>QLoRA fine-tuning for both Hindi and Nepali significantly improved performance across all metrics and criteria. Score distributions for the fine-tuned model (orange) shifted towards higher values for all the four criteria: <em>syntax, completeness, clarity and coherence, and relevance.</em> </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PcOW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PcOW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 424w, https://substackcdn.com/image/fetch/$s_!PcOW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 848w, https://substackcdn.com/image/fetch/$s_!PcOW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!PcOW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PcOW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:415501,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PcOW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 424w, https://substackcdn.com/image/fetch/$s_!PcOW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 848w, https://substackcdn.com/image/fetch/$s_!PcOW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!PcOW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00ba8bf4-adf6-4772-8b3c-bbd615b593c8_2240x1260.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Score distributions for the fine-tuned QLoRA (orange) v/s Baseline LLaMA (blue) on <em>relevance, clarity and coherence, syntax and completeness </em>of generation for Nepali.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1u7X!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1u7X!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 424w, https://substackcdn.com/image/fetch/$s_!1u7X!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 848w, https://substackcdn.com/image/fetch/$s_!1u7X!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!1u7X!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1u7X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:431902,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1u7X!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 424w, https://substackcdn.com/image/fetch/$s_!1u7X!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 848w, https://substackcdn.com/image/fetch/$s_!1u7X!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!1u7X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c52cfb6-8bef-48de-a9c6-9ad1b18bbf38_2240x1260.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Score distribution for fine-tune QLoRA (orange) v/s Baseline (blue) on relevance, clarity and coherence, syntax and completeness of generation for Hindi.</figcaption></figure></div><p>Additionally, there is also significant reduction in nonsensical hallucinations, contradictions and repetitions for the fine-tuned model for Nepali. This shows that fine-tuning likely helped the model better understand Nepali texts and related linguistics nuances, which may not have been well-captured in the original pre-trained model. However, there is an increase in factual hallucinations post fine-tuning, which could be because the model overfit on specific factual details during the fine-tuning. </p><p>The fine-tuned model Hindi also shows less nonsensical and repeated responses than the baseline model. Note, that we don&#8217;t observe an increase in factual hallucination for Hindi, which we observed in Nepali but we see an increase in contradictions. Since, we used the translated version of Alpaca Dataset for respective model fine-tuning, it could mean that the translated dataset to Nepali and Hindi might contain more ambiguities or inconsistencies, which are then propagated during fine-tuning, causing factual hallucination, in case of Nepali and contradictions in case of Hindi to increase. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IrUQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IrUQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 424w, https://substackcdn.com/image/fetch/$s_!IrUQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 848w, https://substackcdn.com/image/fetch/$s_!IrUQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 1272w, https://substackcdn.com/image/fetch/$s_!IrUQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IrUQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png" width="1456" height="826" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:826,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:116042,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IrUQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 424w, https://substackcdn.com/image/fetch/$s_!IrUQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 848w, https://substackcdn.com/image/fetch/$s_!IrUQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 1272w, https://substackcdn.com/image/fetch/$s_!IrUQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f3803f2-b2a9-492f-9ef4-5e844723f33c_1456x826.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Distribution of <em>hallucination type</em> for the fine-tune LoRA (orange) v/s Baseline LLaMA (blue) for Nepali</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tGqc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tGqc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 424w, https://substackcdn.com/image/fetch/$s_!tGqc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 848w, https://substackcdn.com/image/fetch/$s_!tGqc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 1272w, https://substackcdn.com/image/fetch/$s_!tGqc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tGqc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png" width="1456" height="841" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:841,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:119521,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tGqc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 424w, https://substackcdn.com/image/fetch/$s_!tGqc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 848w, https://substackcdn.com/image/fetch/$s_!tGqc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 1272w, https://substackcdn.com/image/fetch/$s_!tGqc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf468dd6-ce72-49d5-b93d-3c3f99672daf_1478x854.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Distribution of <em>hallucination type </em>for fine-tune LoRA (orange) v/s Baseline LLaMA (blue) model for Hindi</figcaption></figure></div><h4>Limitations and Future Work</h4><p>While we observed significant performance gain for both Hindi and Nepali text generation using QLoRA finetuning, there are several limitations and scope for future work. The quality of fine-tuning dataset greatly improves the quality of generation. Since we are using a translated dataset, the errors during translation may be amplified during LoRA finetuning. A human curated, high quality and diverse dataset, for both fine-tuning and evaluation, should be a consideration for future work. In the quick sets of experimentation in this work, we used GPT as a judge to score responses, having a human grade the outcome of the models would be helpful in providing better insights into the model's performance. Additionally, different techniques to regularize the fine-tuning process, such as incorporating adversarial training and controlled generation could help mitigate factual hallucinations and contradictions.</p><h4>Acknowledgements</h4><p>On this blog, I collaborated with <a href="https://www.linkedin.com/in/astroshilpa/">Shilpa Bhandari</a>, who helped me with preliminary analysis of baseline results and finetuning/analysis of Hindi results. </p><p>Shilpa graduated with a Bachelors in Mathematics and Bachelors in Computer Science from Youngstown State University, Ohio in 2021. She currently works as a data analyst reporting on schedule and financial data at a utility company. As the founder of the <a href="https://nepaleseintech.org">Nepalese in Tech</a> Discord community with 1000+ members, she is passionate about technical research involving the Nepalese language and the Nepalese community.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Aligning LLMs - Fine-Tuning LLaMA with SFT and RHLF ]]></title><description><![CDATA[Part 3: Understanding LLM alignment with Supervised Fine-Tuning and Reinforcement Learning from Human Feedback]]></description><link>https://www.icodeformybhasa.com/p/aligning-llms-fine-tuning-llama-with</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/aligning-llms-fine-tuning-llama-with</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Thu, 04 Jul 2024 05:15:36 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!kcjR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Large Language Models (LLMs) like LLaMA are pretrained with large amounts of unlabeled text with self-supervised training objectives like next token prediction. Pretraining LLMs with self-supervised objectives allows the model to learn rich representation in language and across different domain from the large volume of unlabeled text that is readily available. However, such pretrained models might not be optimized for specific downstream tasks, domains or desired behaviors and this is where aligning large pretrained language models come into play. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kcjR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kcjR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 424w, https://substackcdn.com/image/fetch/$s_!kcjR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 848w, https://substackcdn.com/image/fetch/$s_!kcjR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 1272w, https://substackcdn.com/image/fetch/$s_!kcjR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kcjR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png" width="1456" height="816" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:816,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1701921,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kcjR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 424w, https://substackcdn.com/image/fetch/$s_!kcjR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 848w, https://substackcdn.com/image/fetch/$s_!kcjR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 1272w, https://substackcdn.com/image/fetch/$s_!kcjR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92d90e86-893e-4931-8b37-ff33eb6c93b1_1456x816.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Generated using Midjourney</figcaption></figure></div><p>This is the third post of the blog series on LLaMA family of models. In <a href="https://www.icodeformybhasa.com/p/exploring-multilingual-aspects-and">part one</a>, we briefly compared LLaMA 2 and LLaMA 3. We additionally discussed the improvements in LLaMA 3, particularly focusing on the improved tokenizer along with increased focus on multi-lingual ability of the third iteration of the model. </p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;a4e07a0e-fde6-4b45-8ad0-dd380d5e9853&quot;,&quot;caption&quot;:&quot;Meta AI launched LLaMA 3 earlier on Thursday: LLaMA-8B and 70B models. While I can't wait to conduct a comprehensive study of the model's multilingual abilities, in this introductory blog post, I will briefly discuss how it differs from LLaMA 2. Much of the information shared here is already available as part of the model's release notes. However, this&#8230;&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;md&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Exploring multilingual aspects and vocabulary of LLaMA 3 compared to LLaMA 2&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:104468357,&quot;name&quot;:&quot;Shreeya Dhakal&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ccf9e7e-b918-482e-b8ed-800ad52e084e_1176x982.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-04-22T05:04:38.990Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://www.icodeformybhasa.com/p/exploring-multilingual-aspects-and&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:143725873,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:1,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;#icodeformy&#2349;&#2366;&#2359;&#2366;&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4d92160-5f82-40ca-8233-b069f42bbba6_1080x1080.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://www.icodeformybhasa.com/p/the-llama-family-of-models-model">Part two</a> of the series discusses the architecture of the LLaMA family of models along with the modifications that are made on top of the original transformer model and the techniques employed for efficient pretraining of the LLaMA models.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;b40752c9-aeff-47ad-9b38-1bd3cc028725&quot;,&quot;caption&quot;:&quot;Since February 2023, Meta has open-sourced three versions of their LLaMA language model. This has enabled thousands of people in the AI and NLP communities to explore and build upon the LLaMA models for their use-cases. On April 18, 2024, Meta open-sourced&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;md&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;The LLaMA Family of Models, Model Architecture, Size, and Scaling Laws &quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:104468357,&quot;name&quot;:&quot;Shreeya Dhakal&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ccf9e7e-b918-482e-b8ed-800ad52e084e_1176x982.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-05-05T21:19:08.993Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://www.icodeformybhasa.com/p/the-llama-family-of-models-model&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:143924377,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:1,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;#icodeformy&#2349;&#2366;&#2359;&#2366;&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4d92160-5f82-40ca-8233-b069f42bbba6_1080x1080.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>In this post, we will be focusing on methods used in aligning LLMs to specific tasks and desired behaviors. We will also walk through fine-tuning details, including Supervised Fine-Tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF) discussed in the <a href="https://arxiv.org/pdf/2307.09288">LLaMA 2 paper</a>. Additionally, we will discuss the LLM safety approaches employed by LLaMA 2 model during the fine-tuning process. Fine-tuning details for LLaMA 3 is out of scope for this post, as the paper for the model is not out yet.</p><h2>RECAP: Large Language Models</h2><p>Large language models (LLMs) are deep neural network models that are trained on a large corpora of text to understand and generate natural language. Transformer, introduced in the 2017 paper <a href="https://arxiv.org/pdf/1706.03762">&#8220;Attention Is All You Need&#8221;</a> is now the most widely adopted architecture for language modeling. The following resources will give a comprehensive understanding of language modeling and transformer based language models. This makes an important foundation for the rest of the blog.</p><ul><li><p><a href="https://wandb.ai/madhana/Language-Models/reports/Language-Modeling-A-Beginner-s-Guide---VmlldzozMzk3NjI3">Language Modeling: A Beginner's Guide</a></p></li><li><p><a href="https://jalammar.github.io/illustrated-transformer/">The Illustrated Transformer</a></p></li><li><p><a href="https://magazine.sebastianraschka.com/p/understanding-large-language-models">Understanding Large Language Models</a></p></li><li><p><a href="https://www.linkedin.com/pulse/transformer-architectures-dummies-part-2-decoder-only-qi6vc/">Transformer Architectures for Dummies - Part 2 (Decoder Only Architectures)</a></p></li></ul><h2>Customizing and Aligning LLMs</h2><p>Training LLMs<strong> </strong>involves multiple stages. First, pretraining the models on a large unlabeled corpus using self-supervised techniques like next token/sentence prediction and/or masked language model. Pretraining helps models learn rich representations about language and acquire general knowledge across multiple domains without relying on explicit annotations. However, pretraining LLMs is computationally expensive and unattainable to many individuals and organizations. These pretrained LLMs, at many times, also need to be adapted for specialized goals and use-cases.</p><blockquote><p><em>&#8220;According to AI Index estimates, the training costs of state-of-the-art AI models have reached unprecedented levels. For example, OpenAI&#8217;s GPT-4 used an estimated $78 million worth of compute to train, while Google&#8217;s Gemini Ultra cost $191 million for compute.</em></p><p>- <em><a href="https://aiindex.stanford.edu/wp-content/uploads/2024/04/HAI_2024_AI-Index-Report.pdf">Artificial Intelligence Index Report 2024 </a>by HAI Stanford</em></p></blockquote><p>After the initial pretraining, LLMs are fine-tuned, or sometimes further pretrained to customize them for specific tasks, domains, or goals. In addition to adapting the LLMs to specific tasks and domains, fine-tuning allows models to align with desired behaviors and safety considerations. This is achieved through techniques like Supervised Fine-Tuning (SFT) and/or Reinforcement Learning from Human Feedback (RLHF), which are computationally cheaper in comparison to pretraining but time-consuming given these processes typically require high-quality and human curated datasets. </p><p>A three-step alignment process described in the <a href="https://arxiv.org/pdf/2203.02155">InstructGPT paper</a>, is a widely adopted method to train language models to exhibit desired behaviors. The first step supervised fine-tuning (SFT) involves teaching the model to follow instructions. Step two and three involve learning from human feedback what a desired behavior is and optimizing the model to produce outputs to align with the desired behaviors. <em>Note</em> that only steps 1 and 3 involve modifying model parameters, in the second step the data to train the reward model is created and the reward model that helps score the responses during RLFH fine-tuning is trained.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WrYT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WrYT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 424w, https://substackcdn.com/image/fetch/$s_!WrYT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 848w, https://substackcdn.com/image/fetch/$s_!WrYT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 1272w, https://substackcdn.com/image/fetch/$s_!WrYT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WrYT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png" width="1422" height="982" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:982,&quot;width&quot;:1422,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:275919,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WrYT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 424w, https://substackcdn.com/image/fetch/$s_!WrYT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 848w, https://substackcdn.com/image/fetch/$s_!WrYT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 1272w, https://substackcdn.com/image/fetch/$s_!WrYT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15c8da-151e-4cdd-b8d1-515c67cf547e_1422x982.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Three-step model alignment process from <a href="https://arxiv.org/pdf/2203.02155">InstructGPT paper</a>.</figcaption></figure></div><p>LLaMA 2 chat was aligned towards dialog-style instructions using the three-step process. It was aligned for helpfulness, i.e &#8220;<em>how well Llama 2-Chat responses fulfill users&#8217; requests and provide requested information,&#8221; </em>and safety, which refers to &#8220;<em>whether Llama 2-Chat&#8217;s responses are unsafe.&#8221; </em>The LLaMA 3 release note leaves out the fine-tuning details but speculating based on the information in the note, it seems to follow the similar process as LLaMA 2 chat.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MR2K!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MR2K!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 424w, https://substackcdn.com/image/fetch/$s_!MR2K!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 848w, https://substackcdn.com/image/fetch/$s_!MR2K!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 1272w, https://substackcdn.com/image/fetch/$s_!MR2K!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MR2K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png" width="1456" height="659" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:659,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:401493,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MR2K!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 424w, https://substackcdn.com/image/fetch/$s_!MR2K!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 848w, https://substackcdn.com/image/fetch/$s_!MR2K!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 1272w, https://substackcdn.com/image/fetch/$s_!MR2K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b0f2c0-c4b2-4d06-b5dc-fffab46d5bc0_2508x1136.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">LLaMA 2 Chat Fine-tuning from <a href="https://arxiv.org/pdf/2307.09288">LLaMA 2 Paper</a></figcaption></figure></div><h4>Supervised Fine-Tuning</h4><p>Supervised Fine-Tuning (SFT) is a technique for adapting general pretrained LLMs to a specific downstream task, domain, or application. It involves further training a pretrained model using a smaller and labeled dataset with a next-token prediction objective, similar to the original pretraining. Since, SFT uses a high quality curated dataset to update the model&#8217;s parameters for a specialized task/application, it is called &#8220;supervised fine-tuning.&#8221; </p><blockquote><p><em>&#8220;Quality Is All You Need. </em></p><p><em>&#8220;We found that SFT annotations in the order of tens of thousands was enough to achieve a high-quality result.</em></p><p><em>- <a href="https://arxiv.org/pdf/2307.09288">LLaMA 2 Paper</a></em></p></blockquote><p>For the LLaMA 2 chat model, the authors initially conducted SFT with <a href="https://arxiv.org/pdf/2210.11416">publicly available instruction tuning data</a>. However, they discovered that despite its large size, this dataset lacked diversity and quality, which are needed to produce quality results. After analyzing the results from this initial SFT phase, they decided to fine-tune the model using a smaller but high-quality dataset. Their findings show that using a small and curated high-quality dataset<em><strong> </strong></em>is enough to produce high-quality results. They also highlight that "<strong>the output from</strong> <strong>the fine-tuned model were often competitive with SFT data handwritten by human annotators</strong>, which is why they stopped annotating data for SFT at 27K and decided to <strong>devote more annotation effort to preference-based annotation for RLHF.</strong> Similarly in the LLaMA 3 release note the share a similar observation where the biggest gains in model quality came from the quality of data.</p><blockquote><p><em>&#8220;Some of our biggest improvements in model quality came from carefully curating this data and performing multiple rounds of quality assurance on annotations provided by human annotators.</em></p><p><em>- <a href="https://ai.meta.com/blog/meta-llama-3/">LLaMA 3 Release Note</a></em></p></blockquote><p>LLaMA 2 chat model was fine-tuned for two epochs. During this fine-tuning process, each sample was constructed by concatenating a prompt and its corresponding response, separated by a special token. The model was then trained using the next sentence prediction objective and the loss on prompt tokens were not considered during back propagation.</p><h4>Reinforcement Learning from Human Feedback (RLHF)</h4><p>The next two steps in the three-step process for model alignment focuses on training the model to select optimal response. A prompt can have multiple responses, give this the goal is to teach the model to distinguish between the responses and choose the best response. The curated data used in SFT training only tells the model what a plausible response looks like, it does not teach the model which of the responses is the best one. This limitation in SFT is addressed by reinforcement learning from human feedback (RLHF), where a model is fine-tuned directly on human feedback on the model&#8217;s responses.</p><p>The two steps in RLHF includes:</p><ol><li><p>Train a reward model, which is used to score responses. </p></li><li><p>Optimize the pretrained or supervised fine-tuned LLM to generate responses that receive high scores from the reward model.</p></li></ol><h4>Reward Model (RM)</h4><p>For a (prompt, reward) pair, a reward model outputs a score based on the alignment objective. In LLaMA 2, there were two reward models, one for assigning helpfulness score and other for safety score. Sometimes a single reward model can be trained for multiple alignment objectives if the objectives are compatible. The decision to use a single or multiple reward objectives depends on the alignment goals and if those goals can be meaningfully combined together. Also, additional factors like compute and end-user requirements may also play a role in the decision-making.  </p><p><strong>Data collection. </strong>The overall data curation process would involve annotators writing the prompts based on the alignment objective, like <em>helpfulness </em>and the LLM would generate multiple responses to the prompt. These responses are then reviewed by the annotators and are scored or a preferred response is marked, depending upon the requirement. While training the model to assign a score in itself is not a challenging task, the process of curating a dataset for each objective with consistent scores among the human annotators is difficult. For this reason, some approaches exclude the scoring the response, instead the annotators are asked to choose the best response among the choices. The preferred response or score for the response is decided based on how close the response is to the alignment objective. </p><p>The human preference data curated for LLaMA 2 consisted of pairwise comparisons. Each instance of the comparison data included a prompt, a preferred response, and a rejected response. The annotators also rated the degree of preference using a four-point scale: significantly better, better, slightly better, or negligibly better. The data was collected in batches and RLHF models were fine-tuned iteratively. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-svY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-svY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 424w, https://substackcdn.com/image/fetch/$s_!-svY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 848w, https://substackcdn.com/image/fetch/$s_!-svY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 1272w, https://substackcdn.com/image/fetch/$s_!-svY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-svY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png" width="1456" height="734" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:734,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:271645,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-svY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 424w, https://substackcdn.com/image/fetch/$s_!-svY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 848w, https://substackcdn.com/image/fetch/$s_!-svY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 1272w, https://substackcdn.com/image/fetch/$s_!-svY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf231c2b-5e29-48a8-a781-97e9653cfa77_1586x800.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">From <a href="https://arxiv.org/pdf/2307.09288">LLaMA 2 Paper</a></figcaption></figure></div><p><strong>Reward model training. </strong>The reward model is trained on the human preference dataset to output a preference score, which basically indicates the quality of the model&#8217;s output on specific alignment objectives. To achieve this model&#8217;s classification layer used in the next token prediction is replaced by a regression layer and the model is optimized using a loss function. This loss function is designed such that it incentivizes the model to assign higher scores to preferred responses and lower scores to non-preferred ones. </p><p>In the LLaMA 2, two reward models were trained, one for helpfulness and another for safety. Each model was initialized from pre-trained chat model checkpoints and was trained by first converting the pairwise preference dataset into binary label ranking format, where each pair consisted of a "chosen" (preferred) and a "rejected" (less preferred) response. Then the reward model was trained using binary ranking loss function, which penalizes the model when it assigns higher score to a rejected response. This effectively teaches the model to favor the preferred response over the rejected one. The binary ranking loss function follows form:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;L_{ranking} = -\\log(\\sigma(r_\\theta(x, y_c) - r_\\theta(x, y_r)))&quot;,&quot;id&quot;:&quot;UJOTHRJWFZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Since the pairwise preference data collected for reward modeling in LLaMA 2 was also annotated on a four-level preference scale, a margin component, <em>m(r),</em> was added to to the binary ranking loss to help the reward model to assign more distinct scores with larger gaps for generation that have bigger differences.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;L_{ranking} = -\\log(\\sigma(r_\\theta(x, y_c) - r_\\theta(x, y_r) - m(r)))&quot;,&quot;id&quot;:&quot;NDREKGCWEZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>In addition to the pairwise preference data that was curated for LLaMA 2, the authors also used open source preference data for reward model training because they did not observe any negative transfer from using the public dataset in the performance of the reward model. The authors also claimed that incorporating open source data could allow better generalization and mitigate the risk of reward hacking, which would occur when the LLaMA Chat model exploits the weaknesses of the reward functions and artificially inflate the score without actually improving the model performance.</p><blockquote><p>&#8220;However, in our experiments, we do not observe negative transfer from the open-source preference datasets. Thus, we have decided to keep them in our data mixture, as they could enable better generalization for the reward model and prevent reward hacking, i.e. Llama 2-Chat taking advantage of some weaknesses of our reward, and so artificially inflating the score despite performing less well.</p><p>- <em><a href="https://arxiv.org/pdf/2307.09288">LLaMA 2 Paper</a></em></p></blockquote><p>The reward models were trained for one epoch over the training data with the same optimizer parameters as for the base model.</p><h4>Iterative RLHF fine-tuning</h4><p>During RLHF, given a prompt, the model generates a response that is scored by the Reward Model (RM) trained in step 2 of the three-step model alignment process. As the model is fine-tuned to maximize these scores, it can diverge from its original behavior due to factors such as overfitting to reward signals, exposure bias, limited training data, or inaccurate scoring by the RM. This divergence could potentially compromise the broad knowledge base originally acquired during the pretraining phase. Therefore, it is crucial to ensure that the model trained during RLHF does not perform worse than or deviate from its original behavior.</p><p><strong><a href="https://openai.com/index/openai-baselines-ppo/">Proximal Policy Optimization (PPO).</a> </strong>is a standard RL algorithm that helps constraint the model such that the model fine-tuned in this stage does not deviate too much from the original behavior. One of the ways PPO ensures that the model does not deviate too far, a KL divergence penalty is added to the objective.</p><p>Here are some papers that are helpful in understanding the PPO algorithm:</p><ol><li><p><a href="https://arxiv.org/pdf/1602.01783">Asynchronous Methods for Deep Reinforcement Learning</a></p></li><li><p><a href="https://arxiv.org/pdf/1707.06347">Proximal Policy Optimization Algorithms</a></p></li><li><p><a href="https://arxiv.org/pdf/1909.08593">Fine-Tuning Language Models from Human Preferences</a></p></li><li><p><a href="https://arxiv.org/pdf/2009.01325">Learning to summarize from human feedback</a></p></li></ol><p>In addition to PPO, in LLaMA 2 the authors also explored <a href="https://arxiv.org/pdf/2204.05862">rejection sampling</a> for RLHF. </p><p><strong>Rejection sampling </strong>involves generating multiple candidate responses for each prompt and selecting the one with the highest reward score for the gradient update. In LLaMA 2, rejection sampling was done with the 70B LLaMA 2 Chat model. All the smaller models were fine-tuned on rejection sampled data from 70B LLaMA 2 Chat model, effectively distilling the capabilities of the larger model into the smaller ones. The authors trained 5 successive versions for RLHF models, RLHF-V1 to RLHF-V5. In LLaMA 2, instead of fine-tuning the model solely on the best candidate response from the previous iteration, the authors included the best candidate from the current iteration along with top-performing samples from all prior iterations. This choice was made to address regression that they observed in experiments where they sampled the best candidate from the preceding iteration only.</p><p>Also until RLHF-V4, only rejection sampling was used for fine-tuning. Subsequently, they applied PPO on top of rejection rampling to refine the model checkpoint obtained from rejection sampling before proceeding with further sampling. </p><p>The objective being optimized is to maximize the expected reward with respect to the policy &#960; as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\arg \\max_{\\pi} \\mathbb{E}_{p \\sim D, g \\sim \\pi} [R(g \\mid p)]\n&quot;,&quot;id&quot;:&quot;QAKWABRFUR&quot;}" data-component-name="LatexBlockToDOM"></div><p>The reward function used during PPO is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;R(g \\mid p) = \\tilde{R}_c(g \\mid p) - \\beta D_{KL}(\\pi_\\theta(g \\mid p) \\parallel \\pi_0(g \\mid p))\n&quot;,&quot;id&quot;:&quot;KTKWHWPEDU&quot;}" data-component-name="LatexBlockToDOM"></div><p>Note that the second term in the final objective contains a KL divergence penalty that helps constrain the model such that it does not diverge from the original policy <em>&#960;_0. </em>Also,<em> Rc</em> is a piecewise combination of the safety (Rs) and helpfulness <em>(Rh)</em> reward models. </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;R_c(g \\mid p) = \\begin{cases}\nRs(g \\mid p) &amp; \\text{if } \\text{is_safety}(p) \\text{ or } Rs(g \\mid p) < 0.15 \\\\\nRh(g \\mid p) &amp; \\text{otherwise}\n\\end{cases}&quot;,&quot;id&quot;:&quot;KTNTAZAILQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>For prompts that are tagged as potentially eliciting unsafe responses, <em>Rc</em> prioritizes scores from the safety model. If the safety score for response to a prompt is either explicitly marked as unsafe or scores below a threshold of 0.15, <em>Rc</em> favors the score from the safety reward model over the helpfulness one.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\widetilde{R}_c(g \\mid p) = \\text{whiten}(\\text{logit}(R_c(g \\mid p)))&quot;,&quot;id&quot;:&quot;FQBRZKWVZQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>All the RLHF models were fine-tuned between 200 and 400 iterations and early stopping was applied based on the evaluations on held-out prompts.</p><h4>Safety fine-tuning in LLaMA 2</h4><p>Safety was one of the two primary alignment objectives in LLaMA 2. The safety fine-tuning process used is similar to the general fine-tuning methods with additional efforts to ensure that the models avoid displaying any unsafe behaviors. To address this, adversarial prompts and safe demonstrations were included in the SFT and RLHF processes. The RLHF pipeline was also refined with context distillation by prefixing a prompt with a safety instruction, such as &#8220;You are a safe and responsible assistant,&#8221; and then fine-tuning the model on the safer responses without the safety instruction. Additionally, the annotation team was guided to create adversarial prompts along two dimensions: risk categories and attack vectors.</p><blockquote><p>&#8220;we design instructions for our annotation team to create adversarial prompts along two dimensions: a risk category, or potential topic about which the LLM could produce unsafe content; and an attack vector, or question style to cover different varieties of prompts that could elicit bad model behaviors.</p><p><em>- <a href="https://arxiv.org/pdf/2307.09288">LLaMA 2 Paper</a></em></p></blockquote><p>They identified three risk categories: <em>illicit and criminal, hateful and harmful activities, and unqualified advice. </em>Several attack vectors were explored including <em>psychological manipulation</em>, <em>logic manipulation, syntactic manipulation, semantic manipulation, perspective manipulation, and non-English languages, </em>among others. This comprehensive approach to data curation and RLHF fine-tuning of the model was done to systematically identify unsafe behaviors and train the model for safety and reliability. </p><h4>Conclusion</h4><p>Aligning LLMs is important for adapting pre-trained LLMs to specific tasks and desired behaviors. While the standard three-step model alignment process may seem straightforward, it is an involved process that requires a comprehensive fine-tuning dataset, rigorous evaluation processes and multiple training iterations to ensure that the model's performance aligns with intended goals. Additionally, the concept of desired behaviors in LLMs seems to be evolving with increased emphasis on safety.</p><p>In the next post in this series, we will work on a Low Rank Adaptation (LoRA) fine-tuning of the LLaMA 3 model for Nepali and Hindi. We'll examine the model's multilingual capabilities and assess its performance on low-resource languages like Nepali. So stay tuned!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Large Language Models - A Curated Reading List]]></title><description><![CDATA[While I am working on the blog series on the LLaMA family of models, I have also put together a curated reading list of papers that chart the evolution of large language models.]]></description><link>https://www.icodeformybhasa.com/p/large-language-models-a-curated-reading</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/large-language-models-a-curated-reading</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sun, 16 Jun 2024 02:31:17 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/009e2e4d-e3bd-44a3-9cbe-2b8496cac5cf_2500x1500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>While I am working on the blog series on the LLaMA family of models, I have also put together a curated reading list of papers that chart the evolution of large language models. These papers provide crucial context for understanding the foundations of large language models and landscape of LLMs that are the backbone of systems like meta.ai, ChatGPT, and Claude, among others.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;4b436455-f9ee-4d05-ba5d-2d92c53f5d30&quot;,&quot;caption&quot;:&quot;Since February 2023, Meta has open-sourced three versions of their LLaMA language model. This has enabled thousands of people in the AI and NLP communities to explore and build upon the LLaMA models for their use-cases. On April 18, 2024, Meta open-sourced&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;The LLaMA Family of Models, Model Architecture, Size, and Scaling Laws &quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:104468357,&quot;name&quot;:&quot;Shreeya Dhakal&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ccf9e7e-b918-482e-b8ed-800ad52e084e_1176x982.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-05-05T21:19:08.993Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://www.icodeformybhasa.com/p/the-llama-family-of-models-model&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:143924377,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:1,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;#icodeformy&#2349;&#2366;&#2359;&#2366;&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4d92160-5f82-40ca-8233-b069f42bbba6_1080x1080.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>In this blog, my attempt is to create a comprehensive reading list, including some that are featured in my blog above. </p><h3>Key research papers on deep learning architectures</h3><ol><li><p><a href="https://arxiv.org/pdf/1409.3215v3">Sequence to Sequence Learning with Neural Networks.</a> Sutskever et al., 2014, Google</p></li><li><p><a href="https://arxiv.org/pdf/1706.03762">Attention is All You Need. </a>Vaswani et al., 2017, Google</p></li><li><p><a href="https://www.cs.ubc.ca/~amuham01/LING530/papers/radford2018improving.pdf">Improving Language Understanding by Generative Pre-Training.</a> Radford et al., 2018. OpenAI - GPT-1</p></li><li><p><a href="https://aclanthology.org/N19-1423.pdf">BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding.</a> Devlin et al., 2018. Google</p></li><li><p><a href="https://arxiv.org/pdf/1910.13461">BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension.</a> Lewis et al., 2019. Facebook</p></li><li><p><a href="https://d4mucfpksywv.cloudfront.net/better-language-models/language-models.pdf">Language Models are Unsupervised Multitask Learners</a>. Radford et al., 2019. OpenAI - GPT-2</p></li><li><p><a href="https://arxiv.org/pdf/1910.10683">Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. </a>Raffel et al., 2019. Google - T5</p></li><li><p><a href="https://arxiv.org/pdf/2005.14165">Language Models are Few-Shot Learners.</a> Brown et al., 2020. Open AI - GPT-3</p></li><li><p><a href="https://arxiv.org/abs/2002.04745">On Layer Normalization in the Transformer Architecture.</a> Xiong et al., 2020. </p></li></ol><p><em><strong>Survey Papers</strong></em></p><ol><li><p><a href="https://arxiv.org/abs/2303.18223">A Survey of Large Language Models.</a> Zhao et al., 2023. [<a href="https://github.com/RUCAIBox/LLMSurvey">Github</a>]</p></li><li><p><a href="https://arxiv.org/pdf/2404.04925">Multilingual Large Language Model: A Survey of Resources, Taxonomy and Frontiers.</a> Qin et al., 2024. </p></li><li><p><a href="https://arxiv.org/pdf/2402.06196">Large Language Models: A Survey. </a>Minaee et al., 2024</p></li></ol><h3>Efficient pre-training and scaling laws</h3><ol><li><p><a href="https://arxiv.org/pdf/2001.08361">Scaling Laws for Neural Language Models.</a> Kaplan et al., 2020. Open AI</p></li><li><p><a href="https://arxiv.org/pdf/2112.11446">Scaling Language Models: Methods, Analysis &amp; Insights from Training Gopher.</a> Rae et al., 2021. DeepMind</p></li><li><p><a href="https://arxiv.org/pdf/2203.15556">Training Compute-Optimal Large Language Models. </a>Hoffmann et al., 2022 DeepMind - Chinchilla</p></li><li><p><a href="https://arxiv.org/abs/2205.14135">FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness. </a>Dao et al., 2022. Stanford University</p></li><li><p><a href="https://arxiv.org/pdf/2204.02311">PaLM: Scaling Language Modeling with Pathways. </a>Chowdhery et al., 2022. Google</p></li><li><p><a href="https://arxiv.org/pdf/2212.14034">Cramming: Training a Language Model on a Single GPU in One Day.</a> Geiping et al., 2022. University of Maryland, College Park</p></li></ol><p><em><strong>Survey Papers</strong></em></p><ol><li><p><a href="https://arxiv.org/pdf/2009.06732">Efficient Transformers: A Survey. </a>Tay et al., 2020 (Revised 2022). Google</p></li><li><p><a href="https://arxiv.org/pdf/2302.01107">A Survey on Efficient Training of Transformers. </a>Zhuang et al., 2023</p></li></ol><h3>Fine-tuning and parameter-efficient transfer learning</h3><ol><li><p><a href="https://github.com/google-research/adapter-bert">Parameter-Efficient Transfer Learning for NLP.</a> Houlsby et al., 2019. Google [<a href="https://github.com/google-research/adapter-bert">Github</a>]</p></li><li><p><a href="https://arxiv.org/pdf/2109.01652">Finetuned Language Models are Zero-Shot Learners. </a>Wei et al., 2021. Google</p></li><li><p><a href="https://arxiv.org/pdf/2106.09685">LoRA: Low-Rank Adaptation of Large Language Models.</a> Hu et al., 2021. Microsoft [<a href="https://github.com/microsoft/LoRA">Github</a>] [<a href="https://www.youtube.com/watch?v=DhRoTONcyZE">Video</a>]</p></li><li><p><a href="https://arxiv.org/pdf/2305.14314">QLoRA: Efficient Finetuning of Quantized LLMs.</a> Dettmers et al., 2023. University of Washington [<a href="https://github.com/artidoro/qlora">Github</a>]</p></li></ol><p><em><strong>Survey Papers</strong></em></p><ol><li><p><a href="https://arxiv.org/pdf/2103.13630">A Survey of Quantization Methods for Efficient Neural Network Inference.</a> Gholami et al., 2021. UC Berkeley</p></li><li><p><a href="https://arxiv.org/pdf/2303.15647">Scaling Down to Scale Up: A Guide to Parameter-Efficient Fine-Tuning. </a>Lialin et al., 2022. UMass Lowell </p></li><li><p><a href="https://arxiv.org/pdf/2304.13712">Harnessing the Power of LLMs in Practice: A Survey on ChatGPT and Beyond. </a>Yang et al., 2023 [ <a href="https://github.com/Mooler0410/LLMsPracticalGuide">Github</a>]</p></li><li><p><a href="https://arxiv.org/abs/2312.00678">The Efficiency Spectrum of Large Language Models: An Algorithmic Survey.</a> Ding et al., 2024, Microsoft</p></li></ol><h3>Aligning LLMs</h3><ol><li><p><a href="https://arxiv.org/pdf/1706.03741">Deep Reinforcement Learning from Human Preferences.</a> Christiano et al., 2017 (Revised 2023). Google</p></li><li><p><a href="https://arxiv.org/pdf/1909.08593">Fine-Tuning Language Models from Human Preferences.</a> Ziegler et al., 2019 (Revised 2020)</p></li><li><p><a href="https://arxiv.org/abs/2203.02155">Training Language Models to Follow Instructions with Human Feedback. </a>Ouyang et al., 2022. OpenAI - InstructGPT</p></li><li><p><a href="https://arxiv.org/pdf/2204.05862">Training a helpful and harmless assistant with reinforcement learning from human feedback. </a>Bia et al., 2022. Anthropic</p></li><li><p><a href="https://arxiv.org/pdf/2209.07858">Red teaming language models to reduce harms: Methods, scaling behaviors, and lessons learned. </a>Ganguli et al., 2022. Anthropic</p></li><li><p><a href="https://arxiv.org/pdf/2212.08073">Constitutional AI: Harmlessness from AI Feedback.</a> Bia et al., 2022. Anthropic</p></li></ol><p><em><strong>Survey Papers</strong></em></p><ol><li><p><a href="https://arxiv.org/pdf/2307.12966">Aligning Large Language Models with Human: A Survey.</a> Wang et al., 2023. Huawei Noah&#8217;s Ark Lab</p></li><li><p><a href="https://arxiv.org/pdf/2309.15025">Large Language Model Alignment: A Survey.</a> Shen et al., 2023.  Tianjin University</p></li></ol><p><em>Note,</em> this is not an exhaustive reading list, and I will be updating it as I come across any new paper while I work on #icodeformy&#2349;&#2366;&#2359;&#2366;! There will be more of such reading lists in the future for different areas within natural language processing. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Whose Weights and Biases?]]></title><description><![CDATA[Who decides how AI thinks and behaves?]]></description><link>https://www.icodeformybhasa.com/p/whose-weights-and-biases</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/whose-weights-and-biases</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sun, 19 May 2024 16:37:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!533A!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On May 13, Open AI launched GPT-4o, their<a href="https://openai.com/index/hello-gpt-4o/"> new flagship model that can reason across audio, vision, and text in real time</a> and the next day on May 15 the scientists <a href="https://www.vox.com/future-perfect/2024/5/17/24158403/openai-resignations-ai-safety-ilya-sutskever-jan-leike-artificial-intelligence">leading superalignment team at OpenAI, Ilya Sutskever and Jan Leike, departed from the company.</a> While I am impressed by the future of human-tech interactions, I can&#8217;t help but wonder what influence Open AI and enterprises alike will have over the information the modern society consumes. The global information exchanged via news, social media and even books is heavily polarized, fragmenting our knowledge of the world into small disconnected and biased information silos. Much of AI at our disposal for use is trained with different versions of these data and shown to exhibit a similar societal biases present in the data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!533A!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!533A!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 424w, https://substackcdn.com/image/fetch/$s_!533A!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 848w, https://substackcdn.com/image/fetch/$s_!533A!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 1272w, https://substackcdn.com/image/fetch/$s_!533A!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!533A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png" width="578" height="594.4401197604791" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1374,&quot;width&quot;:1336,&quot;resizeWidth&quot;:578,&quot;bytes&quot;:1906203,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!533A!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 424w, https://substackcdn.com/image/fetch/$s_!533A!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 848w, https://substackcdn.com/image/fetch/$s_!533A!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 1272w, https://substackcdn.com/image/fetch/$s_!533A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ee8111e-3dd0-4765-b6e4-165bbc8f02ca_1336x1374.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Wordcloud generated using <em><a href="https://www.anthropic.com/news/collective-constitutional-ai-aligning-a-language-model-with-public-input">Collective Constitutional AI: Aligning a Language Model with Public Input</a></em></figcaption></figure></div><p>In this opinion piece, I will discuss the bias AI models encode and how it impacts society. I will also briefly talk about how firms like Open AI, Meta, Google and Anthropic are taking ethics and safety into considerations when training and deploying AI models. Drawing from the recent research and news, I will evaluate how the narrow lens of global tech might still fall short in developing AI for all. Finally, I will discuss AI regulations around the world and touch a little upon how the global south is behind in terms of making the best use of AI systems.</p><h3>What is bias?</h3><p>Bias, in the context of AI, means prejudices that influence AI decision-making, which leads to unfair outcomes that favors one group over another. These biases can stem from different sources: data used to train the AI, design of the algorithms and biases of the developers.</p><h4>It is everywhere!</h4><blockquote><p><em>&#8220;Bias occurs in many algorithms and AI systems &#8212; from <a href="https://time.com/5209144/google-search-engine-algorithm-bias-racism/">sexist and racist search results</a> to facial recognition systems that <a href="https://www.scientificamerican.com/article/police-facial-recognition-technology-cant-tell-black-people-apart/">perform worse on Black faces</a>.</em></p><p>- <em><a href="https://restofworld.org/2023/ai-image-stereotypes/">How AI reduces the world to stereotypes</a></em> <em>by <a href="https://restofworld.org/author/victoria-turk/">Victoria Turk</a></em></p></blockquote><p>Biases are not exclusive to AI models. Every form of information we consume has been filtered through the perceptions and interpretations of an individual or a group of individuals. From the books/articles we read to videos we consume, every piece of information carries the imprint of its source. Even the education system and institutions impart knowledge, influenced by cultural, societal, and historical contexts. The weights and biases shaping artificial intelligence reflect the predispositions of the humans involved in its development along with disparity in representation present in online data sources. This disparity could stem from unequal access to the internet, varying propensities to discuss topics openly or could simply be a selection bias among others.</p><p>Regardless of the source, AI biases cast an increasingly far-reaching impact as these models are now starting to penetrate crucial areas like education, healthcare, and the legal system. Now AI is no longer just shaping our perceptions of the world around us, it now directly influences decisions that change people&#8217;s lives. </p><h4>From societal representations to encoded beliefs</h4><blockquote><p><em>&#8220;The world according to Stable Diffusion is run by White male CEOs. Women are rarely doctors, lawyers or judges. Men with dark skin commit crimes, while women with dark skin flip burgers.</em></p><p><em>- <a href="https://www.bloomberg.com/graphics/2023-generative-ai-bias/">Humans Are Biased. Generative AI Is Even Worse</a> by By <a href="https://twitter.com/Leonardonclt">Leonardo Nicoletti</a> and <a href="https://twitter.com/dinabass">Dina Bass</a> for Bloomberg Technology + Equality</em></p></blockquote><p>Existing studies have shown that AI encodes human-like biases [<a href="https://purehost.bath.ac.uk/ws/portalfiles/portal/168480066/CaliskanEtAl_authors_full.pdf">1</a>,<a href="https://arxiv.org/pdf/2006.03955"> 2</a>,<a href="https://arxiv.org/pdf/1607.06520"> 3</a>,<a href="https://arxiv.org/pdf/2303.11408"> 4</a>]. A more<a href="https://www.bloomberg.com/graphics/2023-generative-ai-bias/"> recent study</a> by Bloomberg on Stable Diffusion, shows that AI models no longer just mirror societal representation, they are in fact distorted and show biases worse than what exists in the society. Currently, the data used to train AI is skewed towards the viewpoints of majority groups, often overshadowing marginalized communities. This perpetuates biased narratives that disadvantage vulnerable groups, reinforcing the inequalities and biases present in the society.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6fIV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6fIV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 424w, https://substackcdn.com/image/fetch/$s_!6fIV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 848w, https://substackcdn.com/image/fetch/$s_!6fIV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 1272w, https://substackcdn.com/image/fetch/$s_!6fIV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6fIV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png" width="1456" height="1065" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/decffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1065,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:253992,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6fIV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 424w, https://substackcdn.com/image/fetch/$s_!6fIV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 848w, https://substackcdn.com/image/fetch/$s_!6fIV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 1272w, https://substackcdn.com/image/fetch/$s_!6fIV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdecffc18-e851-47fa-a016-2f3e8dd182f2_1982x1450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <em> <a href="https://www.bloomberg.com/graphics/2023-generative-ai-bias/">Humans Are Biased. Generative AI Is Even Worse</a> </em></figcaption></figure></div><p>While there are structured processes to measure these biases, debiasing the AI models, especially those deployed to across different communities, is hard as the notion of right and wrong is itself fluid, and evolving over time - differently across cultures and regions.</p><blockquote><p><em>&#8220;the idea of correcting even prejudiced biases is also problematic. That is because societal understanding of prejudice is constantly evolving, along with our understanding of humanity and human rights, and also varies between cultures. It is therefore hard or impossible to specify algorithmically what is prejudiced.</em></p><p><em>- <a href="https://arxiv.org/pdf/1608.07187">Semantics derived automatically from language corpora contain human-like biases</a></em></p></blockquote><p>The nature of biases in our society and hence the data we have is complex and multifaceted. A holistic view and approach at eliminating biases from models trained on such data is hard and sometimes attempts at correcting these models, while only looking at the problem from a limited sight, can result in unintended encoding of biases from humans who create these models. The <a href="https://www.theverge.com/2024/2/21/24079371/google-ai-gemini-generative-inaccurate-historical">recent Gemini incident</a> is an example of impact such tunnel vision can have as Google's overcorrection resulted in the model generating inaccurate and problematic portrayal of the history of the world.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lkir!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lkir!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 424w, https://substackcdn.com/image/fetch/$s_!lkir!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 848w, https://substackcdn.com/image/fetch/$s_!lkir!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 1272w, https://substackcdn.com/image/fetch/$s_!lkir!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lkir!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png" width="414" height="455.27859237536654" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:750,&quot;width&quot;:682,&quot;resizeWidth&quot;:414,&quot;bytes&quot;:698274,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lkir!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 424w, https://substackcdn.com/image/fetch/$s_!lkir!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 848w, https://substackcdn.com/image/fetch/$s_!lkir!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 1272w, https://substackcdn.com/image/fetch/$s_!lkir!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c666a88-9934-480d-b1ea-a0532c06e651_682x750.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <em><a href="https://www.theverge.com/2024/2/21/24079371/google-ai-gemini-generative-inaccurate-historical">Google apologizes for &#8216;missing the mark&#8217; after Gemini generated racially diverse Nazis</a></em></figcaption></figure></div><h3>Who is regulating and what?</h3><p>It is an accepted consensus among developers, researchers and consumers of these models that there need to be guardrails in place to regulate biases in models. But, what should the regulations look like and who gets to decide those? The big names in the space, Open AI, Meta, Google, and Anthropic all have one recommendation when it comes to developing AI systems responsibly: engaging a diverse set of users throughout the development of these systems.</p><blockquote><p><em>&#8220;Through regular collaboration with subject matter experts, policy stakeholders and people with lived experiences, we&#8217;re continuously building and testing approaches to help ensure our machine learning (ML) systems are designed and used responsibly.</em></p><p><em>- <a href="https://ai.meta.com/responsible-ai/">Driven by our belief that AI should benefit everyone</a> by Meta</em></p></blockquote><blockquote><p><em>&#8220;We believe that many decisions about our defaults and hard bounds should be made collectively, and while practical implementation is a challenge, we aim to include as many perspectives as possible.</em></p><p>-<a href="https://openai.com/index/how-should-ai-systems-behave/"> </a><em><a href="https://openai.com/index/how-should-ai-systems-behave/">How should AI systems behave, and who should decide?</a></em> by Open AI</p></blockquote><blockquote><p><em>&#8220;Engage with a diverse set of users and use-case scenarios, and incorporate feedback before and throughout project development. This will build a rich variety of user perspectives into the project and increase the number of people who benefit from the technology.</em></p><p><em>- <a href="https://ai.google/responsibility/responsible-ai-practices/">Responsible AI practices</a> by Google</em></p></blockquote><p>Anthropic and the <a href="https://cip.org/">Collective Intelligence Project</a> recently conducted a public input process involving approximately <em><strong>1000 Americans to formulate a constitution for an AI system.</strong></em> Although this is a great initiative, it falls short of representing the global user base of systems like Claude, as emphasized by Anthropic. Much like how the American constitution may not be suitable for the rest of the world, an AI constitution derived from the input of 1000 Americans is unlikely to be universally applicable. In fact, it may not even be effective for a country as diverse as the United States.</p><blockquote><p><em>&#8220;The United States leads China, the EU, and the U.K. as the leading source of top AI models. In 2023, 61 notable AI models originated from U.S.-based institutions, far outpacing the European Union&#8217;s 21 and China&#8217;s 15.</em></p><p>- <em><a href="https://aiindex.stanford.edu/wp-content/uploads/2024/04/HAI_2024_AI-Index-Report.pdf">Artificial Intelligence Index Report 2024 </a>by HAI Stanford</em></p></blockquote><p>With just a few key players, mostly coming from developed regions like the US, China, and Europe, it is no surprise there is a narrow outlook in terms of how these models should behave, leaving out perspectives and considerations from other parts of the world when developing AI models.</p><h3>Global governance for global systems</h3><p>A <em><strong>survey</strong></em>* by Stanford researchers and Accenture found that 88% of over 1,000 global organizations believe the entities developing foundation models should be responsible for mitigating all associated risks, putting more responsibility on the model developers. However, in addition to this expectation that AI creators should be accountable in addressing biases in their AI models, 86% of respondents also recognized a need for global governance frameworks to address the broader risks involved with generative AI.</p><p><em><strong>Note: </strong>the full <strong>survey*</strong></em> <em>is not available yet but <a href="https://aiindex.stanford.edu/wp-content/uploads/2024/04/HAI_2024_AI-Index-Report.pdf">Artificial Intelligence Index Report 2024 </a>by HAI Stanford reports some of the findings from the survey.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!E3SW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!E3SW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 424w, https://substackcdn.com/image/fetch/$s_!E3SW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 848w, https://substackcdn.com/image/fetch/$s_!E3SW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 1272w, https://substackcdn.com/image/fetch/$s_!E3SW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!E3SW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png" width="1456" height="825" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:825,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:155300,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!E3SW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 424w, https://substackcdn.com/image/fetch/$s_!E3SW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 848w, https://substackcdn.com/image/fetch/$s_!E3SW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 1272w, https://substackcdn.com/image/fetch/$s_!E3SW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F222a898c-0766-4fcd-ad62-1019c83f9ddc_1726x978.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <em><a href="https://aiindex.stanford.edu/wp-content/uploads/2024/04/HAI_2024_AI-Index-Report.pdf">Artificial Intelligence Index Report 2024</a> by HAI Stanford</em></figcaption></figure></div><p>Given how the majority of the corporations leading the advancements in AI inclined towards the gated access of these models, it is natural that global consumers and organizations want greater accountability from the model developers and stricter governance frameworks to mitigate risks associated with these models. However, relying on the makers of AI too heavily to regulate the capabilities of these models would mean concentrating the power in the hands of a few monopolistic tech giants that have the resources to develop these sophisticated AI models.</p><blockquote><p>&#8220;<em>Until 2014, most significant machine learning models were released by academia. Since then, industry has taken over. In 2022, there were 32 significant industry-produced machine learning models compared to just three produced by academia.</em></p><p>- <em><a href="https://aiindex.stanford.edu/wp-content/uploads/2024/04/HAI_2024_AI-Index-Report.pdf">Artificial Intelligence Index Report 2024 </a>by HAI Stanford</em></p></blockquote><p>Today the majority of AI development effort is led by the industry, most of which are proprietary models. Much of what goes into development of these models, starting with data, pretraining and post-training practices are not known to the public. While all these companies have talked about their intention of building responsible AI, their prioritization does not seem to align with this intention and the newer iterations of models still display similar biases and harmful contents as their predecessors.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!q9t0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q9t0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 424w, https://substackcdn.com/image/fetch/$s_!q9t0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 848w, https://substackcdn.com/image/fetch/$s_!q9t0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 1272w, https://substackcdn.com/image/fetch/$s_!q9t0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q9t0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png" width="1456" height="1029" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1029,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1248038,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!q9t0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 424w, https://substackcdn.com/image/fetch/$s_!q9t0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 848w, https://substackcdn.com/image/fetch/$s_!q9t0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 1272w, https://substackcdn.com/image/fetch/$s_!q9t0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F934f5bd4-3431-499c-b73e-37226efb8cbc_1610x1138.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://arxiv.org/pdf/2307.15043v2">Universal and Transferable Adversarial Attacks on Aligned Language Models</a></figcaption></figure></div><blockquote><p><em>&#8220;Safety and security teams are being <a href="https://www.theinformation.com/articles/musks-x-cuts-half-of-election-integrity-team-after-promising-to-expand-it">downsized</a> or <a href="https://www.theregister.com/2023/02/13/in_brief_ai/">sidelined</a> to bring AI products to market.</em></p><p>- <em><a href="https://www.justsecurity.org/89432/the-tragedy-of-ai-governance/">The Tragedy of AI Governance</a> by <a href="https://www.justsecurity.org/author/chestermansimon/">Simon Chesterman</a></em></p></blockquote><p>In the fierce race to release the next best model, ethical considerations in AI development often take a back seat. Safety and security teams are often viewed as<a href="https://www.washingtonpost.com/technology/2023/03/30/tech-companies-cut-ai-ethics/"> cost centers</a>, compliance burdens even. Hence, it is important to have multi-party stakeholders making decisions on the values and principles that should guide how AI systems should be built and how they should behave.</p><h4>AI regulations around the world</h4><blockquote><p><em>&#8220;Countries and governments tend to align national priorities with their approaches to AI regulation. As a result, the flavor of ethical AI policies issued by current leaders in AI regulation - namely, the U.S., EU, and China - are very different.</em></p><p><em>- <a href="https://igarape.org.br/en/responsible-and-safe-ai-a-primer-for-policymakers-in-the-global-south/">Responsible and Safe AI: A Primer for Policymakers in the Global South</a> by Igarap&#233; Institute</em></p></blockquote><p>In the recent year we have seen a growth in the number of AI regulations and recommendations from nations, economic blocs, experts and non-profits organization. However, these policies and guidelines are shaped by the respective priorities and value systems of each nation or region, resulting in distinct approaches to AI regulation. This, I believe, works well, as localized AI policy can provide a more nuanced approach and regulations that comply with different culture, values, and economic goals of the country. One concern with localized AI policy is that this can lead to fragmentation in the regulatory landscape. Additionally, <em><a href="https://igarape.org.br/wp-content/uploads/2024/01/Global-Futures-Bulletin-Responsible-Artificial-Intelligence-Efforts-In-the-Global-South.pdf">"developing world faces several disadvantages that make it more difficult for countries to formulate and enforce responsible AI policies."</a></em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4e1P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4e1P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 424w, https://substackcdn.com/image/fetch/$s_!4e1P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 848w, https://substackcdn.com/image/fetch/$s_!4e1P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 1272w, https://substackcdn.com/image/fetch/$s_!4e1P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4e1P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png" width="510" height="666.1057692307693" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1630,&quot;width&quot;:1248,&quot;resizeWidth&quot;:510,&quot;bytes&quot;:625379,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4e1P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 424w, https://substackcdn.com/image/fetch/$s_!4e1P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 848w, https://substackcdn.com/image/fetch/$s_!4e1P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 1272w, https://substackcdn.com/image/fetch/$s_!4e1P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8b6c5ef-b765-4113-983e-376b657a03ac_1248x1630.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <em><a href="https://www.mindfoundry.ai/blog/ai-regulations-around-the-world">AI Regulations around the World</a></em></figcaption></figure></div><p>The efforts to develop policies around AI regulation is still in its early stages, and how that global AI governance will look remains an open question. While the US leads AI model development, a significant legislative action was only taken last October with the<a href="https://www.whitehouse.gov/briefing-room/statements-releases/2023/10/30/fact-sheet-president-biden-issues-executive-order-on-safe-secure-and-trustworthy-artificial-intelligence/"> Biden administration signing an executive order on AI</a>. In fact, <a href="https://carnegieendowment.org/research/2024/02/tracing-the-roots-of-chinas-ai-regulations?lang=en">China was the first country</a> to issue enforceable interim regulations governing applications of AI. Meanwhile, with the approval of the <a href="https://artificialintelligenceact.eu/the-act/">European Union AI act</a>, the EU has taken the lead in establishing a comprehensive regulatory framework for AI, which aims to regulate AI by categorizing potential risk and applying the appropriate regulations. It was first proposed in April 2021 and approved in March 2024. These are all remarkable feats in their own rights but all the major AI policy efforts are driven by developed nations, and developing nations, especially those in the global south, are and will be behind as they don't have the necessary resources, expertise, and structure to develop localized AI regulations. This disparity in AI governance capabilities could widen the digital divide and hinder the equitable distribution of benefits of AI.</p><h4>AI policy guidelines must be adaptable</h4><blockquote><p><em>&#8220;the dominant policy prescriptions to encourage explainable AI are often rooted in Western perspectives.</em></p><p>- <em><a href="https://carnegieendowment.org/research/2024/04/a-global-south-perspective-on-explainable-ai?lang=en">A Global South Perspective on Explainable AI</a> by Jake Okechukwu Effoduh</em></p></blockquote><p>Personally, I am in favor of localized AI policy but not all nations and regions can afford to work an AI policy from scratch so we need international frameworks that establish core principles, while allowing for adaptation to address specific needs of each country. As with most of AI, even the policies and guidelines with respect to AI safety, fairness and explainability are based on the narratives from the global north. Hence, the international frameworks must be a multi-stakeholder effort involving leaders, researchers, and representatives from diverse nations and communities around the globe. These frameworks should be grounded in research and an international understanding of what constitutes human well-being, fundamental rights, and equitable treatment across all races, genders, ages, abilities, and socioeconomic backgrounds.</p><p>Establishing universal standards and regulations for ethical AI governance is challenging given the disparities in technological access, cultural nuances, and economic conditions around the globe. However, it is important that we have international standards to make sure that AI systems are deployed responsibly even in nations that are not wealthy enough to devise their own policies and regulations surrounding AI.</p><h4>Ethical alignment and benchmarking of models should begin early</h4><p>With any innovation, the laws and policies governing them tend to follow only after a few concerning incidents have occurred and highlighted the need for regulation. As we develop AI systems at a speed and scale never seen before, we need a more proactive approach to tackling concerns in AI. Ensuring AI systems align with global values and goals requires collaboration from diverse stakeholders and careful ethical considerations, including (but not limited to) protecting users' privacy, mitigating biases, and ensuring safety and transparency throughout the lifecycle of the AI systems. Along with a clear alignment goal, proactive distilling of data, algorithms and and active red-teaming with experts from diverse domains and backgrounds must be in place to ensure that AI is adhering to the global ethical alignment.</p><blockquote><p><em>&#8220;development of mature AI safety benchmarks that are both effective and trusted is not possible without the involvement of the community.</em></p><p>- <a href="https://research.google/blog/supporting-benchmarks-for-ai-safety-with-mlcommons/">Supporting benchmarks for AI safety with MLCommons</a>, by Google</p></blockquote><p>To fully leverage the benefits of AI systems we need effective and comprehensive AI safety benchmarks to rigorously test these systems before it is released for general access. The existing benchmarks (Eg. <a href="https://crfm.stanford.edu/helm/classic/latest/">HELM</a>, <a href="https://github.com/google/BIG-bench">Big-Bench</a>) focus on smaller subsets of issues with respect to fairness and safety, mostly limited to English and are not comprehensive. Development of comprehensive benchmarks that are inclusive require active and collaborative efforts from researchers, experts, developers and communities around the globe. As AI systems evolve rapidly in a "build-fast-break-fast" cycle, continuous testing and multiple iterations of the model is essential.</p><h3>Conclusion</h3><p>AI models not only exhibit human-like biases, studies have shown that they in fact amplify the biases that exist in our society. The data used to train these models is representative of the majority viewpoint and added with the implicit/explicit bias from the developers in selecting the data and processes to train the models, they continue to over-represent the dominant narratives. The proprietary nature of AI models makes understanding the sources of biases impossible and often leaves most of the world behind, especially, the already marginalized communities. In addition, the huge cost of training these models means the ability to train large AI systems is concentrated among a few players, making it challenging to ethically align these models to values and goals of the larger population. A collaboration from diverse stakeholders from around the globe is important in setting clear alignment goals before the development of AI. This collective approach helps ensure that AI is aligned for the people and their well-being, and it is not limited to profits and earnings for the corporations developing it.</p><p>In addition, the existing AI regulations are mainly developed from the perspective of the global north and the developing nations, especially those in the global south don&#8217;t have the resources or expertise to invest in research and development of AI policies. We need international AI regulation frameworks that can be adapted to the needs of developing nations with little effort. The responsibility of making AI responsible lies in all of us: industry leaders, researchers, experts, policy makers and the users of the system. A collective effort is needed to develop AI safety benchmarks and hold developers of these models accountable. In addition, establishing universal standards for ethical AI that can be adapted to the local community to ensure transparent and safe development of these models is critical.</p><div><hr></div><h3>Acknowledgements</h3><p><a href="https://www.linkedin.com/in/gwendolyngillingham/">Gwendolyn Gillingham</a> Thank you for your feedback and help with editing this blog.<br><a href="https://www.linkedin.com/feed/#">Rishabh Bhardwaj</a> and <a href="https://www.linkedin.com/feed/#">Kshitiz Karki</a> Thank you for pointing me to the reading materials.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The LLaMA Family of Models, Model Architecture, Size, and Scaling Laws ]]></title><description><![CDATA[Part 2: A look into the Meta's LLaMA family of models before we deep-dive into each components from multi-lingual lens]]></description><link>https://www.icodeformybhasa.com/p/the-llama-family-of-models-model</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/the-llama-family-of-models-model</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sun, 05 May 2024 21:19:08 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Ioe6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Since February 2023, Meta has open-sourced three versions of their <a href="https://llama.meta.com/">LLaMA language model</a>. This has enabled thousands of people in the AI and NLP communities to explore and build upon the LLaMA models for their use-cases.</p><p>On April 18, 2024, Meta open-sourced <a href="https://ai.meta.com/blog/meta-llama-3/">LLaMA 3</a>, which they claim is "<strong>the most capable openly available large language model to date,"</strong> backed by its performance across multiple benchmarks. In my <a href="https://www.icodeformybhasa.com/p/exploring-multilingual-aspects-and">pervious post</a>, we briefly talked about and compared LLaMA 2 and LLaMA 3. In the blog, we also touched upon the focus on the multilingual ability in the latest release. Additionally, we discussed the expanded vocab and improved tokenizer in LLaMA 3.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ioe6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ioe6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Ioe6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Ioe6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Ioe6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ioe6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg" width="530" height="530" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1280,&quot;width&quot;:1280,&quot;resizeWidth&quot;:530,&quot;bytes&quot;:283841,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ioe6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Ioe6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Ioe6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Ioe6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff79826e3-d938-417a-8e68-b7a3ed3e7bff_1280x1280.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image generated using Meta AI</figcaption></figure></div><p>In this post, we will discuss the architecture of the LLaMA family of models and focus on the modifications that are made on top of the original transformer model. In addition, we will also discuss how the second and third iterations of the model differ from LLaMA 1. <em>Note: since LLaMA 3 paper is not out yet, the comparison will be limited to what was released as a part of the model&#8217;s <a href="https://ai.meta.com/blog/meta-llama-3/">release note</a>.</em></p><p>Fine-tuning methodology and LLM safety employed by LLaMA 2 and LLaMA 3 are out of scope of this blog post. </p><h3>Large Language Models</h3><p>Large language models (LLMs) are deep neural network models that are trained on large corpora of text to understand and generate natural language. Transformer, introduced in the 2017 paper <a href="https://arxiv.org/pdf/1706.03762">&#8220;Attention Is All You Need&#8221;</a> is now the most widely adopted architecture for language modeling. The following resources will give a comprehensive understanding of language modeling and transformer based language models. This makes an important foundation for the rest of the blog.</p><ul><li><p><a href="https://wandb.ai/madhana/Language-Models/reports/Language-Modeling-A-Beginner-s-Guide---VmlldzozMzk3NjI3">Language Modeling: A Beginner's Guide</a></p></li><li><p><a href="https://jalammar.github.io/illustrated-transformer/">The Illustrated Transformer</a></p></li><li><p><a href="https://magazine.sebastianraschka.com/p/understanding-large-language-models">Understanding Large Language Models</a></p></li><li><p><a href="https://www.linkedin.com/pulse/transformer-architectures-dummies-part-2-decoder-only-qi6vc/">Transformer Architectures for Dummies - Part 2 (Decoder Only Architectures)</a></p></li></ul><p>Now, lets look into the LLaMA family of models.</p><h3>Model Architecture</h3><p>The LLaMA family of models are <strong>auto-regressive decoder-only models</strong>. These models are based on the transformer architecture with some modifications. We will start by looking into the LLaMA 1 architecture and discuss the differences it has in comparison to the transformer model. Then, we will build up from there up to LLaMA 2 and LLaMA 3 models, comparing how the newer iterations of the model improves on the previous ones. </p><h4>LLaMA 1 </h4><p>LLaMA 1 works by predicting the next token given a sequence of input tokens, similar to any other transformer-based decoder-only models. However, LLaMA 1 incorporates several architectural modifications that set it apart, including pre-normalization of input with <a href="https://arxiv.org/pdf/1910.07467">RMSNorm</a>, use of SwiGLU activation function and <a href="https://arxiv.org/pdf/2104.09864">rotary positional embedding (RoPE)</a>. </p><h4>Pre-normalization of Input</h4><p>LLaMA 1 and the subsequent iterations of the model use pre-normalization to enhance model training stability and performance. Normalization is applied to the input of each sub-layer, unlike the original transformer model where the normalization is applied after each sub-layer. </p><p>Pre-normalization in deep models like LLaMA is motivated by its ability to facilitate more efficient gradient flow during the backpropagation process by allowing error gradient to flow directly from top to bottom layers without passing through the normalization operations. The residual connection acts as a bypass, mitigating the risk of vanishing or exploding gradients in deep networks.</p><p>In <a href="https://arxiv.org/pdf/1906.01787">Learning Deep Transformer Models for Machine Translation</a>, the authors find that pre-normalization allows more efficient training of deeper Transformer models.</p><blockquote><p><em>&#8220;More specifically, we find that prenorm is more efficient for training than post-norm if the model goes deeper.</em></p><p>- <em><a href="https://arxiv.org/pdf/1906.01787">Learning Deep Transformer Models for Machine Translation</a></em></p></blockquote><p>LLaMA also uses <a href="https://arxiv.org/pdf/1910.07467">RMSNorm (Root Mean Square Normalization)</a> as the normalization function instead of the <a href="https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html">LayerNorm</a>. In deep neural networks, changing parameters in one layer can cause shifts in the input distributions for subsequent layers. These internal distribution shifts is also known as <a href="https://arxiv.org/pdf/1502.03167">internal covariate shift</a> and can make it more challenging for models, especially those with a large number of layers, to learn and converge. LayerNorm stabilizes the training of deep neural network by addressing internal covariate shift but introduces additional overhead, which becomes substantial for deeper networks. LayerNorm has two key properties:</p><ul><li><p> <strong>re-centering invariance,</strong> which makes the model insensitive to shift noises in inputs and weights, and,</p></li><li><p><strong>re-scaling invariance,</strong> which preserves output representations when inputs and weights are randomly scaled.</p></li></ul><p>Authors in <a href="https://arxiv.org/pdf/1910.07467">Root Mean Square Layer Normalization</a> show that <strong>re-centering</strong> <strong>has little impact on stabilizing model training and re-scaling alone gives similar or more effective results</strong> when training deeper neural networks.</p><blockquote><p><em>&#8220;Although RMSNorm does not re-center the summed inputs as in LayerNorm, we demonstrate through experiments that this property is not fundamental to the success of LayerNorm, and that RMSNorm is similarly or more effective.</em></p><p><em>- <a href="https://arxiv.org/pdf/1910.07467">Root Mean Square Layer Normalization</a></em> </p></blockquote><p>Additional reading materials for normalizations in deep neural networks:</p><ul><li><p><a href="https://arxiv.org/pdf/1502.03167">Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift</a></p></li><li><p><a href="https://arxiv.org/pdf/1607.06450">Layer Normalization</a></p></li><li><p><a href="https://aclanthology.org/2019.iwslt-1.17.pdf">Transformers without Tears: Improving the Normalization of Self-Attention</a></p></li><li><p><a href="https://www.linkedin.com/pulse/demystifying-normalization-deep-learning-easy-code-shrishrimal/">Demystifying Normalization in Deep Learning - Easy Visualizations and PyTorch Code</a> </p></li></ul><h4>SwiGLU Activation</h4><p>Inspired by <a href="https://arxiv.org/pdf/2204.02311">PaLM: Scaling Language Modeling with Pathways</a>, LLaMA uses SwiGLU (Sigmoid-Weighted Linear Unit) activation. </p><blockquote><p><em>&#8220;SwiGLU Activation &#8211; We use SwiGLU activations (Swish(xW )&#183; xV ) for the MLP intermediate activations because they have been shown to significantly increase quality compared to standard ReLU, GeLU, or Swish activations (Shazeer, 2020) - Section 2</em></p><p>- <a href="https://arxiv.org/pdf/2204.02311">PaLM: Scaling Language Modeling with Pathways</a></p></blockquote><p>SwiGLU combines Swish and GLU (Gated Linear Unit) activations. GLU is a component-wise product of two linear transformations on input, where one is sigmoid-gated:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;GLU(x) = x*\\sigma(Wx+b)\n\n\n&quot;,&quot;id&quot;:&quot;QZPUWIDUIV&quot;}" data-component-name="LatexBlockToDOM"></div><p>The Swish activation function, introduced in the paper <a href="https://arxiv.org/pdf/1710.05941v1">SWISH: A SELF-GATED ACTIVATION FUNCTION</a>,  is a smooth, non-monotonic activation that has been shown to outperform or match the widely-used ReLU activation across various of deep learning models. It defined by:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;Swish(x) = x.\\sigma(\\beta x)&quot;,&quot;id&quot;:&quot;BDVBVFIGKQ&quot;}" data-component-name="LatexBlockToDOM"></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5RcO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5RcO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 424w, https://substackcdn.com/image/fetch/$s_!5RcO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 848w, https://substackcdn.com/image/fetch/$s_!5RcO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 1272w, https://substackcdn.com/image/fetch/$s_!5RcO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5RcO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png" width="488" height="220.171875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:462,&quot;width&quot;:1024,&quot;resizeWidth&quot;:488,&quot;bytes&quot;:44009,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5RcO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 424w, https://substackcdn.com/image/fetch/$s_!5RcO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 848w, https://substackcdn.com/image/fetch/$s_!5RcO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 1272w, https://substackcdn.com/image/fetch/$s_!5RcO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ced8d4-38de-431c-9c32-fb9775809722_1024x462.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Swish Activation Function; Image from <a href="https://arxiv.org/pdf/1710.05941v1">SWISH: A SELF-GATED ACTIVATION FUNCTION</a></figcaption></figure></div><p>SwiGLU introduced in <a href="https://arxiv.org/pdf/2002.05202">GLU Variants Improve Transformer</a> is defined by:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;SwiGLU(x) = x\\sigma(\\beta x) + (1-\\sigma(\\beta*x))*(Wx +b)&quot;,&quot;id&quot;:&quot;WJFIDLHCEH&quot;}" data-component-name="LatexBlockToDOM"></div><p><em>where, W, b, and &#946; is a trainable parameter.</em></p><p>In the paper,  <a href="https://arxiv.org/pdf/2002.05202">GLU Variants Improve Transformer</a> the author experimented with different variations of GLU and showed that variants of GLU (including SwiGLU) shows improvements in quality compared to ReLU or GELU activations. </p><blockquote><p><em>&#8220;We test these variants in the feed-forward sublayers of the Transformer [Vaswani et al., 2017] sequence-to-sequence model, and find that some of them yield quality improvements over the typically-used ReLU or GELU activations. - Abstract</em></p><p><em>&#8220;We offer no explanation as to why these architectures seem to work; we attribute their success, as all else, to divine benevolence. - Conclusion</em></p><p>- <a href="https://arxiv.org/pdf/2002.05202">GLU Variants Improve Transformer</a> </p></blockquote><p>Evaluating the performance impact of one activation function over another is a challenging task. It is difficult to study activation functions in isolation and pinpoint the exact reasons why one function outperforms another. Several variables can influence the training process, making it hard to draw definitive conclusions. However, certain properties of the SwiGLU activation function may offer insights into its potential advantages. SwiGLU is a smoother function in comparison which could allow better optimization and convergence, while its non-monotonic nature enables capturing complex non-linear relationships. Additionally, SwiGLU uses a gating mechanism that selectively activates neurons based on the received input, reducing overfitting and improving generalization.</p><blockquote><p><em>&#8220;Our experiments show that Swish consistently outperforms or matches the ReLU function on a variety of deep models. While it is difficult to prove why one activation function outperforms another because of the many confounding factors that affect training, we believe that the properties of Swish being unbounded above, bounded below, non-monotonic, and smooth are all advantageous. - Section 2.1</em></p><p>- <a href="https://arxiv.org/pdf/1710.05941v1">SWISH: A SELF-GATED ACTIVATION FUNCTION</a></p></blockquote><h4><strong>Rotary Positional Embeddings (RoPE)</strong></h4><p>Positional embedding help transformers to distinguish between the same word at different positions in a sequence. The LLaMA family of models uses RoPE instead of absolute positional embeddings. Absolute positional embeddings adds the position information by adding position vector to token embeddings and it does not take into account how one position in the sequence relates to another. </p><p>In contrast, Rotary Positional Embedding (RoPE), introduced in <a href="https://arxiv.org/pdf/2104.09864">ROFORMER: ENHANCED TRANSFORMER WITH ROTARY</a>, applies rotations to word vectors based on where it occurs in the sequence. Instead of directly adding positional embeddings to word vectors, RoPE rotates the word vectors by an angle proportional to their position. Specifically, if &#952; is the degree by which a word vector is rotated, a word occurring at position m is rotated by m &#215; &#952;. This rotation preserves the advantage of absolute positional embeddings by maintaining a unique representation for words at each position. Additionally, RoPE gains the benefit of relative positional embeddings, as two word vectors are rotated by the same amount as long as the distance between the two words remains constant.</p><p>Since RoPE maintains a contextual relationship between two tokens, it is able to capture long range dependencies enabling improved performance and faster convergence in tasks involving long texts/documents.</p><blockquote><p><em>&#8220;Notably, RoPE enables valuable properties, including the flexibility of sequence length, decaying inter-token dependency with increasing relative distances, and the capability of equipping the linear self-attention with relative position encoding. - abstract</em></p><p>- <a href="https://arxiv.org/pdf/2104.09864">ROFORMER: ENHANCED TRANSFORMER WITH ROTARY</a></p></blockquote><h4>LLaMA 2 and LLaMA 3:</h4><p>The LLaMA family of models share majority of its architecture. Following are how the three iterations of the model differ from one another:</p><ul><li><p>The context length of LLaMA 1 is 2K tokens, that of LLaMA 2 is 4K and the latest LLaMA 3 has 8K context.</p></li><li><p>LLaMA 2 and LLaMA 3 adopts Group Attention Query (GQA). LLaMA 2 only uses GQA in its larger parameter models, while LLaMA 3 uses it on all versions.</p></li></ul><h4>Grouped Attention Query (GQA) in LLaMA 2 and LLaMA 3</h4><p>Traditional Multi-Headed Attention (MHA) used by the Transformers have a high memory overhead as all attention keys and values need to be loaded during each decoding step. <a href="https://arxiv.org/pdf/2305.13245">Grouped Query Attention</a> addresses that overhead by grouping query heads into G groups such that each group shares a key and value. This reduces computational and memory overhead and allows faster inference time while maintaining the quality on par with the MHA models.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!44h8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!44h8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 424w, https://substackcdn.com/image/fetch/$s_!44h8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 848w, https://substackcdn.com/image/fetch/$s_!44h8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 1272w, https://substackcdn.com/image/fetch/$s_!44h8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!44h8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png" width="1456" height="582" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:582,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:149957,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!44h8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 424w, https://substackcdn.com/image/fetch/$s_!44h8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 848w, https://substackcdn.com/image/fetch/$s_!44h8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 1272w, https://substackcdn.com/image/fetch/$s_!44h8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cd2971c-c17a-4d61-a2b3-481f0d5352c2_1622x648.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://arxiv.org/pdf/2305.13245">GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints</a></figcaption></figure></div><blockquote><p>&#8220;"Grouped-query attention divides query heads into G groups, each of which shares a single key head and value head.</p><p>-<a href="https://arxiv.org/pdf/2305.13245"> GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints</a></p></blockquote><h3>Efficient Pretraining</h3><p>The self-attention mechanism used in Transformers can become a bottleneck in terms of computational time and memory usage, when training LLMs with long sequences. This is because the time and memory complexity of standard self-attention scales quadratically with the sequence length, making it increasingly expensive for longer sequences. To address this issue, LLaMA 1 and its variants employ two key optimizations: <a href="https://arxiv.org/abs/2112.05682">memory efficient attention</a> and <a href="https://arxiv.org/abs/2205.14135">FlashAttention</a>.</p><blockquote><p><em>&#8220;First, we use an efficient implementation of the causal multi-head attention to reduce memory usage and runtime. This implementation, available in the xformers library,2 is inspired by Rabe and Staats (2021) and uses the backward from Dao et al. (2022).</em> </p><p>-<a href="https://arxiv.org/pdf/2302.13971"> LLaMA 1</a></p></blockquote><p><strong>Memory efficient attention</strong>: In causal LLMs like LLaMA, the self-attention mechanism does not need to attend to future (mask) tokens, so using causal multi-head attention can reduce memory usage and runtime. LLaMA uses an efficient implementation of causal multi-head attention that avoids explicitly creating and storing large attention mask tensors. It leverages an <a href="https://facebookresearch.github.io/xformers/components/ops.html">AttentionBias</a> object to hardcode the mask pattern into the computation kernels, leading to substantial memory savings, particularly for long input sequences.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xHpD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xHpD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 424w, https://substackcdn.com/image/fetch/$s_!xHpD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 848w, https://substackcdn.com/image/fetch/$s_!xHpD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 1272w, https://substackcdn.com/image/fetch/$s_!xHpD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xHpD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png" width="366" height="363.0243902439024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:854,&quot;width&quot;:861,&quot;resizeWidth&quot;:366,&quot;bytes&quot;:36106,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xHpD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 424w, https://substackcdn.com/image/fetch/$s_!xHpD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 848w, https://substackcdn.com/image/fetch/$s_!xHpD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 1272w, https://substackcdn.com/image/fetch/$s_!xHpD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1aa4cf46-528c-48ad-b723-4ff37212aaea_861x854.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Memory Efficient Causal Self-Attention</figcaption></figure></div><p><strong>FlashAttention: </strong>LLaMA training also used backward from <a href="https://arxiv.org/abs/2205.14135">FlashAttention</a> algorithm, which is an algorithm that optimizes the self-attention computation in Transformers. The optimization in FlashAttention is achieved by utilizing the memory hierarchy and intelligently mapping the computation to minimize memory transfers. It does so through two key techniques: <strong>tiling and recomputation.</strong> Tiling splits input sequences and attention matrices into smaller blocks/tiles, enabling computations to reside in fast on-chip memory while minimizing slow off-chip memory accesses. Recomputation avoids storing and transferring large intermediate attention matrices between memory levels by recomputing them on-the-fly during the backward pass using statistics stored from the forward pass.</p><blockquote><p><em>&#8220;To further improve training efficiency, we reduced the amount of activations that are recomputed during the backward pass with checkpointing. More precisely, we save the activations that are expensive to compute, such as the outputs of linear layers.</em> </p><p>-<a href="https://arxiv.org/pdf/2302.13971"> LLaMA 1</a></p></blockquote><p><strong>Activation Checkpointing: </strong>In addition, LLaMA also leverages activation checkpointing. They save the activations that are expensive to compute, such as the outputs of linear layers instead of recomputing them during the backward pass.</p><h3>Pretrained with public dataset</h3><p>The LLaMA family of models  were all trained with only publicly available datasets. The training dataset for all three variants is composed majorly of English datasets. Starting with LLaMA 2 the focus has shifted heavily towards using higher quality and larger dataset to train the models. Data from sources known to contain personal information was removed from the training data and the data from factual sources were upsampled for model training. </p><p>LLaMA 3 was pretrained on over 15T tokens, again all open source datasets. With LLaMA 3, the focus has also shifted towards multilingual use cases and in that effort the training data for LLaMA 3 contains 5% high-quality non-English data spanning more than 30 languages. It also contains 4 time more code in comparison to LLaMA 2.</p><p>Here are the details on the size of pretraining dataset for each variant of LLaMA models so far:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!myGM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!myGM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 424w, https://substackcdn.com/image/fetch/$s_!myGM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 848w, https://substackcdn.com/image/fetch/$s_!myGM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 1272w, https://substackcdn.com/image/fetch/$s_!myGM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!myGM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png" width="640" height="195.14754098360655" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:372,&quot;width&quot;:1220,&quot;resizeWidth&quot;:640,&quot;bytes&quot;:80040,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!myGM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 424w, https://substackcdn.com/image/fetch/$s_!myGM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 848w, https://substackcdn.com/image/fetch/$s_!myGM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 1272w, https://substackcdn.com/image/fetch/$s_!myGM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f0a3cf-878d-4131-be80-d8af1a0692ab_1220x372.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Number of training tokens for LLaMA 1 and LLaMA 2 models; Table Source: <a href="https://arxiv.org/pdf/2307.09288">LLaMA 2 paper</a></figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Mhhg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Mhhg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 424w, https://substackcdn.com/image/fetch/$s_!Mhhg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 848w, https://substackcdn.com/image/fetch/$s_!Mhhg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 1272w, https://substackcdn.com/image/fetch/$s_!Mhhg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Mhhg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png" width="626" height="133.16727272727272" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:234,&quot;width&quot;:1100,&quot;resizeWidth&quot;:626,&quot;bytes&quot;:47614,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Mhhg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 424w, https://substackcdn.com/image/fetch/$s_!Mhhg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 848w, https://substackcdn.com/image/fetch/$s_!Mhhg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 1272w, https://substackcdn.com/image/fetch/$s_!Mhhg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fbcc304-fb15-4367-9fca-61e43e6a9426_1100x234.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Number of training tokens for LLaMA 3 models</figcaption></figure></div><h4>Scaling laws</h4><p>One thing that I was excited about in the LLaMA 1 paper and their subsequent works was their focus on optimizing the inference budget by training the smaller models on larger number of tokens. Smaller models with faster inference speed would mean people can use LLMs on-device, which would ensure:</p><ol><li><p>Improved privacy as user&#8217;s personal data remains on device and is not sent to remote servers.</p></li><li><p>Access to LLMs in offline mode, especially useful in remote places with limited internet connectivity.</p></li><li><p>Better personalization as users can fine-tune and personalize the models to their data and use-cases without sharing their personal information to the third-party servers.</p></li><li><p>Faster inference time as it would no longer be necessary to send data to and from remote servers.</p></li><li><p>Seamless integration into on-device user applications.</p></li></ol><p>Personally, I am GPU poor and so is the majority of the world, smaller models that are cheaper at inference is useful for individuals like me who have limited computational resources available.</p><blockquote><p><em>&#8220;The focus of this work is to train a series of language models that achieve the best possible performance at various inference budgets, by training on more tokens than what is typically used. - Introduction</em></p><p>-<a href="https://arxiv.org/pdf/2302.13971"> LLaMA 1</a></p></blockquote><p>The smallest LLaMA 1 7B was trained on 1T tokens, LLaMA 2 7B was trained on 2T tokens and their latest LLaMA 3 8B was trained with 15T tokens, which is <strong>75 times larger than the Chinchilla&#8217;s compute-optimal threshold of 200B tokens recommended for a 10B model. </strong>The latest results for LLaMA 3 across several benchmarks demonstrate that continuing to scale up the amount of training data and training for longer time can yield significant performance gains, even for relatively small model sizes, when optimizing for the inference budget rather than just the training budget.</p><p>You can read more on scaling laws here:</p><ul><li><p><a href="https://arxiv.org/pdf/2001.08361">Scaling Laws for Neural Language Models</a></p></li><li><p><a href="https://arxiv.org/pdf/2203.15556">Training Compute-Optimal Large Language Models</a></p></li><li><p><a href="https://www.harmdevries.com/post/model-size-vs-compute-overhead/">Go smol or go home</a></p></li><li><p><a href="https://espadrine.github.io/blog/posts/chinchilla-s-death.html">Chinchilla&#8217;s Death</a></p></li></ul><h3>Stay Tuned!</h3><p>The consistent emphasis of the LLaMA work on the cheaper inference budget is promising, especially for enabling wider access to large language models across low-resource languages and use-cases - a domain I'm interested in. I am looking forward to do work more with LLaMA and compare it against other small and open source models. Next in this series, we will talk about each (where it makes sense) components in the LLaMA models from the multilingual lens. When we get to fine-tuning the LLaMA 3 ourself, we will dive-deeper into the fine-tuning methodology and LLM safety measures employed by LLaMA models. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Exploring multilingual aspects and vocabulary of LLaMA 3 compared to LLaMA 2]]></title><description><![CDATA[This is the first part of a series where I will discuss the multilingual abilities of the LLaMA 3 model.]]></description><link>https://www.icodeformybhasa.com/p/exploring-multilingual-aspects-and</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/exploring-multilingual-aspects-and</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Mon, 22 Apr 2024 05:04:38 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!iTRz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Meta AI launched  <a href="https://ai.meta.com/blog/meta-llama-3/">LLaMA 3</a> earlier on Thursday: LLaMA-8B and 70B models. While I can't wait to conduct a comprehensive study of the model's multilingual abilities, in this introductory blog post, I will briefly discuss how it differs from LLaMA 2. Much of the information shared here is already available as part of the model's release notes. However, this post will narrow down the information shared by Meta from a multilingual perspective. Additionally, we will also explore LLaMA 3's vocabulary and tokenizer and compare it to those of LLaMA 2.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iTRz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iTRz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 424w, https://substackcdn.com/image/fetch/$s_!iTRz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 848w, https://substackcdn.com/image/fetch/$s_!iTRz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 1272w, https://substackcdn.com/image/fetch/$s_!iTRz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iTRz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png" width="482" height="482" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:482,&quot;bytes&quot;:6498033,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iTRz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 424w, https://substackcdn.com/image/fetch/$s_!iTRz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 848w, https://substackcdn.com/image/fetch/$s_!iTRz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 1272w, https://substackcdn.com/image/fetch/$s_!iTRz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd98a85f1-3ba5-476e-a7f9-cb914c26d7ec_2048x2048.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">This image was generated using Midjourney</figcaption></figure></div><h3>Summary of the updates</h3><ul><li><p>&#8220;The most capable openly available LLM to date&#8221;, - meta</p></li><li><p>8B and 70B parameter models, state-of-the-art models at those scales</p></li><li><p>Improved tokenizer with a vocabulary of 128K tokens</p></li><li><p>Grouped Query Attention in both models</p></li><li><p>8,192 sequence lengths</p></li><li><p>Pretrained on 15 trillion tokens, with 4X more code and 5% non-English data</p></li></ul><h3>Focus on multilingual capabilities</h3><p>Both LLaMA 3 8B and 70B that were released on Thursday are text-based models and these models improve significantly in comparison to their predecessor, LLaMA 2. In this blog, I will only discuss the following enhancements highlighted in the LLaMA 3 release:</p><ol><li><p><strong>Improved Tokenizer: </strong>LLaMA 3 features an updated tokenizer with an expanded 128K vocabulary compared to LLaMA 2's 32K vocab. The new tokenizer has up to 15% fewer tokens compared to LLaMA 2.</p></li><li><p><strong>Larger Training Data: </strong>LLaMA 3 was trained with 15 trillion tokens in contrast to LLaMA 2 which was trained with 2 trillion tokens. </p><ul><li><p>LLaMA 3 training data contains 4 time more code </p></li><li><p>LLaMA 3 contains 5% of the total data is in non-english language </p></li><li><p>LLaMA 2 contains 10.3% non-English data but 8.38% is classified as unknown which is partially made with coding data.</p></li></ul></li></ol><p>While the <a href="https://arxiv.org/pdf/2307.09288.pdf">LLaMA 2 paper </a>explicitly listed <strong>"Use in languages other than English" as out-of-scope</strong>, the LLaMA 3 release blog indicates they have specifically prepared for upcoming multilingual use cases by including over 5% high-quality non-English data spanning more than 30 languages in the pretraining dataset for LLaMA 3.</p><h3>Expanded vocabulary from 32k to 128K</h3><p>LLaMA 3 uses a vocabulary that is nearly <strong>four times larger</strong> than LLaMA 2's vocab. This substantial increase in vocabulary results in a considerably <strong>larger embedding matrix</strong>, consequently increasing the overall model parameters from <strong>7 billion in LLaMA 2 to 8 billion in LLaMA 3.</strong></p><p>Considering LLaMA 3 was trained with more multi-lingual data, let's explore how this increased exposure to data in different languages might be reflected in its vocabulary distribution.</p><p><em>Note: These subwords were categorized into a specific language class using<a href="https://pypi.org/project/langdetect/"> langdetect</a>.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!US1p!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!US1p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 424w, https://substackcdn.com/image/fetch/$s_!US1p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 848w, https://substackcdn.com/image/fetch/$s_!US1p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 1272w, https://substackcdn.com/image/fetch/$s_!US1p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!US1p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png" width="1456" height="451" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:451,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:131151,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!US1p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 424w, https://substackcdn.com/image/fetch/$s_!US1p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 848w, https://substackcdn.com/image/fetch/$s_!US1p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 1272w, https://substackcdn.com/image/fetch/$s_!US1p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14941ca2-a87e-4f0d-8afa-f548ed5d0bc0_1910x592.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Subword distribution by language in LLaMA 2 (left) and LLaMA 3 vocab (right)</figcaption></figure></div><p>The overall shape of the distribution of subwords across languages follows power-law distribution for both LLaMA 2 (left) and LLaMA 3 (right). The LLaMA 3 vocab demonstrates impressive language coverage. It includes a wider set of languages with higher subword count. Notably, it includes several languages with subword counts between 5,000 and 10,000, signifying stronger support for multiple high-resource languages. However, there is still a large number of languages with fewer than 2,500 subword types, suggesting the need to improve the representation for low-resource languages.</p><h3>Tokenization times</h3><p>While LLaMA 3 offers a wider language coverage in its vocab, it comes at the cost of slower tokenization times. Moving from LLaMA 2 to LLaMA 3 results in a significant increase in tokenization time &#8211; from a median time of 0.28 to 0.81 seq/s. This can be seen in the below diagrams, as the curve for both English and other languages has moved towards the right.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HQo-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HQo-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 424w, https://substackcdn.com/image/fetch/$s_!HQo-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 848w, https://substackcdn.com/image/fetch/$s_!HQo-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 1272w, https://substackcdn.com/image/fetch/$s_!HQo-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HQo-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png" width="1456" height="473" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:473,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:180822,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HQo-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 424w, https://substackcdn.com/image/fetch/$s_!HQo-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 848w, https://substackcdn.com/image/fetch/$s_!HQo-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 1272w, https://substackcdn.com/image/fetch/$s_!HQo-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19ea610-7abd-414d-8564-0f669dc09f95_1915x622.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Tokenization time for English: LLaMA 2 (left) and LLaMA 3 (right)</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!R6Wh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!R6Wh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 424w, https://substackcdn.com/image/fetch/$s_!R6Wh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 848w, https://substackcdn.com/image/fetch/$s_!R6Wh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 1272w, https://substackcdn.com/image/fetch/$s_!R6Wh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!R6Wh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png" width="1456" height="461" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:461,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:192820,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!R6Wh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 424w, https://substackcdn.com/image/fetch/$s_!R6Wh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 848w, https://substackcdn.com/image/fetch/$s_!R6Wh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 1272w, https://substackcdn.com/image/fetch/$s_!R6Wh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14937c24-1621-4cca-bc54-89918e1d75bb_1905x603.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Tokenization time to Hindi and Nepali: LLaMA 2 (left) and LLaMA 3 (right)</figcaption></figure></div><p>For both LLaMA 2 and LLaMA 3, the average and median tokenization times are consistent between English and other languages like Hindi and Nepal. The distribution for LLaMA 2, overall, is taller and slimmer, which implies a narrower range for tokenization times in comparison. This also means that LLaMA 2 has a more consistent and efficient tokenization time across sequences. This is not only true for English but other languages as well.</p><p>This might not be a serious issue overall, depending on how much time tokenization takes in the entire model execution pipeline. We will take a closer look at this in a subsequent post.</p><h3>Tokenization trends across languages</h3><p>The following curves show the distribution of token lengths for English, Hindi and Nepali for LLaMA 2 and LLaMA 3 tokenizers. Both tokenizers have taller and narrower curves for English. The median token lengths for English is similar (14 v/s 13) for LLaMA 2 and LLaMA 3, which shows that there's consistency in tokenization lengths across versions for English.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OAjo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OAjo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 424w, https://substackcdn.com/image/fetch/$s_!OAjo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 848w, https://substackcdn.com/image/fetch/$s_!OAjo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 1272w, https://substackcdn.com/image/fetch/$s_!OAjo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OAjo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png" width="1456" height="470" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:470,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:216055,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OAjo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 424w, https://substackcdn.com/image/fetch/$s_!OAjo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 848w, https://substackcdn.com/image/fetch/$s_!OAjo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 1272w, https://substackcdn.com/image/fetch/$s_!OAjo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3df669ab-2c43-459f-b629-bb4db07afee4_1912x617.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Token lengths distribution for English: LLaMA 2 (left) and LLaMA 3 (right)</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ntzv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ntzv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 424w, https://substackcdn.com/image/fetch/$s_!ntzv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 848w, https://substackcdn.com/image/fetch/$s_!ntzv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 1272w, https://substackcdn.com/image/fetch/$s_!ntzv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ntzv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png" width="1456" height="466" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:466,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:222074,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ntzv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 424w, https://substackcdn.com/image/fetch/$s_!ntzv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 848w, https://substackcdn.com/image/fetch/$s_!ntzv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 1272w, https://substackcdn.com/image/fetch/$s_!ntzv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F123c1c77-e00d-4521-bff3-48ada357df33_1914x612.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Token lengths distribution for Hindi and Nepali: LLaMA 2 (left) and LLaMA 3 (right)</figcaption></figure></div><p>In comparison, for both LLaMA 2 and LLaMA 3, Hindi and Nepali have a shorter and wider token lengths distribution curve. This suggests Hindi and Nepali texts are tokenized into longer token lengths by both versions of LLaMA. However, there's a noticeable difference in median token lengths for Hindi and Nepali, 64 for LLaMA 2 to 33 for LLaMA 3. Also, the curves more flat and wide for LLaMA 2 in comparison. This indicates that LLaMA 3 seems to have learned from the additional multilingual data to better segment sequences in languages other than English. Given that Nepali and Hindi are morphologically more complex than English, this shows that LLaMA 3 has an improved ability to handle complex languages.</p><h3>Conclusion</h3><p>In conclusion, LLaMA 3 offers a substantial leap in vocabulary size and language coverage compared to LLaMA 2. This expansion improves handling of morphologically complex languages but comes at the cost of less efficient tokenization times. LLaMA 3 demonstrates the benefit of multilingual data, achieving more accurate segmentation in languages like Hindi and Nepali. These findings show a trade-off between multilingual tokenization capabilities and processing speed. However, the regression in tokenization time might not be as significant when we look as the inference time for the entire pipeline.</p><h3>What Next in This Series?</h3><p>Dive deeper! In the next parts of this series, we will dive deeper into different components of the LLaMA 3 model and examine each component from a multi-lingual lens. This will help us understand how LLaMA 3 handles different languages.</p><p>We will also fine-tune LLaMA 3 8B for Hindi and Nepali. This will help us assess its capabilities for non-latin languages. In particular, fine-tuning for Nepali, we will also get insights into how effectively, or if at all, adapt LLaMA 3 to low-resource languages.</p><p>In addition to blogs, I will prepare notebooks and visualizers for each component I look into in this series. So stay tuned!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The Cost of Ideas]]></title><description><![CDATA[While proofreading the "How LLMs Break Down Language from Text to Tokens" section from my last blog, Nolan asked me a thought-provoking question: "Then what would the cost of ideas for ideographic languages be?" His question highlighted the significant differences between two writing systems: ideographic languages, where characters represent ideas, and orthographic languages, where characters represent sounds.]]></description><link>https://www.icodeformybhasa.com/p/the-cost-of-ideas</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/the-cost-of-ideas</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sat, 30 Mar 2024 03:05:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>While proofreading the <a href="https://www.icodeformybhasa.com/i/142259391/how-llms-break-down-language-from-text-to-tokens">"How LLMs Break Down Language from Text to Tokens"</a> section from my last blog, <a href="https://www.linkedin.com/in/nolan-kramer-85536890/">Nolan</a> asked me a thought-provoking question: "Then what would the cost of ideas for ideographic languages be?" His question highlighted the significant differences between two writing systems: ideographic languages, where characters represent ideas, and orthographic languages, where characters represent sounds. This further prompted an investigation into whether this distinction affects the overall cost of ideas for large language models (LLMs).</p><p>In this blog post, we will try to answer Nolan's question and explore the following:</p><ul><li><p><strong>Ideographic vs. Orthographic Languages:</strong> Explore the fundamental differences between ideographic languages like Chinese and Japanese and orthographic languages like English and Nepali.</p></li><li><p><strong>The Trade-Off between Conciseness and Digital Footprint:</strong> We will briefly explore the relationship between character count and byte count, acknowledging that ideographic languages might be more concise on paper but not necessarily in terms of digital storage.</p></li></ul><p>Additionally, we will discuss:</p><ul><li><p><strong>The "Cost of Ideas" for LLMs:</strong> We will define the concept of "cost of ideas" in the context of LLMs as the number of tokens required to represent the same idea.</p></li></ul><p>In my <a href="https://www.icodeformybhasa.com/p/beyond-the-abcs-exploring-the-nuances">previous post</a>, I showed that large language models (LLMs) heavily optimized for English and Latin-based languages exhibit consistently higher token counts when processing non-Latin scripts. This discrepancy in token counts translates to increased computational costs for operating LLM-based applications like ChatGPT on non-Latin languages. Building on this foundation, my focus on this post will be on  investigating the "Cost of Ideas" in ideographic and orthographic writing systems. The primary objective is to explore how the fundamental distinctions between these two language categories influence their digital footprint in representing and conveying concepts and ideas.</p><h2>Ideographic vs. Orthographic Languages</h2><p>Ideographic languages, are writing systems where each character or symbol represents a complete word or concept. Chinese, which uses thousands of characters (called hanzi) is the most prominent example of this type of writing system. </p><p><strong>Key Features of Ideographic Languages:</strong></p><ul><li><p><strong>Characters Represent Ideas:</strong> Instead of corresponding to phonetic sounds, each character in an ideographic language symbolizes an entire word or concept. the character <strong>&#26408;</strong> in Chinese represents the word "tree" or the concept of "wood."</p></li><li><p><strong>Extensive Character Set:</strong> To encompass a language's full vocabulary, ideographic writing systems require a vast number of characters, often numbering in the thousands or tens of thousands. The Kangxi dictionary, one of the most comprehensive Chinese dictionaries, contains <strong>over 47,000 characters.</strong></p></li><li><p><strong>Context Matters:</strong> While some characters may have multiple pronunciations or meanings, the context in which they appear often provides clues to their intended interpretation. The character <strong>&#34892;</strong> can mean "to walk" or "behavior," depending on the context.</p></li><li><p><strong>Character Composition: </strong>In some languages (like Chinese), characters can be built from simpler components that offer hints about meaning or pronunciation. The character <strong>&#26519;</strong>, meaning "forest," is composed of two instances of the character <strong>&#26408;</strong> (tree).</p></li></ul><p>In contrast, orthographic languages utilize a set of symbols, typically letters or syllabic characters, to represent the individual sounds (phonemes) that make up spoken words. These symbols are then combined to form words based on their phonetic values. The most familiar example of an orthographic language is English. </p><p><strong>Key Features of Orthographic Languages:</strong></p><ul><li><p><strong>Phoneme Representation:</strong> The letters or symbols in these writing systems correspond to the smallest units of sound (phonemes) in the spoken language. For example, the letter "c" represents the /k/ sound in the word "cat."</p></li><li><p><strong>Limited Symbol Set:</strong> Compared to ideographic languages, orthographic systems typically require a relatively small number of symbols to function. The English language has 26 alphabets.</p></li><li><p><strong>Phonetic Combination:</strong> Words are formed by combining these symbols based on their phonetic values, creating a more direct link between sound and written word. The word "book" is composed of the letters "b," "o," "o," and "k," representing the sounds /b/, /&#650;/, /k/.</p></li></ul><p>In addition, there are some languages like Japanese that incorporate both ideograms (kanji characters borrowed from Chinese) and phonetic scripts (hiragana and katakana) within their writing system. For example, the Japanese word for "computer" is written as &#12467;&#12531;&#12500;&#12517;&#12540;&#12479;&#12540; (using hiragana and katakana) or &#38651;&#33075; (using kanji characters).</p><h2>Universal Declaration Human Rights as a Lens for Comparing "Cost of Ideas"</h2><p>To analyze the "cost of ideas" across ideographic and orthographic languages, we will leverage the Universal Declaration of Human Rights (UDHR) as a parallel corpus in Nepali (orthographic), English (orthographic), Japanese (hybrid with ideographic kanji and syllabic kana), and Chinese (ideographic).</p><p>The UDHR translations are maintained and overseen by the United Nations (UN) ensuring that UDHR's articles are conveyed accurately and with semantic equivalence across all languages. This ensures that any differences observed in the "cost of ideas" are primarily due to the inherent characteristics of the writing systems themselves, rather than discrepancies in translation.</p><p>We will examine the parallel translations across these languages to understand how the same ideas when represented using different writing systems vary in terms of the cost that a digital system has to bear.</p><p><strong>Preprocessing the Data</strong></p><p>This plain text version of UDHR was originally prepared and hosted by the Unicode Consortium under the "UDHR in Unicode" project. While as of January 2024, the Unicode Consortium is no longer hosting the UDHR in Unicode project, the XML files with translations in multiple languages are available at <a href="http://efele.net/udhr/">UDHR in XML</a>.</p><p>I pre-processed the XML files in Mandarin Chinese (Simplified), Mandarin Chinese (Traditional), English, Japanese, and Nepali languages. The processed dataset includes 31 rows for each language, with a preamble and 30 articles defined in UDHR.</p><h2><strong>The Trade-Off: Conciseness vs. Digital Footprint</strong></h2><p>The trade-off between conciseness and digital footprint becomes particularly evident when comparing ideographic writing systems, like Chinese, with orthographic systems, like English or Nepali. Let's delve deeper into this trade-off by examining the grapheme and byte counts for the text in our dataset.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8LXg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8LXg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!8LXg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!8LXg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!8LXg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8LXg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33610,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8LXg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!8LXg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!8LXg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!8LXg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d1cd779-2b97-4a9d-a1db-dd4ee8af7888_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Average Graphemes and Bytes count across languages in UDHR</figcaption></figure></div><h4><strong>Grapheme Count and Conciseness</strong></h4><p>Grapheme count refers to the number of characters, such as letters or ideographs, needed to represent a word or concept. Ideographic scripts like Chinese exhibit a significant advantage in conciseness. In our dataset, Traditional Chinese has an average grapheme count of 82.54, and Simplified Chinese has 82.45. In contrast, the average grapheme count for English is considerably higher at 321.70. This conciseness in ideographic scripts stems from their ability to convey complex ideas and concepts through a single ideographic character, reducing the need for multiple graphemes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nwRT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nwRT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 424w, https://substackcdn.com/image/fetch/$s_!nwRT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 848w, https://substackcdn.com/image/fetch/$s_!nwRT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 1272w, https://substackcdn.com/image/fetch/$s_!nwRT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nwRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png" width="1456" height="1312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1312,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:299282,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nwRT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 424w, https://substackcdn.com/image/fetch/$s_!nwRT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 848w, https://substackcdn.com/image/fetch/$s_!nwRT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 1272w, https://substackcdn.com/image/fetch/$s_!nwRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cc9af4b-97d2-4119-ad36-126e14e54f8f_1460x1316.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Graphemes count across each article in UDHR for English and Chinese</figcaption></figure></div><h4>Byte Count and Digital Footprint</h4><p>However, the byte count represents the number of bytes required to encode the text digitally. Despite their lower grapheme counts, Traditional and Simplified Chinese texts required an average of 246.41 and 240.77 bytes, respectively, to encode their characters. This higher byte count is a consequence of the complex character encodings required for ideographic scripts, which often involve multiple bytes per character. The cost of an increased digital footprint. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tURU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tURU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 424w, https://substackcdn.com/image/fetch/$s_!tURU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 848w, https://substackcdn.com/image/fetch/$s_!tURU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 1272w, https://substackcdn.com/image/fetch/$s_!tURU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tURU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png" width="1454" height="1300" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1300,&quot;width&quot;:1454,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:295041,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tURU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 424w, https://substackcdn.com/image/fetch/$s_!tURU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 848w, https://substackcdn.com/image/fetch/$s_!tURU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 1272w, https://substackcdn.com/image/fetch/$s_!tURU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a514d65-f067-4f93-89d5-bee96afccf59_1454x1300.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Bytes count across each article in UDHR for English and Chinese</figcaption></figure></div><p><strong>English and the Trade-Off</strong></p><p>On average, English requires 3.9 times more graphemes than Traditional and Simplified Chinese to convey the same concepts. However, when it comes to byte counts needed for digital encoding, the gap narrows down drastically. English requires only 1.31 times more bytes than Traditional Chinese, and 1.34 times more bytes than Simplified Chinese. This highlights the trade-off: while Chinese is far more concise requiring fewer graphemes, English benefits from a simpler encoding requiring fewer bytes per grapheme representation compared to the ideographic Chinese scripts.</p><p><strong>The Case of Japanese</strong></p><p>Similarly, Japanese, which incorporates ideographic kanji characters borrowed from Chinese, and orthographic characters hiragana and katakana, has an average grapheme count of 124.35 in our dataset, lower than English. However, the byte count for Japanese text jumps to 371.83, exceeding even that of English. This significant increase in byte count can, again, be attributed to the complex character encodings for Japanese characters.</p><p>In essence, while ideographic scripts like Chinese and Japanese offer conciseness in terms of grapheme counts, they often require more bytes to encode digitally, resulting in a trade-off between conciseness and digital footprint. This trade-off has implications for tasks such as text storage, transmission, and processing within language technologies and applications.</p><h3>Script Intricacies and Their Impact on Digital Footprint</h3><p>While ideographic scripts like Chinese exhibit a clear trade-off between conciseness in grapheme counts and an increased digital footprint due to their complex character encodings, the case of Nepali presents a different challenge.</p><p>Even though Nepali, like English, is an orthographic language, its text characteristics in our dataset differ significantly in terms of grapheme and byte count. While Nepali uses far fewer graphemes on average (194.80) compared to English (321.70), this efficiency stems from the unique features of the Devanagari script used by Nepali. Unlike the Latin script, where consonants often need additional characters to represent sounds like syllables or consonant clusters, Devanagari generally uses a single character per sound. This is because Devanagari consonants typically come with an inherent vowel sound, a characteristic not always present in the Latin script. This allows Nepali texts to be represented with fewer graphemes on average compared to their English. </p><p>However, the byte count tells a different story. Nepali text required a staggering 759.09 bytes on average to encode digitally, over 2.3 times higher than the 321.96 bytes needed for English text. This disproportionately high byte count for Nepali, despite its lower grapheme count compared to English, highlights the complexity involved in digitally encoding the intricate system of consonant clusters, vowel diacritics, and combining characters present in the Devanagari script.</p><h3><strong>The "Cost of Ideas" for LLMs</strong></h3><p>As explored in <a href="https://www.icodeformybhasa.com/p/beyond-the-abcs-exploring-the-nuances#%C2%A7how-llms-break-down-language-from-text-to-tokens">my previous work</a>, the number of tokens required to represent ideas in LLMs can vary significantly across languages. It really depends on how the tokenizer was trained for each model. While the inherent characteristics of a language influence the number of graphemes needed to represent ideas, the tokenization method plays a crucial role in determining the actual token counts within the LLM.If the tokenizer is trained on a diverse dataset that includes a good representation of ideographic languages like Chinese, it can potentially learn to tokenize these languages more efficiently. This can lead to lower token counts and a cost advantage for representing ideas in the LLM.</p><p>You can find the <a href="https://huggingface.co/spaces/shreeyad/tokenizers-multilingual">visualizer here</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!q-qQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q-qQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 424w, https://substackcdn.com/image/fetch/$s_!q-qQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 848w, https://substackcdn.com/image/fetch/$s_!q-qQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 1272w, https://substackcdn.com/image/fetch/$s_!q-qQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q-qQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png" width="1456" height="436" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:436,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:284476,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q-qQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 424w, https://substackcdn.com/image/fetch/$s_!q-qQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 848w, https://substackcdn.com/image/fetch/$s_!q-qQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 1272w, https://substackcdn.com/image/fetch/$s_!q-qQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe40df143-8670-498e-b30e-ab723bfd7fa7_1913x573.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Tokenizing Article 1 in English and Chinese using XML-Roberta Tokenizer</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UTMY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UTMY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 424w, https://substackcdn.com/image/fetch/$s_!UTMY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 848w, https://substackcdn.com/image/fetch/$s_!UTMY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 1272w, https://substackcdn.com/image/fetch/$s_!UTMY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UTMY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png" width="1456" height="422" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:422,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:286448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UTMY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 424w, https://substackcdn.com/image/fetch/$s_!UTMY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 848w, https://substackcdn.com/image/fetch/$s_!UTMY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 1272w, https://substackcdn.com/image/fetch/$s_!UTMY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae81a7cc-b5f9-420e-95a7-b53b50048748_1914x555.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Tokenizing Article 1 in English and Chinese using NLLB Tokenizer</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Vvi-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vvi-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 424w, https://substackcdn.com/image/fetch/$s_!Vvi-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 848w, https://substackcdn.com/image/fetch/$s_!Vvi-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 1272w, https://substackcdn.com/image/fetch/$s_!Vvi-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vvi-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png" width="1456" height="432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:432,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:287963,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Vvi-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 424w, https://substackcdn.com/image/fetch/$s_!Vvi-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 848w, https://substackcdn.com/image/fetch/$s_!Vvi-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 1272w, https://substackcdn.com/image/fetch/$s_!Vvi-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc971e67f-5e13-43b8-be84-ce05b58607db_1901x564.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Tokenizing Article 1 in English and Chinese using GPT-4 Tokenizer</figcaption></figure></div><p>If the tokenizer is trained on a diverse dataset that includes a good representation of ideographic languages like Chinese, it can potentially learn to tokenize these languages more efficiently, resulting in lower token counts and, consequently, a cost advantage for representing ideas within the LLM.</p><p>Conversely, a tokenizer trained on data skewed towards certain languages or writing systems may struggle to tokenize other languages optimally. This can result in higher token counts and increased costs for representing ideas in those languages. This seems to be the case with GPT-4 tokenization, where it exhibits sub-optimal performance when tokenizing texts in non-Latin languages.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wcAg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wcAg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!wcAg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!wcAg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!wcAg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wcAg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37636,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!wcAg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!wcAg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!wcAg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!wcAg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9fdafb2-9e42-42cc-a929-4224da6562c1_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Average Token counts for XML-Roberta, NLLB and GPT-4 in UDHR</figcaption></figure></div><p>This observation highlights the importance of carefully curating the training dataset, as well as tailoring the tokenization process when developing large language models. By ensuring that the tokenizer is exposed to a diverse range of languages, including ideographic scripts, during the training process, LLMs can potentially leverage the inherent advantages of certain writing systems. For example, they can exploit the compact representation of ideas offered by ideographic languages like Chinese. Ultimately, the tokenization method and the quality of the training data can significantly impact the cost and efficiency of representing ideas across different languages within large language models.</p><h3>Acknowledgements</h3><p><a href="https://www.linkedin.com/in/nolan-kramer-85536890/">Nolan Kramer</a>, for not just asking the question that became the basis of this post but also for the discussions throughout the time I was working on this project.</p><p><a href="https://www.linkedin.com/in/gwendolyngillingham">Gwendolyn Gillingham</a>, for helping me with the study and providing the idea of using the UDHR dataset.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Beyond the ABCs: Exploring the nuances of tokenization in diverse languages]]></title><description><![CDATA[Earlier this month, I stumbled upon two articles that discussed the disparities in tokenization among languages titled "All languages are NOT created (tokenized) equal" and &#8220;Why is GPT-3 15.77x more expensive for certain languages?&#8221;.]]></description><link>https://www.icodeformybhasa.com/p/beyond-the-abcs-exploring-the-nuances</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/beyond-the-abcs-exploring-the-nuances</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Wed, 13 Mar 2024 03:40:52 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Earlier this month, I stumbled upon two articles that discussed the disparities in tokenization among languages titled "<a href="https://www.artfish.ai/p/all-languages-are-not-created-tokenized">All languages are NOT created (tokenized) equal</a>" and &#8220;<a href="https://denyslinkov.medium.com/why-is-gpt-3-15-77x-more-expensive-for-certain-languages-2b19a4adc4bc">Why is GPT-3 15.77x more expensive for certain languages?</a>&#8221;. This piqued my interest and motivated me to conduct further investigations on my own. </p><p>In this article, I'll discuss Byte-Pair Encoding (BPE) based tokenization and the disparities in the tokenization process across different languages. Using the Indo-European language family as a case study, I will show how these discrepancies arise <strong>not</strong> from inherent language family differences but rather from the training data and the representation of characters in Unicode for each language. In addition, I will:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><ol><li><p>Explore GPT-4 vocab and compare it to XML-RoBERTa and NLLB-200-distilled-600M.</p></li><li><p>Explore token length distribution for Indo-European languages: English, French, Spanish, Hindi, and Nepali.</p></li><li><p>Explore the relationship between grapheme counts vs token lenghts across the languages.</p></li><li><p>Compare the speed of tokenization for the three tokenizers across five languages mentioned above.</p></li></ol><h3>How LLMs break down language from text to tokens</h3><p><em><a href="https://www.youtube.com/watch?v=zduSFxRajkE">Let&#8217;s buid GPT tokenize</a>r by Andrej Karpathy was very helpful in understanding the tokenizers used by LLMs.</em></p><p>Tokenization is a fundamental process that involves breaking down a text into smaller units called tokens, typically words or subwords. LLMs like GPT-4 utilizes a technique called byte pair encoding (BPE) for tokenization. It iteratively merges the most frequently occurring pairs of consecutive characters into single units, forming a dynamic vocabulary that adapts to the unique characteristics of the training data. This approach enables LLMs to effectively handle rare words and improves its computational efficiency compared to traditional word-based methods. </p><p>In addition, instead of treating text as sequences of individual characters, GPT-4 uses <strong>byte-level BPE</strong> for tokenization and leverages the properties of UTF-8 encoding, which represents text using sequences of bytes called <a href="https://en.wikipedia.org/wiki/Code_point">code points</a>. </p><h4>Byte-Level BPE in GPT Models</h4><p>By working with bytes instead of characters, these models achieve the following advantages, in addition to dynamic vocabulary building:</p><ol><li><p><strong>Compact Vocabulary:</strong> It starts with a base vocabulary consisting of 256 individual bytes, representing all possible byte values in UTF-8 encoding. This small vocabulary size translates to computational efficiency and faster processing.</p></li><li><p><strong>Universal Character Representation:</strong> This ensures all characters, regardless of their origin, can be represented using a combination of bytes, effectively eliminating the need for "unknown tokens." This allows the models to handle diverse text from various languages and writing systems seamlessly.</p></li></ol><h4>Decoding GPT-4 vocab</h4><p>To understand the discrepancies discussed above, I first looked into the vocab used by GPT-4. Tokens in the original vocab <a href="https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken">cl100k_base.tiktoken</a> used by the <code>cl100k_base</code> tokenizer, which is the BPE tokenizer used by GPT-4 <strong>and is encoded in base64</strong>. I converted vocabulary to UTF-8 for my analysis. Some tokens resulted in encoding errors due to incomplete generation, highlighting limitations of byte-level BPE in handling uncommon texts and text in writing systems other than latin.</p><ul><li><p>The decoded vocabulary comprises 70,988 entries containing only Latin characters. This suggests a potential bias towards Latin-based languages in GPT-4's training data.</p></li><li><p>There are 29,268 entries containing at least one non-Latin character. This indicates that the model was exposed to other languages during training. </p></li><li><p>Among these non-Latin entries, 803 entries partial byte sequences. </p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hDVI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hDVI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 424w, https://substackcdn.com/image/fetch/$s_!hDVI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 848w, https://substackcdn.com/image/fetch/$s_!hDVI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 1272w, https://substackcdn.com/image/fetch/$s_!hDVI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hDVI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png" width="1422" height="1144" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1144,&quot;width&quot;:1422,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:213834,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hDVI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 424w, https://substackcdn.com/image/fetch/$s_!hDVI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 848w, https://substackcdn.com/image/fetch/$s_!hDVI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 1272w, https://substackcdn.com/image/fetch/$s_!hDVI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a75b5c-1112-4cb1-8b53-e3a71c236000_1422x1144.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">GPT-4 Tokenization Visualization from <a href="https://platform.openai.com/tokenizer">Open AI&#8217;s Tokenizer playground</a></figcaption></figure></div><h4>Limitations in representing uncommon texts and other writing systems</h4><p>While byte-level BPE effectively eliminates the need for unknown tokens with a compact vocabulary, there are some limitations, especially in representing uncommon texts and texts in writing systems other than latin.</p><p>Despite universal character representation, it might struggle with tokenizing uncommon texts not seen during training. For cases involving extremely rare combinations or characters from under-represented writing systems BPE might resort to suboptimal tokenization, like breaking down the sequence into individual bytes, <strong>which can impact accuracy</strong>.</p><p>English letters are assigned a one-byte encoding in UTF-8. However, this is not true for all languages, some languages use multiple bytes. Hindi and Nepali are examples of such languages. Both Hindi and Nepali use Devanagari script which has a larger character set than the basic Latin alphabet used in English. This means that these languages need more unique symbols to represent its characters. UTF-8 encodes characters using a variable number of bytes depending on their rarity. To represent these less common characters, UTF-8 uses two, three, or even four bytes. Since a byte-level BPE model would treat each byte as a separate token, a letter in languages like Hindi or Nepali would be broken down into multiple tokens, potentially impacting the model's understanding and generation capabilities. The impact of the process in model&#8217;s understanding in out of the scope of this article.</p><p>Let's explore how the byte-based BPE tokenization process can lead to this issue i discussed with the Nepali word "&#2360;&#2379;&#2350;&#2348;&#2366;&#2352;" (sombaar, meaning "Monday") as an example.</p><ol><li><p><strong>Unicode Code Points:</strong> The word "&#2360;&#2379;&#2350;&#2348;&#2366;&#2352;" is represented by the following Unicode code points in hexadecimal:</p><pre><code><code>&#2360;: 0x0938
&#2379;: 0x094B
&#2350;: 0x092E
&#2348;: 0x092C
&#2366;: 0x093E
&#2352;: 0x0930</code></code></pre></li><li><p><strong>UTF-8 Encoding:</strong> When encoded using UTF-8, the word "&#2360;&#2379;&#2350;&#2348;&#2366;&#2352;" becomes the following byte sequence:</p><pre><code><code>&#2360;: 0xE0 0xA4 0xB8
&#2379;: 0xE0 0xA5 0x8B
&#2350;: 0xE0 0xA4 0xAE
&#2348;: 0xE0 0xA4 0xAC
&#2366;: 0xE0 0xA4 0xBE
&#2352;: 0xE0 0xA4 0xB0</code></code></pre></li></ol><ol start="3"><li><p><strong>Byte-based BPE Tokenization:</strong> During the training BPE can , for example for character <code>&#2348;</code>, merge the byte sequences <code>0xE0 0xA4 into one single token and leaves out 0xAC as a separate token depending on the data it has seen.</code> This causes the vocab to have byte sequences that do not make up a valid code point. So let&#8217;s assume after several iteration we have the following vocabulary. </p><pre><code><code>0xE0 0xA4 0xB8
0xE0 0xA5 0x8B
0xE0 0xA4 0xAE
0xE0 0xA4 --&gt; incomplete
0xAC --&gt; incomplete
0xE0 0xA4 0xBE
0xE0 0xA4 0xB0</code></code></pre></li><li><p><strong>Tokenization of "&#2360;&#2379;&#2350;&#2348;&#2366;&#2352;":</strong> When the tokenizer tries to tokenize the word "&#2360;&#2379;&#2350;&#2348;&#2366;&#2352;", it would then generate the following sequence of tokens:</p><pre><code><code>['0xE0 0xA4 0xB8', '0xE0 0xA5 0x8B', '0xE0 0xA4 0xAE', '0xE0 0xA4', '0xAC', '0xE0 0xA4 0xBE', '0xE0 0xA4 0xB0']
Decoding at token id level:
['&#2360;', '&#2379;', '&#2350;', '&#65533;', '&#65533;', '&#2366;', '&#2352;']</code></code></pre><p><br>When decoding the tokens individually, you would encounter an unicode decoding error and by default one would encounter an Unicode replacement character (&#65533;). See more on this <a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode">here</a>.</p><p><strong>Note:</strong> A slightly different case would be where byte sequences for multiple characters would be combined by BPE to one entry in vocab, which would also cause similar issue.</p><pre><code><code>Decoding at token level:
['&#2360;', '&#2379;', '&#2350;', '&#65533;', '&#65533;', '&#2366;', '&#2352;']
Decoding at input level:
&#2360;&#2379;&#2350;&#2348;&#2366;&#2352;</code></code></pre><p>However, when you decode the entire sequence of tokens together, the tokenizer can correctly reconstruct the original word "&#2360;&#2379;&#2350;&#2348;&#2366;&#2352;" by combining the individual byte sequences represented by each token.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ey4g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ey4g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 424w, https://substackcdn.com/image/fetch/$s_!Ey4g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 848w, https://substackcdn.com/image/fetch/$s_!Ey4g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 1272w, https://substackcdn.com/image/fetch/$s_!Ey4g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ey4g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png" width="1412" height="1154" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1154,&quot;width&quot;:1412,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:318730,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ey4g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 424w, https://substackcdn.com/image/fetch/$s_!Ey4g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 848w, https://substackcdn.com/image/fetch/$s_!Ey4g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 1272w, https://substackcdn.com/image/fetch/$s_!Ey4g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe6287d-8c38-4a6d-aee7-deccc053a2e9_1412x1154.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Open AI&#8217;s tiktoken Tokenizer Visualizer for Nepali. Note that there are several decoding issues here. This is because many of these tokens are represented using incomplete utf-8 code points. Also, note that number of tokens is greater than the number of characters, this is because some characters are represented using multiple sequence of bytes and tiktoken tokenizer, for some of these sequences of bytes, sees each byte for a character as a token.</figcaption></figure></div><h4>Factors influencing high invalid byte sequences in vocab </h4><p>The quality and size of the training data in a particular language can expose algorithm to learn sub-optimal vocabulary. Languages with less diverse or smaller training datasets may exhibit higher rates of invalid byte sequences due to insufficient coverage of character combinations or linguistic phenomena. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BWQo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BWQo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 424w, https://substackcdn.com/image/fetch/$s_!BWQo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 848w, https://substackcdn.com/image/fetch/$s_!BWQo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 1272w, https://substackcdn.com/image/fetch/$s_!BWQo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BWQo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png" width="1412" height="580" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:580,&quot;width&quot;:1412,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52875,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BWQo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 424w, https://substackcdn.com/image/fetch/$s_!BWQo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 848w, https://substackcdn.com/image/fetch/$s_!BWQo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 1272w, https://substackcdn.com/image/fetch/$s_!BWQo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79184d26-49c1-4290-8c06-141b4b4dd209_1412x580.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">No decoding error for latin characters that have one byte sequence in utf-encoding</figcaption></figure></div><p>In addition to the quality and size of training data, some of the factors that influence high invalid byte sequences in vocab are:</p><ol><li><p><strong>Script Complexity: </strong>Languages with more complex scripts, such as those with non-Latin scripts like Devanagari, Thai, or Chinese characters, may have a higher likelihood of invalid byte sequences representation in vocab. These scripts often have a larger number of characters and more complex character compositions, leading to a wider range of possible byte sequences and potential challenges in tokenization.</p></li><li><p><strong>Character Frequency: </strong>Characters that are less frequent in the training data may have their byte sequences split more frequently during merging, increasing the likelihood of incomplete tokens.</p></li><li><p><strong>Word Morphology:</strong> Languages with rich morphology, such as agglutinative languages, may exhibit a larger number of morphemes or affixes, leading to more opportunities for byte sequences to be split during tokenization.</p></li></ol><h3>Can training with more multi-lingual data solve this?</h3><p>Looking at the vocab we can infer that GPT-4 was heavily optimized towards English. In this section, I will compare the GPT-4 tokenizer with two other byte-based BPE tokenizers: <a href="https://huggingface.co/docs/transformers/v4.17.0/en/model_doc/xlm-roberta#transformers.XLMRobertaTokenizer">XML-RoBERTa </a>and  <a href="https://huggingface.co/docs/transformers/en/model_doc/nllb#nllbtokenizer">NLLB-200-distilled-600M</a> that were trained with multi-lingual data. The purpose of this study is to see if and how exposing more multi-lingual data in training affects tokenization. I chose these two tokenizers in particular because in <a href="https://denyslinkov.medium.com/why-is-gpt-3-15-77x-more-expensive-for-certain-languages-2b19a4adc4bc">Denys Linkov&#8217;s blog</a> he shows that the ratio between the largest and smallest token numbers is the lowest for these two tokenizers in comparison to the others he compared. </p><h4>A more diverse and distributed vocabulary</h4><p>NLLB and XML-RoBERTa demonstrate significantly more diverse vocabularies compared to GPT-4&#8217;s cl100k_base vocab:</p><ul><li><p><strong>Non-Latin characters:</strong> NLLB and XML-RoBERTa contain roughly <strong>79.53%</strong> and <strong>83.62%</strong> non-Latin entries respectively, while cl100k_base only has <strong>29.2%</strong>. This indicates that NLLB and XML-RoBERTa can handle a wider range of languages beyond Latin-based ones.</p></li><li><p><strong>Vocabulary size:</strong> NLLB and XML-RoBERTa have a much larger vocabulary size, with <strong>2.55</strong> and <strong>2.49 times</strong> more entries than cl100k_base with a more distributed sub-tokens across languages.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zOuv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zOuv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 424w, https://substackcdn.com/image/fetch/$s_!zOuv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 848w, https://substackcdn.com/image/fetch/$s_!zOuv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 1272w, https://substackcdn.com/image/fetch/$s_!zOuv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zOuv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png" width="1404" height="982" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:982,&quot;width&quot;:1404,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:164755,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zOuv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 424w, https://substackcdn.com/image/fetch/$s_!zOuv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 848w, https://substackcdn.com/image/fetch/$s_!zOuv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 1272w, https://substackcdn.com/image/fetch/$s_!zOuv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F702d5f48-9d67-4216-ae18-5987bd99dbef_1404x982.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Vocab counts for cl100k_base,  NLLB-200-distilled-600M, and XML-RoBERTa. Note, non-latin entires also include vocab with non-latin characters, not necessarily belonging to a specific language, like &#8220;&gt;&#8221;.</figcaption></figure></div><p>I also found that cl100k_base vocab contains a significantly higher number of entries representing incomplete byte sequences, at roughly <strong>29.7 times</strong> and <strong>25.1 times</strong> more than NLLB and XML-RoBERTa respectively. The limited exposure to non-Latin byte sequences during training might explain large number of incomplete sequences in cl100k_base vocab. As mentioned earlier section, a smaller or less diverse multilingual corpus could restrict the model's ability to learn the proper representation of uncommon text sequences.</p><h3>Aya Dataset</h3><p>For this study, I used <a href="https://arxiv.org/pdf/2402.06619.pdf">Aya Dataset</a>, which contains human-curated prompt-completion pairs in 65 languages written by fluent speakers of the languages. I chose this dataset for three reasons, 1. diverse sequences in terms of lengths and topic, 2. contains all languages of interest, and 3. since it is human-curated, the dataset is of high quality, which is what I observed for English, Nepali, and Hindi.</p><p>I took texts in <code>inputs</code> column of the dataset and kept a max of 1500 samples for each languages. The total samples in the final split for the five languages of interest are:</p><ul><li><p>English - 1499</p></li><li><p>French - 1349</p></li><li><p>Spanish - 1500</p></li><li><p> Hindi - 1087</p></li><li><p>Nepali - 1500</p></li></ul><h3>Results</h3><h4>Tokenization Trends Across Languages</h4><p>Although, I used a different dataset, I observed a similar trend in token length distribution as discussed in the articles: "<a href="https://www.artfish.ai/p/all-languages-are-not-created-tokenized">All languages are NOT created (tokenized) equal</a>" and &#8220;<a href="https://denyslinkov.medium.com/why-is-gpt-3-15-77x-more-expensive-for-certain-languages-2b19a4adc4bc">Why is GPT-3 15.77x more expensive for certain languages?</a>&#8221;. </p><p><strong>Inspired by the first work, I have created <a href="https://huggingface.co/spaces/shreeyad/tokenizers-multilingual">a similar dashboard </a>for this work.</strong></p><p>The distribution of token lengths across languages non-English languages (French, Spanish, Hindi, and Nepali) were closer to English for NLLB and XML-RoBERTa tokenizers in comparison to GPT-4 tokenizer. However, for GPT-4 tokenizer, the token distribution for non-latin languages (Hindi, and Nepali) were very different from that of English, with non-latin languages (Hindi, and Nepali) having a consistently higher number of tokens across the samples.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nYgc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nYgc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 424w, https://substackcdn.com/image/fetch/$s_!nYgc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 848w, https://substackcdn.com/image/fetch/$s_!nYgc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 1272w, https://substackcdn.com/image/fetch/$s_!nYgc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nYgc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png" width="1418" height="918" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:918,&quot;width&quot;:1418,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:316689,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nYgc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 424w, https://substackcdn.com/image/fetch/$s_!nYgc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 848w, https://substackcdn.com/image/fetch/$s_!nYgc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 1272w, https://substackcdn.com/image/fetch/$s_!nYgc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa128301b-befa-4b99-a947-2fedc7bdd09a_1418x918.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2m-N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2m-N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 424w, https://substackcdn.com/image/fetch/$s_!2m-N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 848w, https://substackcdn.com/image/fetch/$s_!2m-N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 1272w, https://substackcdn.com/image/fetch/$s_!2m-N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2m-N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png" width="1400" height="892" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:892,&quot;width&quot;:1400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:299749,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2m-N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 424w, https://substackcdn.com/image/fetch/$s_!2m-N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 848w, https://substackcdn.com/image/fetch/$s_!2m-N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 1272w, https://substackcdn.com/image/fetch/$s_!2m-N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbb5f007-ada4-43f0-b249-1b78005d3290_1400x892.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The median token length for non-Latin languages (Hindi and Nepali) is only slightly higher than for Latin languages (English, French, Spanish), 17 vs. 16, for NLLB and RoBERTa tokenizers. However, GPT-4 tokenizer exhibits a significantly larger difference with median token lenghts of 62 for Hindi and Nepali vs. 16 for English, French, and Spanish.</p><p>This observation suggests that <strong>training on a more comprehensive multilingual corpus can influence token length distribution</strong>. NLLB and RoBERTa, likely trained on broader datasets, show a smaller difference in token lengths between Latin and non-Latin languages compared to GPT-4 tokenizer, which might have been trained on a less diverse corpus.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DU86!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DU86!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 424w, https://substackcdn.com/image/fetch/$s_!DU86!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 848w, https://substackcdn.com/image/fetch/$s_!DU86!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 1272w, https://substackcdn.com/image/fetch/$s_!DU86!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DU86!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png" width="1408" height="932" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:932,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:266109,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DU86!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 424w, https://substackcdn.com/image/fetch/$s_!DU86!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 848w, https://substackcdn.com/image/fetch/$s_!DU86!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 1272w, https://substackcdn.com/image/fetch/$s_!DU86!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7b4fff-6b94-4f0a-99b6-e08000f876e5_1408x932.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There was no replacement token for any sample in the dataset for NLLB and XML-RoBERTa, while there were a fair amount on replacement tokens, for non-latin languages for GPT-4 tokenizer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6NOj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6NOj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 424w, https://substackcdn.com/image/fetch/$s_!6NOj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 848w, https://substackcdn.com/image/fetch/$s_!6NOj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 1272w, https://substackcdn.com/image/fetch/$s_!6NOj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6NOj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png" width="1412" height="932" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:932,&quot;width&quot;:1412,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:253758,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6NOj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 424w, https://substackcdn.com/image/fetch/$s_!6NOj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 848w, https://substackcdn.com/image/fetch/$s_!6NOj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 1272w, https://substackcdn.com/image/fetch/$s_!6NOj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750431df-146b-4cd3-a4c8-b8674d91e825_1412x932.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3><strong>Graphemes vs Token Counts</strong></h3><p>I compared the grapheme count (number of written characters) to the token count (number of tokens after tokenization) for the above tokenizers and observed that GPT-4&#8217;s tokenizer stands out with a much higher token count compared to its grapheme count for Hindi and Nepali. </p><p>While all three models utilize BPE (Byte Pair Encoding), NLLB and RoBERTa tokenizers, likely trained on broader multilingual datasets, would have encountered various writing systems and grammatical structures. This exposure allows them to adapt their tokenization strategies to handle the complexities of non-Latin languages.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DBr1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DBr1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 424w, https://substackcdn.com/image/fetch/$s_!DBr1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 848w, https://substackcdn.com/image/fetch/$s_!DBr1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 1272w, https://substackcdn.com/image/fetch/$s_!DBr1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DBr1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png" width="1422" height="836" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:836,&quot;width&quot;:1422,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:503063,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DBr1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 424w, https://substackcdn.com/image/fetch/$s_!DBr1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 848w, https://substackcdn.com/image/fetch/$s_!DBr1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 1272w, https://substackcdn.com/image/fetch/$s_!DBr1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61e5fef7-7396-4fef-8072-552a4c83e123_1422x836.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!D48Q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D48Q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 424w, https://substackcdn.com/image/fetch/$s_!D48Q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 848w, https://substackcdn.com/image/fetch/$s_!D48Q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 1272w, https://substackcdn.com/image/fetch/$s_!D48Q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D48Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png" width="1432" height="850" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:850,&quot;width&quot;:1432,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:505051,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D48Q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 424w, https://substackcdn.com/image/fetch/$s_!D48Q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 848w, https://substackcdn.com/image/fetch/$s_!D48Q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 1272w, https://substackcdn.com/image/fetch/$s_!D48Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64de6172-085a-404a-aaa8-6a88f79b39c9_1432x850.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>GPT-4 tokenizer seems to have been heavily optimized for English and might not have been adequately exposed to the specific characteristics of non-Latin languages.  As a way to manage unseen characters or complex word structures, GPT-4 tokenizer  seems to be excessively splititting words into subwords such that a lot of the subwords are incomplete/sub byte sequences, inflating the token count compared to graphemes.</p><p>Nepali and Hindi both have a complex morphology involving prefixes, suffixes, and other meaningful units and limited exposure to such structures during training could hinder GPT-4 tokenizer&#8217;s ability to effectively tokenize these languages.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ywML!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ywML!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 424w, https://substackcdn.com/image/fetch/$s_!ywML!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 848w, https://substackcdn.com/image/fetch/$s_!ywML!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 1272w, https://substackcdn.com/image/fetch/$s_!ywML!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ywML!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png" width="1456" height="846" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:846,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:412695,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ywML!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 424w, https://substackcdn.com/image/fetch/$s_!ywML!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 848w, https://substackcdn.com/image/fetch/$s_!ywML!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 1272w, https://substackcdn.com/image/fetch/$s_!ywML!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbae78e48-d797-494e-bda1-7e4d140ddca5_1456x846.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Does this affect the overall tokenization time?</h4><p>The peak distribution of time taken for tokenization by NLLB and RoBERTa is around <strong>2.2 seconds</strong> and <strong>2.0 seconds,</strong> respectively. cl100k_base is significantly faster in comparison with peak distribution of time at <strong>0.0006 seconds</strong>. However, the speed of tokenization only varies slightly for a tokenizer across the languages. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9krw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9krw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 424w, https://substackcdn.com/image/fetch/$s_!9krw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 848w, https://substackcdn.com/image/fetch/$s_!9krw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 1272w, https://substackcdn.com/image/fetch/$s_!9krw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9krw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png" width="1416" height="920" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:920,&quot;width&quot;:1416,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:312823,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9krw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 424w, https://substackcdn.com/image/fetch/$s_!9krw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 848w, https://substackcdn.com/image/fetch/$s_!9krw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 1272w, https://substackcdn.com/image/fetch/$s_!9krw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20503e-e34a-4909-b544-2e41435bbaba_1416x920.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!afNC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!afNC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 424w, https://substackcdn.com/image/fetch/$s_!afNC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 848w, https://substackcdn.com/image/fetch/$s_!afNC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 1272w, https://substackcdn.com/image/fetch/$s_!afNC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!afNC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png" width="1422" height="910" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:910,&quot;width&quot;:1422,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:340804,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!afNC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 424w, https://substackcdn.com/image/fetch/$s_!afNC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 848w, https://substackcdn.com/image/fetch/$s_!afNC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 1272w, https://substackcdn.com/image/fetch/$s_!afNC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d457671-e8bc-40d9-8e2d-1a836731c943_1422x910.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This metric was collected from a device with following configuration:</p><p><em>Courtesy: Infinity Technology Inc.</em></p><pre><code>Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         46 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  48
  On-line CPU(s) list:   0-47
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz
    CPU family:          6
    Model:               63
    Thread(s) per core:  2
    Core(s) per socket:  12
    Socket(s):           2
    Stepping:            2
    CPU max MHz:         3500.0000
    CPU min MHz:         1200.0000
Caches (sum of all):     
  L1d:                   768 KiB (24 instances)
  L1i:                   768 KiB (24 instances)
  L2:                    6 MiB (24 instances)
  L3:                    60 MiB (2 instances)</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hCFb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hCFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 424w, https://substackcdn.com/image/fetch/$s_!hCFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 848w, https://substackcdn.com/image/fetch/$s_!hCFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 1272w, https://substackcdn.com/image/fetch/$s_!hCFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hCFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png" width="1422" height="948" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:948,&quot;width&quot;:1422,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:248487,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hCFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 424w, https://substackcdn.com/image/fetch/$s_!hCFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 848w, https://substackcdn.com/image/fetch/$s_!hCFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 1272w, https://substackcdn.com/image/fetch/$s_!hCFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332261d5-c053-461d-aef5-cd2d68bcad73_1422x948.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>NLLB and RoBERTa both have a larger vocabulary, so it natural that these take more time to map the input text to corresponding tokens. However, the relationship between the speed of tokenization and vocabulary size is not linear. </p><h3>Conclusion</h3><p>To conclude, in this article I explored the impact of training data and character representation on tokenization discrepancies for byte-based BPE tokenizers across languages. While focusing on the Indo-European language family, the findings suggest that these disparities primarily stem from the models' exposure during training and how characters are represented in unicode.</p><p><strong>Key observations:</strong> </p><ul><li><p>GPT-4 vocabulary differed significantly from NLLB-200-distilled-600M and XML-RoBERTa, both in terms of size and distribution on non-latin tokens.</p></li><li><p>Token length distribution varied across languages, for all the tokenizers. While the variation is not significant for  NLLB-200-distilled-600M and XML-RoBERTa, the token counts for non-latin languages are much higher for GPT-4 tokenizer.</p></li><li><p>GPT-4 tokenizer showed a large discrepancy between grapheme count and token length for non-latin languages.</p></li><li><p>Tokenization speed varied only slightly across the languages for each tokenizer but GPT-4 tokenizer was atleast twice as fast compared to NLLB-200-distilled-600M and XML-RoBERTa tokenizers.</p></li></ul><p><strong>Future considerations:</strong></p><ul><li><p>Investigating the tokenization strategies employed by each model in more detail.</p></li><li><p>Exploring the performance of these models on downstream tasks involving non-Latin languages would be valuable.</p></li><li><p>Explore if a high token count in GPT-4 translates to poor generation and language understanding capbilities.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p></li></ul>]]></content:encoded></item><item><title><![CDATA[Scientific Research Ontology]]></title><description><![CDATA[The primary goal of a research paper is to convince its readers and scientific communities of the novelty and relevance of the study presented in the paper [1].]]></description><link>https://www.icodeformybhasa.com/p/scientific-research-ontology</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/scientific-research-ontology</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sun, 18 Apr 2021 11:22:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!1bBj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The primary goal of a research paper is to convince its readers and scientific communities of the novelty and relevance of the study presented in the paper [1]. Scientific publications are targeted towards a certain community of readers, which is why scientific argumentation takes a predictable structure [2]. In this document, I describe two different models of the structure of scientific texts: rhetorical and argumentative. The nodes we describe here, for both argumentation and rhetorical models, are taken directly from the annotations of the Dr. Inventor corpus [3]. I am working on to find new relations that hold between rhetorical components.</p><h3>Scientific Argumentation</h3><p>In this section I will attempt to describe scientific texts in terms of argumentative components and relations. Argumentative components make the nodes of the argumentation graph and the relations make the arcs.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1bBj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1bBj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 424w, https://substackcdn.com/image/fetch/$s_!1bBj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 848w, https://substackcdn.com/image/fetch/$s_!1bBj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!1bBj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1bBj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg" width="592" height="573.2967032967033" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1410,&quot;width&quot;:1456,&quot;resizeWidth&quot;:592,&quot;bytes&quot;:210650,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1bBj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 424w, https://substackcdn.com/image/fetch/$s_!1bBj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 848w, https://substackcdn.com/image/fetch/$s_!1bBj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!1bBj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0475d4cb-b408-48db-9ee0-a5bca7e39b82_1475x1428.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Hfh8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Hfh8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Hfh8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Hfh8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Hfh8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Hfh8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg" width="598" height="817.6845943482224" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1500,&quot;width&quot;:1097,&quot;resizeWidth&quot;:598,&quot;bytes&quot;:306190,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Hfh8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Hfh8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Hfh8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Hfh8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90c986a2-3108-47de-bb51-daf21f5320d0_1097x1500.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Argumentative Components</h3><p>Dr. Inventor has been annotated for three argumentative components by [4]. The span of these argumentative components are not limited to sentence boundaries. They can be of any length and can span over multiple sentences. The three argumentative components are described below.</p><ol><li><p><strong>Own claims</strong> represent general argumentative statements or claims made by the author that closely relates to the author's own work.</p></li><li><p></p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OC7K!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OC7K!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OC7K!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OC7K!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OC7K!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OC7K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg" width="458" height="207.92445054945054" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:661,&quot;width&quot;:1456,&quot;resizeWidth&quot;:458,&quot;bytes&quot;:87959,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OC7K!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OC7K!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OC7K!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OC7K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e2f906-5351-4e9d-952b-c0f65ad1f760_1489x676.jpeg 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><ol start="2"><li><p><strong>Background claims</strong> are general claims that related to the background of author's work.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AYFM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AYFM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 424w, https://substackcdn.com/image/fetch/$s_!AYFM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 848w, https://substackcdn.com/image/fetch/$s_!AYFM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!AYFM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AYFM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg" width="462" height="259.875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:462,&quot;bytes&quot;:93431,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AYFM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 424w, https://substackcdn.com/image/fetch/$s_!AYFM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 848w, https://substackcdn.com/image/fetch/$s_!AYFM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!AYFM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c7ffb4-6790-42f5-895b-fb5e96fa12c4_1500x844.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol start="3"><li><p><strong>Data</strong> node represents facts and information that support or contest a claim.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qiQV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qiQV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 424w, https://substackcdn.com/image/fetch/$s_!qiQV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 848w, https://substackcdn.com/image/fetch/$s_!qiQV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!qiQV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qiQV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg" width="474" height="211.93269230769232" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:651,&quot;width&quot;:1456,&quot;resizeWidth&quot;:474,&quot;bytes&quot;:74269,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qiQV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 424w, https://substackcdn.com/image/fetch/$s_!qiQV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 848w, https://substackcdn.com/image/fetch/$s_!qiQV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!qiQV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2810eab-55f9-444e-a8d8-eb400de15c77_1500x671.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div></li></ol><h3>Argumentative Relations</h3><p>In the corpus, argumentative relations are composed of two argumentative text units <em>Arg1</em> and <em>Arg2</em>. For our ontology, we plan to introduce a text field for each of the relation arc that contains reasons of the relation. Three argumentative relations type have been defined. They are:</p><ol><li><p><strong>Support</strong> relations hold between two argument components, <em>Arg1</em> and <em>Arg2</em>. <em>Arg1 supports Agr2</em> means <em>Arg1</em> strengthens the claim being made in <em>Arg2</em>. </p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NcbU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NcbU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 424w, https://substackcdn.com/image/fetch/$s_!NcbU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 848w, https://substackcdn.com/image/fetch/$s_!NcbU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!NcbU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NcbU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg" width="618" height="293.61786237188875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:649,&quot;width&quot;:1366,&quot;resizeWidth&quot;:618,&quot;bytes&quot;:86243,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NcbU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 424w, https://substackcdn.com/image/fetch/$s_!NcbU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 848w, https://substackcdn.com/image/fetch/$s_!NcbU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!NcbU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F028433d2-c2fb-4215-8d03-b1b25a0d000d_1366x649.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol start="2"><li><p><strong>Oppose</strong> relations, like support, hold between two argument components, <em>Arg1</em> and <em>Arg2</em>. However, <em>Arg1 opposes Agr2</em> means <em>Arg1</em> weakens the claim being made in <em>Arg2</em>.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rj5I!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rj5I!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 424w, https://substackcdn.com/image/fetch/$s_!rj5I!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 848w, https://substackcdn.com/image/fetch/$s_!rj5I!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!rj5I!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rj5I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg" width="510" height="429.7870879120879" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1227,&quot;width&quot;:1456,&quot;resizeWidth&quot;:510,&quot;bytes&quot;:129008,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rj5I!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 424w, https://substackcdn.com/image/fetch/$s_!rj5I!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 848w, https://substackcdn.com/image/fetch/$s_!rj5I!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!rj5I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a340bf9-6330-48a5-a798-08aaca628d57_1467x1236.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol start="3"><li><p><strong>Sematically </strong>same relations hold between two argument components, <em>Arg1</em> and <em>Arg2</em> that are two occurrences of the same claim or data.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1OnC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1OnC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 424w, https://substackcdn.com/image/fetch/$s_!1OnC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 848w, https://substackcdn.com/image/fetch/$s_!1OnC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!1OnC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1OnC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg" width="568" height="236.0774550484094" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:601,&quot;width&quot;:1446,&quot;resizeWidth&quot;:568,&quot;bytes&quot;:118332,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1OnC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 424w, https://substackcdn.com/image/fetch/$s_!1OnC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 848w, https://substackcdn.com/image/fetch/$s_!1OnC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!1OnC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8db94196-e536-4dff-84b9-a7361b0ff36e_1446x601.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><h3>Rhetorical View of Science</h3><p>Scientific publications are designed to persuade. Persuading a reader of the value and novelty of research being described in a scientific publication requires the author to make different rhetorical moves. Rhetorical view of science views scientific texts as rhetorical objects/components with with a specific rhetorical move. These rhetorical components are described in this section.</p><h4>Rhetorical Components</h4><p>Rhetorical components are sentences that serve different rhetorical roles in writings. Sentences in Dr. Inventor has been annotated for rhetorical roles. The span of a rhetorical component is limited to sentence boundaries and no relation has been defined between these components. Based on the Dr. Inventor annotations we have the following eight different rhetorical components.</p><ol><li><p><strong>Background:</strong> Represents sentences that help to understand the overall problem that is being addressed in the publication. These include sentences that describe the commonly accepted knowledge and related work in the area of research.</p><p><em>Example: An early contribution concerning the animation of deformable objects is [Magnenat-Thalmann et al. 1988], which considers the movement of a human hand.</em></p></li><li><p><strong>Approach:</strong> Sentences describe the models, frameworks, and experimental setup of investigation of the research discussed in the publication.</p><p><em>Example: Our basic idea is to change the interpolation domain: we interpolate transformations itself instead of transformed vertex positions.</em></p></li><li><p><strong>Challenge:</strong> Describes the problem statement, current challenge, and gap in the area of research and motivation of the study.</p><p><em>Example: Although LBS is very fast and advantageous to graphics hardware, it suffers from inherent artifacts, known as &#8221;collapsing joints&#8221;, &#8221;twisting elbow problem&#8221; or a &#8221;candy-wrapper artifact&#8221;.</em></p></li><li><p><strong>Challenge_Hypothesis:</strong> Represents sentences that describe a current challenge and how it can possibly be addressed.</p><p><em>Example: We observe that we can help avoid the collapse problem by avoiding blending transformations that are so dissimilar.</em></p></li><li><p><strong>Challenge_Goal:</strong> The sentences that describe the current challenge/gap that is being addressed in the publication.</p><p><em>Example: The paper discusses also theoretical properties of rotation interpolation, essential to spherical blend skinning.</em></p></li><li><p><strong>Outcome:</strong> Includes sentences that describe the findings of the research.</p><p><em>Example: For small deformations, both algorithms produce similar results, as in the second row of Figure 6 (although a small loss of volume is noticeable even there).</em></p></li><li><p><strong>Outcome_Contribution:</strong> Special outcome sentences that describe how the research contributes to the area of research.</p><p><em>Example: In contrast to other methods, the SBS does not need any additional information, such as the example skins.</em></p></li><li><p><strong>Future Work:</strong> Describes the future research that can be done to improve the solution described in the publication.</p><p><em>Example: It would be interesting to find out how much can be the SBS results improved by a set of weights especially designed for SBS.</em></p></li></ol><h3>References</h3><p>[1] Swales, J. M. (1990). Genre analysis: English in academic and research settings. Cambridge University Press.</p><p>[2] Kintsch, W., &amp; van Dijk, T. A. (1978). Toward a model of text comprehension and production. Psychological review, 85(5), 363.</p><p>[3] Fisas, B., &amp; Padr&#243;, L. (2016). Multi-level annotation of rhetorical entities, relations and structures in scientific articles. In Proceedings of the 10th Linguistic Annotation Workshop (pp. 102-111).</p><p>[4] Lauscher, A., &amp; Glava&#353;, G. (2018). Argument Component Annotation: Towards Efficient Argument Analysis and Retrieval in Large Corpora. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP) (pp. 2558-2569).</p>]]></content:encoded></item><item><title><![CDATA[Understanding Toulmin Argumentation]]></title><description><![CDATA[Argumentation is core to human communication and decision-making processes.]]></description><link>https://www.icodeformybhasa.com/p/understanding-toulmin-argumentation</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/understanding-toulmin-argumentation</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Thu, 10 Dec 2020 20:06:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fd7d5f9c-fba2-4c1e-b61a-e954a62b25e1_940x788.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Argumentation is core to human communication and decision-making processes. Developed by philosopher Stephen Toulmin, the Toulmin model of Argumentation theory is an influential work in the field. This model provides a framework for analyzing and constructing arguments.</p><h3>What is the Toulmin Model? </h3><p>The Toulmin model presents arguments as more than just statements of fact or opinion. It models the complex interplay of claims, evidence, warrants, backing, qualifiers, and rebuttals that make up arguments. The Toulmin model emphasizes on the importance of reasoning and evidence in supporting claims. It also provides a systematic approach to evaluating the strength of arguments. </p><h3>Key Components of the Toulmin Model</h3><p>The Toulmin model identifies six components in arguments:</p><ol><li><p>Claim: The assertion that the arguer seeks to demonstrate.</p></li><li><p>Data: The grounds that support the claim. This can include facts, statistics, examples, anecdotes, and expert opinions.</p></li><li><p>Warrant: The implicit assumption or explicit reasoning that connects the data to the claim. </p></li><li><p>Backing: Additional evidence or reasoning that supports the warrant. In cases where warrants are implied, backing provides support for the warrant by giving additional justification. </p></li><li><p>Qualifier: The qualifier specifies the degree of certainty associated with the claim. It acknowledges the limitations or conditions under which the claim may be valid.</p></li><li><p>Rebuttal: Counterarguments that challenge the claim. Rebuttals anticipate potential objections and address them preemptively.</p></li></ol><h3>Application of the Toulmin Model</h3><p>The Toulmin model can be applied to variety of contexts. Some common examples includes academic writing, persuasive speeches, and legal arguments. By identifying and analyzing the components of an argument, individuals can evaluate the strengths and weaknesses of different positions and construct more effective arguments.</p><p>Writers/speakers can use the model to develop clear and coherent arguments, provide sufficient evidence to support their claims, and anticipate and address potential objections. The Toulmin model provides a structured approach for crafting compelling arguments.</p><h3>Example</h3><p>In the following example, I try to use Toulmin model to argue why investing in low-resource language technologies is important in ensuring inclusivity and bridging the global digital divide.</p><p><strong>Claim:</strong> Investing in low-resource language technologies is critical for fostering linguistic diversity and ensuring digital inclusivity worldwide.</p><p><strong>Grounds:</strong> Presently, a considerable segment of the global population lacks adequate access to computing resources, primarily due to language disparities and limited technological infrastructure. Studies by UNESCO reveal that over half of the world's languages face the risk of extinction by the century's end, with many spoken by marginalized communities lacking technological access.</p><p><strong>Warrant:</strong> Through investments in low-resource language support, we can develop tools and resources tailored to the diverse linguistic needs of populations worldwide. Such efforts would enable individuals from all linguistic backgrounds to access information, and engage in digital communication.</p><p><strong>Backing:</strong> Initiatives such as the Global Voices project and UNESCO's efforts to promote linguistic diversity highlight the importance of supporting low-resource languages in digital environments. These endeavors aim to develop NLP technologies that cater to diverse linguistic needs, enabling individuals from all backgrounds to access and contribute to digital content.</p><p><strong>Qualifier:</strong> Although investing in low-resource language support may require initial funding and collaborative efforts among various stakeholders, the long-term benefits are manifold. By ensuring equitable access to language technologies, we can promote linguistic diversity, preserve cultural heritage, and foster social inclusion globally.</p><p><strong>Rebuttal:</strong> Some may argue against investing in low-resource language support, citing concerns about cost-effectiveness compared to focusing on widely spoken languages or commercially lucrative markets. However, this perspective overlooks the ethical obligation to provide equitable access to technological advancements and digital opportunities, irrespective of linguistic backgrounds or geographical locations.</p>]]></content:encoded></item><item><title><![CDATA[Derivation in Nepali]]></title><description><![CDATA[In linguistics, the formation of new words from free morphemes is a very common process.]]></description><link>https://www.icodeformybhasa.com/p/an-introduction-to-derivation-in</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/an-introduction-to-derivation-in</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Wed, 20 Dec 2017 00:33:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/24236fe9-a17b-4cfb-8edd-1b0e3a593c6d_1267x942.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In linguistics, the formation of new words from free morphemes is a very common process. The process of word formation (&#2358;&#2348;&#2381;&#2342;&#2344;&#2367;&#2352;&#2381;&#2350;&#2366;&#2339; / &#2358;&#2348;&#2381;&#2342;&#2352;&#2330;&#2344;&#2366;) in Nepali can be divided into inflection (&#2352;&#2369;&#2346;&#2366;&#2351;&#2344;) and derivation (&#2357;&#2381;&#2351;&#2369;&#2340;&#2381;&#2346;&#2366;&#2342;&#2344;). In this blog post, we'll briefly discuss derivation and its types in Nepali.</p><p>You can read about inflections in Nepali at:</p><ul><li><p><a href="https://icodeformybhasa.github.io/intro-to-written-nepali">Exploring the Building Blocks: A Simple Guide to Morphemes in Nepali</a></p></li><li><p><a href="https://icodeformybhasa.github.io/nominal-inflection-in-nepali">Nominal Inflections: The Morphological Adaptations of Nepali Nouns, Pronouns and Adjectives</a></p></li><li><p><a href="https://icodeformybhasa.github.io/verbal-inflections-in-nepali">Verbal Inflections: The Varied Forms of Nepali Verbs</a></p></li></ul><h2><strong>Derivation in Nepali</strong></h2><p>Derivation is a process of forming new words from existing roots. In contrast to inflection, which is a process of word formation that maintains the lexical category of the root, derivation can change the lexical category of the root. Derivation in Nepali is a highly productive process. It can be categorized into four types:</p><ul><li><p>Affixation (&#2360;&#2352;&#2381;&#2327; &#2346;&#2381;&#2352;&#2325;&#2381;&#2352;&#2367;&#2351;&#2366;)</p></li><li><p>Compounding (&#2360;&#2350;&#2366;&#2360; &#2346;&#2381;&#2352;&#2325;&#2381;&#2352;&#2367;&#2351;&#2366;)</p></li><li><p>Reduplication (&#2342;&#2381;&#2357;&#2367;&#2340;&#2381;&#2351; &#2346;&#2381;&#2352;&#2325;&#2381;&#2352;&#2367;&#2351;&#2366;)</p></li><li><p>Euphonic Combination (&#2360;&#2344;&#2381;&#2343;&#2367; &#2346;&#2381;&#2352;&#2325;&#2381;&#2352;&#2367;&#2351;&#2366;)</p></li></ul><h2><strong>Affixation</strong></h2><p>Affixation is the process of word formation by attaching free morphemes - affixes - to the roots. In Nepali, there are two types of affixes: prefix (&#2313;&#2346;&#2360;&#2352;&#2381;&#2327;) and suffix (&#2346;&#2381;&#2352;&#2340;&#2381;&#2351;&#2351;) and hence, the two type of affixation namely, prefixation and suffixation.</p><pre><code><code># Suffixation
&#2312;&#2326; + &#2310;&#2354;&#2369; = &#2312;&#2326;&#2366;&#2354;&#2369;
&#2346;&#2361;&#2366;&#2337; + &#2311;&#2351;&#2366; = &#2346;&#2361;&#2366;&#2337;&#2367;&#2351;&#2366;
&#2346;&#2370;&#2352;&#2381;&#2357; + &#2319;&#2354;&#2368; = &#2346;&#2370;&#2352;&#2381;&#2357;&#2375;&#2354;&#2368;

# Prefixation
&#2309;&#2343;&#2367; + &#2325;&#2371;&#2340; = &#2309;&#2343;&#2367;&#2325;&#2371;&#2340;
&#2313;&#2346; + &#2344;&#2366;&#2350; = &#2313;&#2346;&#2344;&#2366;&#2350;
&#2342;&#2369;&#2360;&#2381; + &#2360;&#2366;&#2361;&#2360; = &#2342;&#2369;&#2360;&#2381;&#2360;&#2366;&#2361;&#2360;
</code></code></pre><h4><strong>Suffixation</strong></h4><p>Suffixation is a process of word formation by the addition of bound morpheme to the end of the root. The bound morpheme involved in suffixation is called suffix (&#2346;&#2381;&#2352;&#2340;&#2381;&#2351;&#2351;/&#2346;&#2352;&#2360;&#2352;&#2381;&#2327;). On the basis of the root they attach to, there are two types of suffixes in Nepali and they are:</p><ul><li><p>Primary Suffix (&#2325;&#2371;&#2340;&#2381; &#2346;&#2381;&#2352;&#2340;&#2381;&#2351;&#2351;)</p></li><li><p>Secondary Suffix (&#2340;&#2342;&#2381;&#2357;&#2367;&#2340; &#2346;&#2381;&#2352;&#2340;&#2381;&#2351;&#2351;)</p></li></ul><p>A&nbsp;<strong>primary suffix (&#2325;&#2371;&#2340;&#2381; &#2346;&#2381;&#2352;&#2340;&#2381;&#2351;&#2351;)</strong>&nbsp;is added to the end of a verb root to form a primary derivative word (&#2325;&#2371;&#2342;&#2344;&#2381;&#2340; &#2358;&#2348;&#2381;&#2342;). A primary derivative word belongs to noun (&#2344;&#2366;&#2350;), verb (&#2325;&#2381;&#2352;&#2367;&#2351;&#2366;&#2346;&#2342;), adjective (&#2357;&#2367;&#2358;&#2375;&#2359;&#2339;) or adverb (&#2325;&#2381;&#2352;&#2367;&#2351;&#2366;&#2357;&#2367;&#2358;&#2375;&#2359;&#2339;).</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/GySns/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11951f85-2135-4643-b683-30de3ccf9652_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:523,&quot;title&quot;:&quot;Table 1: Examples of Primary Derivation&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/GySns/1/" width="730" height="523" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>A&nbsp;<strong>secondary suffix (&#2340;&#2342;&#2381;&#2357;&#2367;&#2340; &#2346;&#2381;&#2352;&#2340;&#2381;&#2351;&#2351;)</strong>&nbsp;can be applied to anything but a verb root to form a secondary derivative word (&#2340;&#2342;&#2381;&#2357;&#2367;&#2340;&#2366;&#2344;&#2381;&#2340; &#2358;&#2348;&#2381;&#2342;). Such suffixes act on noun, pronoun, adjective, adverb and primary derivative word.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/VBRgG/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/303ce6de-d860-4222-89cf-267df9871700_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:613,&quot;title&quot;:&quot;Table 2: Examples of Secondary Derivation&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/VBRgG/1/" width="730" height="613" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>On the basis of their ability to maintain or change the lexical category of the base they get attached to, suffixes in Nepali can be of two types. They are:</p><ul><li><p>Class Maintaining Suffix</p></li><li><p>Class Changing Suffix</p></li></ul><p>A&nbsp;<strong>class maintaining suffix</strong>&nbsp;maintains the lexical category of the root after suffixation. Some of the class maintaining suffixes in Nepali are given in Table 3.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/BGU8K/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8e1c4235-7c7a-4485-ac32-67ca760902a2_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:352,&quot;title&quot;:&quot;Table 3: Examples of Class Maintaining Suffixation&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/BGU8K/1/" width="730" height="352" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>A&nbsp;<strong>class changing suffix</strong>&nbsp;changes the lexical category of the root after suffixation. Some of the class maintaining suffixes in Nepali are given in Table 4.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/gsMBQ/2/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f8680b06-34de-4a8b-ba82-227e3e18c393_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:492,&quot;title&quot;:&quot;Table 4: Examples of Class Changing Suffixation&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/gsMBQ/2/" width="730" height="492" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h4><strong>Prefixation</strong></h4><p>Prefixation is the process of word formation in which a bound morpheme is attached to the beginning of a root. Prefix (&#2313;&#2346;&#2360;&#2352;&#2381;&#2327;) is the bound morpheme which is involved in the process of prefixation. In Nepali, the process of prefixation produces noun, adjective and adverb only.</p><p>Prefixes in Nepali can have various effects in the meaning of the base they get attached to. Some of the possible effects of prefixation on meaning of the root are listed below.</p><ul><li><p>Express the lack of</p></li><li><p>Express too much of</p></li><li><p>Express negative meaning of the root</p></li><li><p>Add special meaning to</p></li></ul><p>Prefixes in Nepali can be divided into three types and they are:</p><ul><li><p>Prefixes from Sanskrit (&#2340;&#2340;&#2381;&#2360;&#2350; &#2313;&#2346;&#2360;&#2352;&#2381;&#2327;)</p></li><li><p>Prefixes from Nepali (&#2340;&#2340;&#2381;&#2349;&#2357; &#2313;&#2346;&#2360;&#2352;&#2381;&#2327;)</p></li><li><p>Prefixes from other sources (&#2310;&#2327;&#2344;&#2381;&#2340;&#2369;&#2325; &#2313;&#2346;&#2360;&#2352;&#2381;&#2327;)</p></li></ul><p><strong>Prefixes from Sanskrit</strong>&nbsp;are the prefixes that are taken from Sanskrit language. Some of such prefixes and their meanings are given in Table 5.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/EHJHm/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ee7d9073-074a-4e76-92ef-36bcf6929dbd_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:512,&quot;title&quot;:&quot;Table 5: Prefixes from Sanskrit and their Meanings&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/EHJHm/1/" width="730" height="512" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p><strong>Prefixes from Nepali</strong>&nbsp;are the prefixes that are from Nepali language itself. Some of such prefixes and their meanings are given in Table 6.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/fcVf6/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f39092c0-3dfb-4f48-a49c-e404f7662c4e_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:422,&quot;title&quot;:&quot;Table 6: Prefixes from Nepali and their Meanings&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/fcVf6/1/" width="730" height="422" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p><strong>Prefixes from other sources</strong>&nbsp;are the type of prefixes that are taken from sources other than Sanskrit and Nepali. Some of such prefixes and their meanings are given in Table 7.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/Jg6ZR/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0a31c63c-1c6c-4dc5-9833-66df2e35c422_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:428,&quot;title&quot;:&quot;Table 7: Prefixes from other sources and their Meanings&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/Jg6ZR/1/" width="730" height="428" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h2><strong>Compounding</strong></h2><p>Compounding occurs when two or more words combine to form a new word. In Nepali, there are six types of compounding, all of which are listed below:</p><ul><li><p>Determinative Compound (&#2340;&#2340;&#2381;&#2346;&#2369;&#2352;&#2369;&#2360; &#2360;&#2350;&#2366;&#2360;)</p></li><li><p>Numeral Compound (&#2342;&#2381;&#2357;&#2367;&#2327;&#2369; &#2360;&#2350;&#2366;&#2360;)</p></li><li><p>Appositional Compound (&#2325;&#2352;&#2381;&#2350;&#2343;&#2366;&#2352;&#2351; &#2360;&#2350;&#2366;&#2360;)</p></li><li><p>Adverbial Compound (&#2309;&#2357;&#2381;&#2351;&#2381;&#2351;&#2368;&#2349;&#2366;&#2357; &#2360;&#2350;&#2366;&#2360;)</p></li><li><p>Attributive Compound (&#2348;&#2361;&#2369;&#2348;&#2381;&#2352;&#2368;&#2361;&#2367; &#2360;&#2350;&#2366;&#2360;)</p></li><li><p>Copulative Compound (&#2342;&#2381;&#2357;&#2344;&#2381;&#2342;&#2381;&#2357; &#2360;&#2350;&#2366;&#2360;)</p></li></ul><pre><code><code>Determinative Compounding
&#2325;&#2366;&#2350;&#2354;&#2366;&#2312; &#2330;&#2379;&#2352; = &#2325;&#2366;&#2350;&#2330;&#2379;&#2352;
&#2332;&#2327;&#2381;&#2327;&#2366;&#2325;&#2379; &#2343;&#2344;&#2368; = &#2332;&#2327;&#2381;&#2327;&#2366;&#2343;&#2344;&#2368;
&#2349;&#2379;&#2325;&#2354;&#2375; &#2350;&#2352;&#2368; = &#2349;&#2379;&#2325;&#2350;&#2352;&#2368;
&#2352;&#2379;&#2327;&#2348;&#2366;&#2335; &#2350;&#2369;&#2325;&#2381;&#2340; = &#2352;&#2379;&#2327;&#2350;&#2369;&#2325;&#2381;&#2340;

Numeral Compounding
&#2360;&#2366;&#2340; &#2325;&#2379;&#2360;&#2368;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; = &#2360;&#2346;&#2381;&#2340;&#2325;&#2379;&#2360;&#2368;
&#2346;&#2366;&#2305;&#2330;&#2357;&#2335;&#2366; &#2346;&#2340;&#2381;&#2352;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; = &#2346;&#2334;&#2381;&#2330;&#2346;&#2366;&#2340;&#2381;&#2352;&#2379;
&#2330;&#2366;&#2352; &#2326;&#2339;&#2381;&#2337;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; = &#2330;&#2380;&#2326;&#2339;&#2381;&#2337;

Appositional Compounding
&#2347;&#2369;&#2347;&#2370; + &#2342;&#2367;&#2342;&#2368; = &#2347;&#2369;&#2347;&#2370;&#2342;&#2367;&#2342;&#2368;
&#2310;&#2350;&#2366; + &#2331;&#2379;&#2352;&#2368; = &#2310;&#2350;&#2366;&#2331;&#2379;&#2352;&#2368; 
&#2346;&#2381;&#2352;&#2367;&#2351; + &#2332;&#2344; = &#2346;&#2381;&#2352;&#2367;&#2351;&#2332;&#2344;

Adverbial Compounding
&#2351;&#2340;&#2366; + &#2313;&#2340;&#2366; = &#2351;&#2340;&#2366;&#2313;&#2340;&#2366;
&#2343;&#2381;&#2351;&#2366;&#2344; + &#2346;&#2370;&#2352;&#2381;&#2357;&#2325; = &#2343;&#2381;&#2351;&#2366;&#2344;&#2346;&#2370;&#2352;&#2381;&#2357;&#2325;
&#2351;&#2360; + &#2309;&#2352;&#2381;&#2341; = &#2351;&#2360;&#2352;&#2381;&#2341;

Attributive Compounding
&#2354;&#2366;&#2350;&#2379; &#2346;&#2366;&#2340; &#2349;&#2319;&#2325;&#2379; = &#2354;&#2350;&#2346;&#2366;&#2340;&#2375;
&#2330;&#2366;&#2352;&#2357;&#2335;&#2366; &#2350;&#2369;&#2326; &#2349;&#2319;&#2325;&#2379; = &#2330;&#2380;&#2350;&#2369;&#2326;&#2368;
&#2354;&#2366;&#2332; &#2344;&#2349;&#2319;&#2325;&#2379; = &#2344;&#2367;&#2352;&#2381;&#2354;&#2332;&#2381;&#2332;

Copulative Compounding
&#2330;&#2366;&#2354; &#2352; &#2330;&#2354;&#2344; = &#2330;&#2366;&#2354;&#2330;&#2354;&#2344; 
&#2340;&#2354; &#2352; &#2350;&#2366;&#2341;&#2367; = &#2340;&#2354;&#2350;&#2366;&#2341;&#2367; 
&#2343;&#2344; &#2352; &#2360;&#2350;&#2381;&#2346;&#2340;&#2381;&#2340;&#2367; = &#2343;&#2344;&#2360;&#2350;&#2381;&#2346;&#2340;&#2381;&#2340;&#2367;
</code></code></pre><h4><strong>Determinative Compound</strong></h4><p>A&nbsp;<strong>determinative compound</strong>&nbsp;is formed when the first word loses its case marker (&#2357;&#2367;&#2349;&#2325;&#2381;&#2340;&#2367; &#2330;&#2367;&#2344;&#2381;&#2361;) when combining with the second root. Such compounds express the meaning of the second root and the meaning of the first word is lost in the process. There are six types of determinative compounds, all of which are listed and described in Table 8.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/HNE5E/3/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b87f04bf-17e3-46b7-9303-043b64dd8802_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:739,&quot;title&quot;:&quot;Table 8: Determinative Compound&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/HNE5E/3/" width="730" height="739" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h4><strong>Numeral Compound</strong></h4><p>When a&nbsp;<strong>numeral adjective (&#2360;&#2329;&#2381;&#2326;&#2381;&#2351;&#2366;&#2357;&#2366;&#2330;&#2325; &#2357;&#2367;&#2358;&#2375;&#2359;&#2339;)</strong>&nbsp;and&nbsp;<strong>collective noun (&#2360;&#2350;&#2370;&#2361;&#2357;&#2366;&#2330;&#2325; &#2344;&#2366;&#2350;)</strong>&nbsp;combine, a numeral compound is formed. Some of such compounds are given below:</p><pre><code><code>Independent Form =&gt; Compound Word
&#2344;&#2380; &#2327;&#2375;&#2337;&#2366;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; =&gt; &#2344;&#2380;&#2327;&#2375;&#2337;&#2368;
&#2310;&#2336; &#2310;&#2344;&#2366;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; =&gt; &#2309;&#2336;&#2344;&#2381;&#2344;&#2368;
&#2340;&#2368;&#2344; &#2325;&#2379;&#2339;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; =&gt; &#2340;&#2381;&#2352;&#2367;&#2325;&#2379;&#2339;
&#2360;&#2366;&#2340; &#2315;&#2359;&#2367;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; =&gt; &#2360;&#2346;&#2381;&#2340;&#2315;&#2359;&#2367;
&#2344;&#2380;&#2357;&#2335;&#2366; &#2352;&#2366;&#2340;&#2381;&#2352;&#2367;&#2325;&#2379; &#2360;&#2350;&#2370;&#2361; =&gt; &#2344;&#2357;&#2352;&#2366;&#2340;&#2381;&#2352;&#2368;
</code></code></pre><h4><strong>Appositional Compound</strong></h4><p>An&nbsp;<strong>appositional compound</strong>&nbsp;is formed when:</p><ul><li><p>An adjective (&#2357;&#2367;&#2358;&#2375;&#2359;&#2339;) combines with an adjective</p></li><li><p>A noun (&#2344;&#2366;&#2350;) combines with a noun</p></li><li><p>An adjective combines with a noun</p></li><li><p>A metaphor (&#2313;&#2346;&#2350;&#2366;) combines with a word to be compared (&#2313;&#2346;&#2350;&#2375;&#2351;)</p></li><li><p>An attribute (&#2310;&#2352;&#2379;&#2346;) combines with a word to be attributed (&#2310;&#2352;&#2379;&#2346;&#2381;&#2351;)</p></li></ul><p>All the independent words forming an appositional compound have equal importance. Types and example of appositional compounds are given in Table 9.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/dVbGc/2/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93a0341e-85ef-410a-bf87-9f7d3d326772_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:357,&quot;title&quot;:&quot;Table 9: Appositional Compound&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/dVbGc/2/" width="730" height="357" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h4><strong>Adverbial Compound</strong></h4><p>An&nbsp;<strong>adverbial compound</strong>&nbsp;is usually an indeclinable word (&#2309;&#2357;&#2381;&#2351;&#2351;) formed when two indeclinable words or any other words combine. Some of such compounds are listed below:</p><pre><code><code>Independent Form =&gt; Compound Word
&#2310;&#2332; + &#2349;&#2379;&#2354;&#2367; =&gt; &#2310;&#2332;&#2349;&#2379;&#2354;&#2367;
&#2348;&#2367;&#2344;&#2366; + &#2346;&#2376;&#2360;&#2366; =&gt; &#2348;&#2367;&#2344;&#2366;&#2346;&#2376;&#2360;&#2366;
&#2352;&#2366;&#2340; + &#2342;&#2367;&#2344; =&gt; &#2352;&#2366;&#2340;&#2342;&#2367;&#2344;
&#2347;&#2354; + &#2360;&#2381;&#2357;&#2352;&#2370;&#2346; =&gt; &#2347;&#2354;&#2360;&#2381;&#2357;&#2352;&#2370;&#2346;
&#2351;&#2360; + &#2325;&#2366;&#2352;&#2339; =&gt; &#2351;&#2360;&#2325;&#2366;&#2352;&#2339;
</code></code></pre><h4><strong>Attributive Compound</strong></h4><p>An&nbsp;<strong>attributive compound</strong>&nbsp;is an adjective, which is formed when two or more words combine. An attributive compound expresses a new meaning, which is different from that of the independent words. The types of attributive compound are described in Table 10.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/tlttq/2/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c137d3fd-126c-4ac6-9884-c14e05aef659_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:563,&quot;title&quot;:&quot;Table 10: Attributive Compound&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/tlttq/2/" width="730" height="563" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h4><strong>Copulative Compound</strong></h4><p><strong>Copulative compounds</strong>&nbsp;are formed when two or more words connected by a conjunction combine by losing the conjunction. The types of copulative compound are listed in Table 11.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/6IBoI/3/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/51f77ab2-e5a8-48c0-bd94-cd22951a0dbd_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:727,&quot;title&quot;:&quot;Table 11:  Copulative Compound&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/6IBoI/3/" width="730" height="727" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h2><strong>Reduplication</strong></h2><p>Reduplication (&#2342;&#2381;&#2357;&#2367;&#2340;&#2381;&#2357;) means repetition. It is a process of word formation in which a root or a part of the root repeats in order to derive a new word. Reduplication can be classified into three distinct types and they are:</p><ul><li><p>Total Reduplication (&#2346;&#2370;&#2352;&#2381;&#2339; &#2342;&#2381;&#2357;&#2367;&#2340;&#2381;&#2357;)</p></li><li><p>Partial Reduplication (&#2310;&#2306;&#2358;&#2367;&#2325; &#2342;&#2381;&#2357;&#2367;&#2340;&#2381;&#2357;)</p></li><li><p>Echo Reduplication (&#2310;&#2346;&#2352;&#2367;&#2357;&#2352;&#2381;&#2340;&#2367;&#2340; &#2342;&#2381;&#2357;&#2367;&#2340;&#2381;&#2357;)</p></li></ul><pre><code><code>Total Reduplication
&#2348;&#2366;&#2335;&#2379; + &#2348;&#2366;&#2335;&#2379; = &#2348;&#2366;&#2335;&#2376;&#2348;&#2366;&#2335;&#2379;
&#2340;&#2366;&#2344; + &#2340;&#2366;&#2344; = &#2340;&#2366;&#2344;&#2366;&#2340;&#2366;&#2344;
&#2340;&#2305; + &#2340;&#2305; = &#2340;&#2305;&#2340;&#2305;

Partial Reduplication
&#2360;&#2350;&#2381;&#2350;&#2366;&#2344; + &#2360;&#2350;&#2381;&#2350;&#2366;&#2344; = &#2360;&#2360;&#2350;&#2381;&#2350;&#2366;&#2344;
&#2333;&#2327;&#2337;&#2366; + &#2333;&#2327;&#2337;&#2366; = &#2333;&#2376;&#2333;&#2327;&#2337;&#2366;
&#2340;&#2351;&#2366;&#2352; + &#2340;&#2351;&#2366;&#2352; = &#2340;&#2350;&#2381;&#2340;&#2351;&#2366;&#2352;

Echo Reduplication
&#2340;&#2375;&#2354; + &#2340;&#2375;&#2354; = &#2340;&#2375;&#2354;&#2360;&#2375;&#2354;
&#2326;&#2335;&#2344; + &#2326;&#2335;&#2344; = &#2326;&#2335;&#2344;&#2346;&#2335;&#2344;
&#2328;&#2352; + &#2328;&#2352; = &#2328;&#2352;&#2360;&#2352;
</code></code></pre><h4><strong>Total Reduplication</strong></h4><p>New words are formed when an entire word repeats in the process of word formation. Such words express varied levels of intensity to the meaning represented by the root. Some of such compounds are given below:</p><pre><code><code>Independent Form =&gt; Compound Word
&#2326;&#2354; &#2326;&#2354; =&gt; &#2326;&#2354;&#2326;&#2354;
&#2326;&#2375;&#2342; &#2326;&#2375;&#2342; =&gt; &#2326;&#2375;&#2342;&#2366;&#2326;&#2375;&#2342;
&#2340;&#2366;&#2344; &#2340;&#2366;&#2344; =&gt; &#2340;&#2366;&#2344;&#2366;&#2340;&#2366;&#2344;
</code></code></pre><h4><strong>Partial Reduplication</strong></h4><p>In partial reduplication, only a part of a word is repeated to form a new word. Some of such compounds are given below:</p><pre><code><code>Independent Form =&gt; Compound Word
&#2333;&#2327;&#2337;&#2366; &#2333;&#2327;&#2337;&#2366; =&gt; &#2333;&#2376;&#2333;&#2327;&#2337;&#2366;
&#2325;&#2360;&#2354;&#2375; &#2325;&#2360;&#2354;&#2375; =&gt; &#2325;-&#2325;&#2360;&#2354;&#2375;
&#2360;&#2354;&#2381;&#2354;&#2366;&#2361; &#2360;&#2354;&#2381;&#2354;&#2366;&#2361; =&gt; &#2360;&#2352;&#2360;&#2354;&#2381;&#2354;&#2366;&#2361;
</code></code></pre><h4><strong>Echo Reduplication</strong></h4><p>A word formed due to echo reduplication is similar to the one formed due to total reduplication. The only difference is that the initial syllable of the second copy of the root replaced by a similar sounding substring. The process of echo reduplication expresses higher level of intensity to the meaning of the root. Some of such compounds are given below.</p><pre><code><code>Independent Form =&gt; Compound Word
&#2325;&#2375;&#2335;&#2379; &#2325;&#2375;&#2335;&#2379; =&gt; &#2325;&#2375;&#2335;&#2379;&#2360;&#2375;&#2335;&#2379;
&#2344;&#2352;&#2350; &#2344;&#2352;&#2350; =&gt; &#2344;&#2352;&#2350;&#2325;&#2352;&#2350;
&#2335;&#2366;&#2354;&#2381; &#2335;&#2366;&#2354;&#2381; =&gt; &#2335;&#2366;&#2354;&#2335;&#2369;&#2354;</code></code></pre><h2><strong>Euphonic Combination</strong></h2><p>Euphonic Combination is the joining of two phonemes from two different words to derive a single word. In Nepali, we can find two different categories of the euphonic combination. The first category contains all the types of euphonic combination taken from Sanskrit (&#2340;&#2340;&#2381;&#2360;&#2350; &#2360;&#2344;&#2381;&#2343;&#2367;) as Nepali is one of the languages which is derived from Sanskrit. The other category contains the types of euphonic combination specific to Nepali language (&#2340;&#2340;&#2381;&#2349;&#2357; &#2360;&#2344;&#2381;&#2343;&#2367;).</p><pre><code><code>Sanskrit Euphonic Combination
&#2313;&#2346; + &#2309;&#2343;&#2381;&#2351;&#2325;&#2381;&#2359; = &#2313;&#2346;&#2366;&#2343;&#2381;&#2351;&#2325;&#2381;&#2359;
&#2350;&#2361;&#2366; + &#2311;&#2344;&#2381;&#2342;&#2381;&#2352; = &#2350;&#2361;&#2375;&#2344;&#2381;&#2342;&#2381;&#2352;
&#2309;&#2343;&#2367; + &#2310;&#2340;&#2381;&#2350;&#2366; = &#2309;&#2343;&#2381;&#2351;&#2366;&#2340;&#2381;&#2350;

Nepali Euphonic Combination
&#2350;&#2379;&#2335;&#2366; + &#2310;&#2311; = &#2350;&#2379;&#2335;&#2366;&#2311; 
&#2332;&#2366;&#2313; + &#2309;&#2340; = &#2332;&#2366;&#2357;&#2340;
&#2352;&#2366;&#2340;&#2368; + &#2323;&#2354;&#2368; = &#2352;&#2340;&#2381;&#2351;&#2380;&#2354;&#2368;</code></code></pre><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Negation in Nepali Verbs]]></title><description><![CDATA[Negation is used to express the opposite meaning of affirmative sentences.]]></description><link>https://www.icodeformybhasa.com/p/negation-in-nepali-verbs</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/negation-in-nepali-verbs</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sun, 19 Nov 2017 21:52:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/bd350289-5627-4b15-a035-79909d940d80_1024x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Negation is used to express the opposite meaning of affirmative sentences. Negation in Nepali verbs takes place due to affixation(suffixation and prefixation). The negative case marker &#2344;(na) is either prefixed or suffixed with verb roots or verb forms to express negation.</p><h2><strong>Negation due to Prefixation</strong></h2><p>Negation in some verb forms occurs when the morpheme &#2344;(na) is prefixed to the verbs. Some of such verb forms are given below.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/WEvkH/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/38490399-0d74-4d8a-b7b4-e9a8183852be_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:612,&quot;title&quot;:&quot;Table 1: Negation in Nepali Verbs due to Prefixation&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/WEvkH/1/" width="730" height="612" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h2><strong>Negation due to Suffixation</strong></h2><p>Negation in Nepali verbs can also occur due to suffixation of the morpheme &#2344;(na) to verb forms/ verb roots. The morpheme can occur either at the end or in the middle of the negated verb.</p><p>For the following verb forms, negation occurs due to suffixation.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/YlWZe/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/103a6b09-696c-46d8-bc93-5f9d6a08637e_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:371,&quot;title&quot;:&quot;Table 2: Negation in Nepali Verbs due to Suffixation&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/YlWZe/1/" width="730" height="371" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h2><strong>References</strong></h2><p><a href="https://ojs.ub.uni-konstanz.de/jsal/dissertations/diss-balaram.pdf">A Computational Analysis of Nepali Morphology: A Model for Natural Language Processing</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Verbal Inflections: The Varied Forms of Nepali Verbs]]></title><description><![CDATA[In Nepali, verbs exhibit rich inflectional patterns, allowing for intricate nuances in meaning and expression.]]></description><link>https://www.icodeformybhasa.com/p/verbal-inflections-the-varied-forms</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/verbal-inflections-the-varied-forms</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Fri, 11 Aug 2017 17:56:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/85abf5e1-a370-42af-8c70-f81c5271b359_514x283.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Nepali, verbs exhibit rich inflectional patterns, allowing for intricate nuances in meaning and expression. This richness stems from the language's extensive conjugation system, where verbs undergo various inflectional changes to convey details such as tense, aspect, mood, person, number, and honorifics. The combination of suffixation and sometimes auxiliary verbs enables Nepali verbs to capture a wide array of cultural nuances. For example, verbs can inflect to denote not only the time of an action but also its duration, completion status, and the speaker's attitude towards it. Additionally, Nepali verbs also inflect for honorifics to reflects the speaker's respect for the subject.</p><p>Nepali verbs inflect to encode: Tense, Aspect, Mood, Person, Number, Gender and Honorifics.</p><h2><strong>Tense (&#2325;&#2366;&#2354;)</strong></h2><p>In Nepali, verbs exhibit three tenses to signify the timing of an action in relation to the moment of speaking: Past (&#2349;&#2369;&#2340; &#2325;&#2366;&#2354;), Present (&#2357;&#2352;&#2381;&#2340;&#2350;&#2366;&#2344; &#2325;&#2366;&#2354;) and Future (&#2349;&#2357;&#2367;&#2359;&#2381;&#2351;&#2340; &#2325;&#2366;&#2354;).</p><pre><code><code>Past (&#2349;&#2369;&#2340; &#2325;&#2366;&#2354;): &#2326;&#2366;&#2351;&#2379; (khaa-yo)
Present (&#2357;&#2352;&#2381;&#2340;&#2350;&#2366;&#2344; &#2325;&#2366;&#2354;): &#2326;&#2366;&#2344;&#2381;&#2331; (khaa-n-cha)
Future (&#2349;&#2357;&#2367;&#2359;&#2381;&#2351;&#2340; &#2325;&#2366;&#2354;): &#2326;&#2366;&#2344;&#2375;&#2331;&#2369; (khaa-ne-chu)
</code></code></pre><h2><strong>Aspect (&#2346;&#2325;&#2381;&#2359;)</strong></h2><p>While tense tells us when an action occurs, aspect tells us how that action unfolds or is perceived. In Nepali, verbs can be inflected to express 4 aspects: Perfect (&#2346;&#2370;&#2352;&#2381;&#2339; &#2346;&#2325;&#2381;&#2359;), Habitual (&#2309;&#2349;&#2381;&#2351;&#2360;&#2381;&#2340; &#2346;&#2325;&#2381;&#2359;), Imperfect (&#2309;&#2346;&#2370;&#2352;&#2381;&#2339; &#2346;&#2325;&#2381;&#2359;) and Inferential (&#2309;&#2332;&#2381;&#2334;&#2366;&#2340; &#2346;&#2325;&#2381;&#2359;).</p><h3><strong>Perfect Aspect (&#2346;&#2370;&#2352;&#2381;&#2339; &#2346;&#2325;&#2381;&#2359;)</strong></h3><p>The perfect aspect of a verb indicates that the action has been completed prior to the current moment. In Nepali grammar, the presence of the suffix "&#2319;&#2325;&#2379;" (eko) signals the perfect aspect. Notably, the suffix "&#2319;&#2325;&#2379;" (eko) undergoes inflection to match the number (singular or plural) and gender (masculine or feminine) of the subject involved in the action. Examples: &#2326;&#2366;&#2319;&#2325;&#2379; (khaa-eko), &#2326;&#2366;&#2319;&#2325;&#2366; (khaa-yeka)</p><pre><code><code>Examples of Perfect Aspect (&#2346;&#2370;&#2352;&#2381;&#2339; &#2346;&#2325;&#2381;&#2359;) Verbs
&#2326;&#2366;&#2319;&#2325;&#2379; (kha-eko) - masculine, singular
&#2326;&#2366;&#2319;&#2325;&#2366; (kha-eka) - masculine, plural
&#2326;&#2366;&#2319;&#2325;&#2368; (kha-eki) - feminine, singular
&#2326;&#2366;&#2319;&#2325;&#2366; (kha-eko) - feminine, plural
</code></code></pre><h3><strong>Imperfect Aspect (&#2309;&#2346;&#2370;&#2352;&#2381;&#2339; &#2346;&#2325;&#2381;&#2359;)</strong></h3><p>Imperfect aspect denotes an action that is in progress or ongoing. In Nepali grammar, this aspect is indicated by specific suffixes such as "&#2342;&#2376;" (dai), "&#2342;&#2379;" (do), "&#2342;&#2368;" (dii), and "&#2342;&#2366;" (da). These suffixes serve to highlight the ongoing nature of the action, suggesting that it is not yet complete or finalized. Examples: &#2326;&#2366;&#2305;&#2342;&#2376; (khaa-dai), &#2326;&#2366;&#2305;&#2342;&#2366; (khaa-daa)</p><pre><code><code>Examples of Imperfect Aspect (&#2346;&#2370;&#2352;&#2381;&#2339; &#2346;&#2325;&#2381;&#2359;) Verbs
&#2326;&#2366;&#2305;&#2342;&#2379;(kha-do), &#2326;&#2366;&#2305;&#2342;&#2376;(kha-dai) - masculine, singular
&#2326;&#2366;&#2305;&#2342;&#2366;(kha-da), &#2326;&#2366;&#2305;&#2342;&#2376;(kha-dai) - masculine, plural
&#2326;&#2366;&#2305;&#2342;&#2368;(kha-di), &#2326;&#2366;&#2305;&#2342;&#2376;(kha-dai) - feminine, singular
&#2326;&#2366;&#2305;&#2342;&#2366;(kha-da), &#2326;&#2366;&#2305;&#2342;&#2376;(kha-dai) - feminine, plural
</code></code></pre><h3><strong>Habitual Aspect (&#2309;&#2349;&#2381;&#2351;&#2360;&#2381;&#2340; &#2346;&#2325;&#2381;&#2359;)</strong></h3><p>Habitual aspect depicts actions that occur regularly or habitually. It conveys the idea of actions that are customary or repeatedly performed. In Nepali grammar, the habitual aspect is represented by variants of the suffixes "&#2331;" (cha) and "&#2341;&#2381;" (th). These suffixes inflect to encode the person, number, gender, and levels of honorifics associated with the subject.</p><pre><code><code>Examples of Habitual Aspect (&#2309;&#2349;&#2381;&#2351;&#2360;&#2381;&#2340; &#2346;&#2325;&#2381;&#2359;) Verbs
&#2326;&#2366;&#2344;&#2381;&#2331;&#2369; (kha-n-chu), &#2326;&#2366;&#2344;&#2381;&#2341;&#2375; (kha-n-the) - first person, inclusive, singular
&#2326;&#2366;&#2344;&#2381;&#2331;&#2380; (kha-n-chau) - first person, inclusive, plural
&#2326;&#2366;&#2344;&#2381;&#2341;&#2367;&#2360;&#2381; (kha-n-this) - second person, masculine, singular
&#2326;&#2366;&#2344;&#2381;&#2341;&#2381;&#2351;&#2380; (kha-n-theu) - second person, masculine, plural
&#2326;&#2366;&#2344;&#2381;&#2341;&#2381;&#2351;&#2379; (kha -n-thyo), &#2326;&#2366;&#2344;&#2381;&#2341;&#2375; (kha-n-the) - third person, masculine, singular
&#2326;&#2366;&#2344;&#2381;&#2341;&#2375; (kha-n-the) - third person, inclusive, plural
&#2326;&#2366;&#2344;&#2381;&#2341;&#2367; (kha-n-thi), &#2326;&#2366;&#2344;&#2381;&#2341;&#2367;&#2344;&#2381; (kha-n-thin) - third person, feminine, singular
</code></code></pre><h3><strong>Inferential Aspect (&#2309;&#2332;&#2381;&#2334;&#2366;&#2340; &#2346;&#2325;&#2381;&#2359;)</strong></h3><p>Inferential aspect in Nepali is used to describe actions that have occurred in the past but are only known or inferred in the present, often based on indirect evidence or hearsay. In Nepali grammar, the occurrence of the suffixes "&#2319;" (e) and "&#2311;" (i) between the verb stem and the forms of "&#2331;" (cha) indicates the inferential aspect. These suffixes serve to imply that the action, while not directly observed or experienced, is deduced or inferred to have taken place.</p><pre><code><code>Examples of Inferential Aspect (&#2309;&#2332;&#2381;&#2334;&#2366;&#2340; &#2346;&#2325;&#2381;&#2359;) Verbs
&#2326;&#2366;&#2319;&#2331;&#2369; (kha-e-chu) - first person, inclusive, singular
&#2326;&#2366;&#2319;&#2331;&#2380;&#2305; (kha-e-chau)- first person, inclusive, plural
&#2326;&#2366;&#2319;&#2331;&#2360;&#2381; (kha-e-chas) - second person, masculine, singular
&#2326;&#2366;&#2311;&#2331;&#2360;&#2381; (kha-i-chas)  - second person, feminine, singular
&#2326;&#2366;&#2319;&#2331;&#2380; (kha-e-chau) - second person, inclusive, plural
&#2326;&#2366;&#2319;&#2331; (kha-e-cha) - third person, masculine, singular
&#2326;&#2366;&#2311;&#2331; (kha-i-cha)  - third person, feminine, singular
&#2326;&#2366;&#2319;&#2331;&#2344;&#2381; (kha-e-chan) - third person, inclusive, plural
</code></code></pre><h2><strong>Mood (&#2349;&#2366;&#2357;)</strong></h2><p>Mood conveys the speaker's attitude or stance towards the content being communicated. In Nepali, verbs exhibit three moods, each indicating a different perspective or intention of the speaker: Imperative (&#2310;&#2332;&#2381;&#2334;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;), Optative (&#2311;&#2330;&#2381;&#2331;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;), and Potential (&#2360;&#2350;&#2381;&#2349;&#2366;&#2357;&#2344;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;).</p><h3><strong>Imperative Mood (&#2310;&#2332;&#2381;&#2334;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;)</strong></h3><p>Imperative Mood express commands or requests. It is a directive form that directs the listener to perform a certain action. Verbs in the imperative mood undergo inflection to match the number and honorifics associated with the subject or the individual being addressed.</p><pre><code><code>Examples of Imperative Mood (&#2310;&#2332;&#2381;&#2334;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;) Verbs
&#2326;&#2366; (kha) - singular, informal
&#2326;&#2366;&#2344;&#2369;&#2361;&#2379;&#2360;&#2381; (khaanu hos) - singular, formal
&#2326;&#2366;&#2323;(kha-o) - plural, inclusive
&#2326;&#2366;&#2344;&#2369;&#2361;&#2379;&#2360;&#2381; (khaanu hos) - plural, formal, inclusive
</code></code></pre><h3><strong>Optative Mood (&#2311;&#2330;&#2381;&#2331;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;)</strong></h3><p>Optative mood indicates wishes, hopes, or desires. It allows speakers to express their desires regarding a particular situation or outcome. Optativer forms also undergo inflection to align with the person, number, and level of honorifics involved in the communication.</p><pre><code><code>Examples of Optative Mood (&#2311;&#2330;&#2381;&#2331;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;) Verbs
&#2326;&#2366;&#2313;&#2305; (kha-u) - first person, singular/plural
&#2326;&#2366;&#2319;&#2360;&#2381; (kha-esh) - second person, singular
&#2326;&#2366;&#2319; (kha-e) - second person, plural
&#2326;&#2366;&#2323;&#2360;&#2381; (kha-os) - third person, singular
&#2326;&#2366;&#2313;&#2344;&#2381; (kha-un) -  third person, plural
</code></code></pre><h3><strong>Potential Mood (&#2360;&#2350;&#2381;&#2349;&#2366;&#2357;&#2344;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;)</strong></h3><p>Potential mood in language serves as a means to convey the possibility or likelihood of an action occurring. This mood allows for the expression of hypothetical scenarios or speculative statements about what may happen. In Nepali grammar, verbs inflect to indicate the potential mood, adapting to align with the person, gender, and number of the subject involved in the action.</p><pre><code><code>Examples of Potential Mood (&#2360;&#2350;&#2381;&#2349;&#2366;&#2357;&#2344;&#2366;&#2352;&#2381;&#2341; &#2349;&#2366;&#2357;) Verbs
&#2326;&#2366;&#2313;&#2305;&#2354;&#2366; (kha-u-la) - first person, inclusive, singular
&#2326;&#2366;&#2324;&#2305;&#2354;&#2366; (kha-aula) - first person, inclusive, plural
&#2326;&#2366;&#2354;&#2366;&#2360;&#2381; (kha-lash) - second person, masculine, singular
&#2326;&#2366;&#2354;&#2367;&#2360;&#2381; (kha-lish) - second person, feminine, singular
&#2326;&#2366;&#2324;&#2354;&#2366; (kha-aula) - second person, inclusive, plural
&#2326;&#2366;&#2354;&#2366; (kha-la) - third person, masculine, singular
&#2326;&#2366;&#2354;&#2368; (kha-li) - third person, feminine, singular
&#2326;&#2366;&#2354;&#2366;&#2344;&#2381; (kha-lan) - third person, inclusive, plural
</code></code></pre><h2><strong>Person</strong></h2><p>In Nepali grammar, verbs undergo inflection in agreement with person. It distinguishes between the first person (the speaker), the second person (the recipient or addressee), and the third person (others not involved in the conversation). Person verbs also demonstrate variations based on mood, tense, aspect, and number. In addition, second and third person verbs also inflect for gender and grades of honorifics.</p><pre><code><code>Examples of First Person Verbs
&#2326;&#2366;&#2319; (kha-e) - past tense, singular
&#2326;&#2366;&#2344;&#2381;&#2331;&#2369; (kha-n-chu) - present tense, singular
&#2326;&#2366;&#2344;&#2375;&#2331;&#2369; (kha-ne-chu) - future tense, singular
&#2326;&#2366;&#2351;&#2380;&#2305; (kha-you)  - past tense, plural
&#2326;&#2366;&#2344;&#2381;&#2331;&#2380;&#2305; (kha-n-chau) - present tense, plural
&#2326;&#2366;&#2344;&#2375; &#2331;&#2380;&#2305; (kha-ne-chau) - future tense, plural
</code></code></pre><pre><code><code>Examples of Second Person Verbs
&#2326;&#2366;&#2311;&#2360;&#2381; (kha-i-sh) - past tense, inclusive, singular
&#2326;&#2366;&#2344;&#2381;&#2331;&#2360;&#2381; (kha-n-chas) - present tense, masculine, singular
&#2326;&#2366;&#2344;&#2381;&#2331;&#2375;&#2360;&#2381; (kha-n-ches) - present tense, feminine, singular
&#2326;&#2366;&#2344;&#2375;&#2331;&#2360;&#2381; (kha-ne-chas) - future tense, masculine, singular
&#2326;&#2366;&#2344;&#2375;&#2331;&#2375;&#2360;&#2381; (kha-ne-ches) - future tense, feminine, singular
&#2326;&#2366;&#2351;&#2380; (kha-you)  - past tense, inclusive, plural
&#2326;&#2366;&#2344;&#2381;&#2331;&#2380;(kha-n-chau) - present tense, inclusive, plural
&#2326;&#2366;&#2344;&#2375; &#2331;&#2380; (kha-ne-chau) - future tense, inclusive, plural
</code></code></pre><pre><code><code>Examples of Third Person Verbs
&#2326;&#2366;&#2311;&#2360;&#2381; (kha-i-sh) - past tense, inclusive, singular
&#2326;&#2366;&#2344;&#2381;&#2331;&#2360;&#2381; (kha-n-chas) - present tense, masculine, singular
&#2326;&#2366;&#2344;&#2381;&#2331;&#2375;&#2360;&#2381; (kha-n-ches) - present tense, feminine, singular
&#2326;&#2366;&#2344;&#2375;&#2331;&#2360;&#2381; (kha-ne-chas) - future tense, masculine, singular
&#2326;&#2366;&#2344;&#2375;&#2331;&#2375;&#2360;&#2381; (kha-ne-ches) - future tense, feminine, singular
&#2326;&#2366;&#2351;&#2380; (kha-you)  - past tense, inclusive, plural
&#2326;&#2366;&#2344;&#2381;&#2331;&#2380;(kha-n-chau) - present tense, inclusive, plural
&#2326;&#2366;&#2344;&#2375; &#2331;&#2380; (kha-ne-chau) - future tense, inclusive, plural
</code></code></pre><h2><strong>Number</strong></h2><p>Nepali verbs exhibit agreement with the subject in terms of number: singular and plural.</p><pre><code><code>Examples of Singular Verbs
&#2326;&#2366;&#2311;&#2360;&#2381; (kha-i-sh) - past tense, inclusive
&#2326;&#2366;&#2344;&#2381;&#2331;&#2360;&#2381; (kha-n-chas) - present tense, masculine
&#2326;&#2366;&#2344;&#2381;&#2331;&#2375;&#2360;&#2381; (kha-n-ches) - present tense, feminine, singular
Examples of Plural Verbs
&#2326;&#2366;&#2351;&#2380; (kha-you)  - past tense, inclusive, plural
&#2326;&#2366;&#2344;&#2381;&#2331;&#2380;(kha-n-chau) - present tense, inclusive, plural
&#2326;&#2366;&#2344;&#2375; &#2331;&#2380; (kha-ne-chau) - future tense, inclusive, plural
</code></code></pre><h2><strong>Gender</strong></h2><p>Verbs inflect to demonstrate two forms of gender agreement: masculine and feminine, reflecting the gender of the subject. This distinction is particularly evident in the conjugation of verbs for the second and third person singular forms.</p><h2><strong>Honorifics</strong></h2><p>In Nepali language, honorifics play a significant role in social interactions, influencing verb forms to express different levels of respect in speech. Second and third person verb forms can undergo inflection to reflect three distinct grades of honorifics: casual, familiar, and respectful. These honorifics are chosen based on the level of formality and the relationship between the speaker and the listener.</p><h3><strong>Casual Honorifics</strong></h3><p>Casual honorifics are used when addressing juniors or friends in a casual setting. The language used is informal and relaxed, reflecting a close relationship between the speaker and the listener.</p><pre><code><code>&#2340;&#2305; (You, singular) - Casual Honorific
  &#2340;&#2305; &#2326;&#2366;&#2344;&#2381;&#2331;&#2360;&#2381; (kha-n-chas)
</code></code></pre><h3><strong>Familiar Honorifics</strong></h3><p>The second grade of honorific, familiar honorifics, is employed when speaking to friends, acquaintances, or colleagues. It is more formal compared to casual honorifics and is considered appropriate for most social interactions.</p><pre><code><code>&#2340;&#2367;&#2350;&#2368; (You, singular) - Familiar Honorific
  &#2340;&#2367;&#2350;&#2368; &#2326;&#2366;&#2344;&#2381;&#2331;&#2380; (kha-n-chau)
</code></code></pre><h3><strong>Respectful Honorifics</strong></h3><p>Respectful honorifics are used while addressing seniors or elders, as well as individuals deserving of utmost respect. Verbs inflected with respectful honorifics exhibit a high level of respect and formality.</p><pre><code><code>&#2361;&#2332;&#2369;&#2352; (You, singular) - Respectful Honorific
  &#2361;&#2332;&#2369;&#2352; &#2326;&#2366;&#2344;&#2369;&#2361;&#2379;&#2360;&#2381; (kha-nu-hos)</code></code></pre><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Nominal Inflections: The Morphological Adaptations of Nepali Nouns, Pronouns and Adjectives]]></title><description><![CDATA[Nepali is an inflectionally rich language.]]></description><link>https://www.icodeformybhasa.com/p/nominal-inflections-the-morphological</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/nominal-inflections-the-morphological</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sat, 05 Aug 2017 05:52:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f18c1d43-5c95-40d5-be30-227feb4d44bc_1024x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Nepali is an inflectionally rich language. In this post we will look into inflections in Nepali Nouns, Pronouns, and Adjectives.</p><h2><strong>Recap: Inflectional Morphemes</strong></h2><ul><li><p>Inflectional morphemes encode grammatical meaning like gender, number, tense, person, and levels of honorifics.</p></li><li><p>Inflectional forms of a word have the same meaning as the root.</p></li><li><p>Inflectional morphemes have a transparent and regular function such that they do not change the lexical category.</p></li><li><p>Since inflection encode grammatical meaning, they do not precede derivational morphemes.</p></li><li><p>In Nepali, there are only inflectional suffixes.</p></li></ul><h2><strong>Inflections in Nepali Nouns and Pronouns</strong></h2><p>Nepali nouns and pronouns inflect for seven cases (&#2325;&#2366;&#2352;&#2325;): Nomiantive, Accusative, Instrumental, Dative, Ablative, Genitive and Locative and number (&#2357;&#2330;&#2344;): Singular, Plural. All of thses inflectional forms are marked by postpositions.</p><ol><li><p>Nominative Case (&#2325;&#2352;&#2381;&#2340;&#2366;) Nominative case is used to indicate the subject of a sentence, or the doer of an action.</p></li></ol><pre><code><code>&#2360;&#2366;&#2341;&#2368;&#2354;&#2375; (sathi-le) - noun with nominative, singular
&#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2354;&#2375; (sathi-haru-le) - noun nominative case, plural
&#2340;&#2367;&#2350;&#2368;&#2354;&#2375; (timi-le) - pronoun nominative case, singular
&#2340;&#2367;&#2350;&#2368;&#2361;&#2352;&#2369;&#2354;&#2375; (timi-haru-le) - pronoun nominative case, plural
</code></code></pre><ol start="2"><li><p>Accusative Case (&#2325;&#2352;&#2381;&#2350;) The accusative case marks the direct object of a verb, the receiver of the action.</p></li></ol><pre><code><code>&#2360;&#2366;&#2341;&#2368;&#2354;&#2366;&#2312; (sathi-lai:) - noun with accusative, singular
&#2340;&#2367;&#2350;&#2368;&#2354;&#2366;&#2312; (timi-lai:) - pronoun with accusative, singular
&#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2354;&#2366;&#2312; (sathi-haru-lai:) - noun with accusative, plural
&#2340;&#2367;&#2350;&#2368;&#2361;&#2352;&#2369;&#2354;&#2366;&#2312; (timi-haru-lai:) - pronoun with accusative, plural
</code></code></pre><ol start="3"><li><p>Instrumental Case (&#2325;&#2352;&#2339;) The instrumental case denotes the instrument or means by which an action is performed.</p></li></ol><pre><code><code>&#2360;&#2366;&#2341;&#2368;&#2354;&#2375; (sathi-le) - noun with instrumental, singular
&#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2354;&#2375; (sathi-haru-le) - noun instrumental case, plural
&#2340;&#2367;&#2350;&#2368;&#2354;&#2375; (timi-le) - pronoun instrumental case, singular
&#2340;&#2367;&#2350;&#2368;&#2361;&#2352;&#2369;&#2354;&#2375; (timi-haru-le) - pronoun instrumental case, plural
</code></code></pre><ol start="4"><li><p>Dative Case (&#2360;&#2350;&#2381;&#2346;&#2381;&#2352;&#2342;&#2366;&#2344;) Dative case indicates the indirect object of a verb, the recipient of the action.</p></li></ol><pre><code><code>&#2360;&#2366;&#2341;&#2368;&#2354;&#2366;&#2312; (sathi-lai:) - noun with dative, singular
&#2340;&#2367;&#2350;&#2368;&#2354;&#2366;&#2312; (timi-lai:) - pronoun with dative, singular
&#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2354;&#2366;&#2312; (sathi-haru-lai:) - noun with dative, plural
&#2340;&#2367;&#2350;&#2368;&#2361;&#2352;&#2369;&#2354;&#2366;&#2312; (timi-haru-lai:) - pronoun with dative, plural
</code></code></pre><ol start="5"><li><p>Ablative Case (&#2309;&#2346;&#2366;&#2342;&#2366;&#2344;) The ablative case expresses the origin, source, or cause of an action.</p></li></ol><pre><code><code>&#2360;&#2366;&#2341;&#2368;&#2342;&#2375;&#2326;&#2367; (sathi-dekhi), &#2360;&#2366;&#2341;&#2368;&#2348;&#2366;&#2335; (sathi-bata) - noun with ablative, singular
&#2340;&#2367;&#2350;&#2368;&#2342;&#2375;&#2326;&#2367; (timi-dekhi), &#2340;&#2367;&#2350;&#2368;&#2348;&#2366;&#2335; (timi-bata) - pronoun with ablative, singular
&#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2342;&#2375;&#2326;&#2367; (sathi-haru-dekhi), &#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2348;&#2366;&#2335; (sathi-haru-bata) - noun with ablative, plural
&#2340;&#2367;&#2350;&#2368;&#2361;&#2352;&#2369;&#2342;&#2375;&#2326;&#2367; (timi-haru-dekhi),  &#2340;&#2367;&#2350;&#2368;&#2361;&#2352;&#2369;&#2348;&#2366;&#2335; (timi-haru-bata) - pronoun with ablative, plural
</code></code></pre><ol start="6"><li><p>Genitive Case (&#2360;&#2350;&#2381;&#2348;&#2344;&#2381;&#2343;) The genitive case signifies possession, association, or belonging.</p></li></ol><pre><code><code>&#2360;&#2366;&#2341;&#2368;&#2325;&#2379; (sathi-ko) - noun with genitive, singular
&#2313;&#2344;&#2325;&#2379; (un-ko) - pronoun with genitive, singular
&#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2325;&#2379; (sathi-haru-ko) - noun with genitive, plural
&#2313;&#2344;&#2368;&#2361;&#2352;&#2369;&#2325;&#2379; (uni-haru-ko) - pronoun with genitive, plural
</code></code></pre><ol start="7"><li><p>Locative (&#2309;&#2343;&#2367;&#2325;&#2352;&#2339;) The locative case indicates location or place where something happens or is located.</p></li></ol><pre><code><code>&#2360;&#2366;&#2341;&#2368;&#2350;&#2366; (sathi-ma) - noun with locative, singular
&#2313;&#2344;&#2368;&#2350;&#2366; (uni-ma) - pronoun with locative, singular
&#2360;&#2366;&#2341;&#2368;&#2361;&#2352;&#2369;&#2350;&#2366; (sathi-haru-ma) - noun with locative, plural
&#2313;&#2344;&#2368;&#2361;&#2352;&#2369;&#2350;&#2366; (uni-haru-ma) - pronoun with locative, plural
</code></code></pre><h2><strong>Inflections in Nepali Adjectives</strong></h2><p>Nepali adjectives inflect for number (Singular, Plural) and gender (Masculine and Feminine) and seven cases of the nouyn they modify. It involves transforming singular adjectives ending in "o" to their plural counterparts ending in "a", and masculine adjectives with "o" ending to feminine adjectives with "i" ending. For instance, the adjective "&#2352;&#2366;&#2350;&#2381;&#2352;&#2379;" (ramro), meaning "good" in singular masculine form, becomes "&#2352;&#2366;&#2350;&#2381;&#2352;&#2366;" (ramra) in its plural form and "&#2352;&#2366;&#2350;&#2381;&#2352;&#2368;" (ramri) in its feminine form. See Table 2 for a detailed overview of inflectional patterns in Nepali adjectives.</p><pre><code><code>&#2352;&#2366;&#2350;&#2381;&#2352;&#2379; (ramr-o) - singular, masculine
&#2352;&#2366;&#2350;&#2381;&#2352;&#2368; (ramr-i) - singular, feminine
&#2352;&#2366;&#2350;&#2381;&#2352;&#2366; (ramr-a) - plural, masculine
&#2352;&#2366;&#2350;&#2381;&#2352;&#2366; (ramra) - plural, feminine</code></code></pre><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Exploring the Building Blocks: A Simple Guide to Morphemes in Nepali]]></title><description><![CDATA[In this post, we will explore morphemes, which are the smallest units of meaning in language. Words in Nepali can be comprised of: 1) a free morpheme; 2) one or more bound morphemes attached to a free morpheme; or 3) two or more bound morphemes. The process by which a bound morpheme attaches to a free morpheme or another bound morpheme to form a word can be categorized into inflection (&#2352;&#2369;&#2346;&#2366;&#2351;&#2344;) and derivation (&#2357;&#2381;&#2351;&#2369;&#2340;&#2381;&#2346;&#2366;&#2342;&#2344;), resulting in two types of bound morphemes: inflectional and derivational.]]></description><link>https://www.icodeformybhasa.com/p/exploring-the-building-blocks-a-simple</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/exploring-the-building-blocks-a-simple</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Tue, 01 Aug 2017 13:48:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/17675a34-4ed9-48e6-ad34-558853ea709e_1024x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this post, we will explore morphemes, which are the smallest units of meaning in language. Words in Nepali can be comprised of: 1) a free morpheme; 2) one or more bound morphemes attached to a free morpheme; or 3) two or more bound morphemes. The process by which a bound morpheme attaches to a free morpheme or another bound morpheme to form a word can be categorized into inflection (&#2352;&#2369;&#2346;&#2366;&#2351;&#2344;) and derivation (&#2357;&#2381;&#2351;&#2369;&#2340;&#2381;&#2346;&#2366;&#2342;&#2344;), resulting in two types of bound morphemes: inflectional and derivational.</p><p>Note:&nbsp;<em>A free morpheme is a standalone word and has a meaning of its own. However, a bound morpheme by itself cannot be considered a word even though it may carry some meaning.</em></p><h2><strong>Inflections v/s Derivations</strong></h2><ul><li><p>Inflectional morphemes encode grammatical meaning, hence inflectional forms of a word have the same meaning as the root.</p></li><li><p>Inflectional morphemes have a transparent and regular function such that they do not change the lexical category.</p></li><li><p>Since inflection encode grammatical meaning, they do not precede derivational morphemes.</p></li><li><p>In Nepali, there are only inflectional suffixes.</p></li></ul><pre><code><code>&#2360;&#2381;&#2325;&#2369;&#2354; (school) + &#2361;&#2352;&#2369; (haru) = &#2360;&#2381;&#2325;&#2369;&#2354;&#2361;&#2352;&#2369; (school-haru) # Plural Form
&#2360;&#2381;&#2325;&#2369;&#2354; (school) + &#2325;&#2379; (ko) = &#2360;&#2381;&#2325;&#2369;&#2354;&#2325;&#2379; (school-ko) # Genetive Form
</code></code></pre><ul><li><p>Derivational morphemes carry lexical meaning, hence when such morphemes combine with free morphemes they form new words.</p></li><li><p>Derivational morphemes may also change the lexical category of the root.</p></li><li><p>In Nepali, there are derivational prefixes and suffixes.</p></li></ul><pre><code><code># Prefix
&#2309;&#2344;&#2369; (anu) + &#2352;&#2369;&#2346; (rup) = &#2309;&#2344;&#2369;&#2352;&#2369;&#2346; (anu-rup)
&#2309;&#2349;&#2367; (abhi) + &#2351;&#2379;&#2327; (yog) = &#2309;&#2349;&#2367;&#2351;&#2379;&#2327; (abhi-yog)

# Suffix
&#2348;&#2330;&#2381; (bach) + &#2309;&#2340; (ata) = &#2348;&#2330;&#2340; (bach-ata) # Verb to Noun
&#2336;&#2327;&#2381; (thag) + &#2310;&#2361;&#2366; (aahaa) = &#2336;&#2327;&#2366;&#2361;&#2366; (thag-aahaa) # Verb to Adjective

</code></code></pre><p>NOTE: There are no derivational/inflectional infixes and circumfixes in Nepali.</p><h2><strong>Form and Structure Classes</strong></h2><p>In addition to inflection and derivation, it's crucial to understand the concept of form and structure classes in Nepali. Form classes refer to words that primarily convey content and carry meaning, such as nouns, verbs, adjectives, and adverbs. These words usually undergo inflectional and derivational processes.</p><p>Structure classes, on the other hand, include function words like articles, conjunctions, prepositions, and pronouns. They contribute to the grammatical structure and organization of sentences but do not typically undergo inflectional or derivational changes.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[An Introduction to Written Nepali]]></title><description><![CDATA[Nepali is an Indo-Aryan language.]]></description><link>https://www.icodeformybhasa.com/p/an-introduction-to-written-nepali</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/an-introduction-to-written-nepali</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Sun, 23 Jul 2017 18:37:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/bc8ffb4f-63c2-491c-b431-330c82b9d1be_665x291.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><code>Nepali is an Indo-Aryan language. It is written in Devnagari script. Hindi, Bengali, Marathi and Sanskrit are some other languages written in the same script. It follows Subject +  Object + Verb pattern in writing and is written from left to right. This blog post will serve as an introduction to written Nepali.</code></p><p><code>Nepali is written using vowels, consonants, modifiers(&#2350;&#2366;&#2340;&#2381;&#2352;&#2366;) and symbols(&#2330;&#2367;&#2344;&#2381;&#2361;).</code></p><p></p><h2><code>Nepali Alphabets</code></h2><p><code>Nepali Alphabets consists of 11 vowels and 33 consonants. All the vowels and consonants, in Nepali, are listed in Table 1.</code></p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/7TxS7/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12771134-bff7-4f45-833b-e40d5541033c_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:178,&quot;title&quot;:&quot;| Created with Datawrapper&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/7TxS7/1/" width="730" height="178" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p><code>&#2325;&#2381;&#2359;, &#2340;&#2381;&#2352; and &#2332;&#2381;&#2334; are usually mistaken for consonants but these letters are special combination of two different consonants and halanta "&#2381;".</code></p><pre><code><code>&#2325; + &#2381; + &#2359; = &#2325;&#2381;&#2359;&#9;
&#2340; + &#2381; + &#2352; = &#2340;&#2381;&#2352;
&#2332; + &#2381; + &#2334; = &#2332;&#2381;&#2334;
</code></code></pre><p><code>NOTE:&nbsp;In Nepali, there is no provision for uppercase and lowercase letters.</code></p><h2><code>Modifiers(&#2350;&#2366;&#2340;&#2381;&#2352;&#2366;)</code></h2><p><code>Modifiers, in Nepali, are representations for vowels. A modifier is used when the vowel is preceded by a consonant. Vowels and their respective modifiers are given in Table 2.</code></p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/4AnEC/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/31b7ce43-5ec4-4ef0-9369-b9a97426da95_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:195,&quot;title&quot;:&quot;Table 2: Vowels and their Modifiers&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/4AnEC/1/" width="730" height="195" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p><code>These modifiers can appear at the foot, top or middle of a consonant. They can also appear before and after a consonant.</code></p><p><code>&#2369; and &#2370; can appear at the foot or middle of a consonant and &#2371; appears at the foot of a consonant.</code></p><pre><code><code>At foot:

&#2325; + &#2369; = &#2325;&#2369;
&#2325; + &#2370; = &#2325;&#2370;
&#2325; + &#2371; = &#2325;&#2371;

At middle:

&#2352; + &#2369; = &#2352;&#2369;
&#2352; + &#2370; = &#2352;&#2370;
</code></code></pre><p><code>&#2367; appears before a consonant.</code></p><pre><code><code>&#2325; + &#2367; = &#2325;&#2367;
</code></code></pre><p><code>&#2366;, &#2368;, &#2379; and &#2380; appear after a consonant.</code></p><pre><code><code>&#2325; + &#2366; = &#2325;&#2366;
&#2325; + &#2368; = &#2325;&#2368;
&#2325; + &#2379; = &#2325;&#2379;
&#2325; + &#2380; = &#2325;&#2380;
</code></code></pre><p><code>NOTE:&nbsp;Regardless of where the modifiers appear to be in writing, in computerized texts, consonants preced the modifiers.</code></p><h2><code>Symbols(&#2330;&#2367;&#2344;&#2381;&#2361;)</code></h2><p><code>In addition to alphabets and modifiers, there are other symbols used in Nepali. Such symbols are listed below.</code></p><pre><code><code>Chandrabindu(&#2330;&#2344;&#2381;&#2342;&#2381;&#2352;&#2357;&#2367;&#2344;&#2381;&#2342;&#2369;) : &#2305;  
Sirbindu(&#2358;&#2367;&#2352;&#2357;&#2367;&#2344;&#2381;&#2342;&#2369;): &#2306; 
Halanta(&#2361;&#2354;&#2344;&#2381;&#2340;): &#2381; 
Visarga(&#2357;&#2367;&#2360;&#2352;&#2381;&#2327;): : 
</code></code></pre><h2><code>Chandrabindu and Sirbindu</code></h2><p><code>Both, Chandrabindu and Sirbindu are used to indicate nasalization. Chandrabindu is usually used with vowels, indicating that the previous vowel is nasalized.</code></p><pre><code><code>&#2332;&#2366;&#2313;&#2305;&#2354;&#2366;
&#2310;&#2313;&#2305;&#2331;&#2369;
</code></code></pre><p><code>Sirbindu is usually used to before &#2351;, &#2352;, &#2354;, &#2357;, &#2358;, &#2359;, &#2360; and &#2361;.</code></p><pre><code><code>&#2360;&#2306;&#2351;&#2369;&#2325;&#2381;&#2340;
&#2360;&#2306;&#2352;&#2330;&#2344;&#2366;
&#2360;&#2306;&#2354;&#2327;&#2381;&#2344;
&#2360;&#2306;&#2357;&#2366;&#2342;
&#2357;&#2306;&#2358;
&#2360;&#2306;&#2360;&#2366;&#2352;
&#2361;&#2306;&#2358;
</code></code></pre><h2><code>Halanta</code></h2><p><code>Every consonant has an inherent vowel; halanta is used to supress or cancel the occurrence of such vowels. Occurrence of halanta between two consonants, say C1 and C2, there can be three different cases of conjoined consonants.</code></p><p><code>In the first case, C1 and C2 fully conjoin to form a consonant with a visible halanta occurring at the foot of C1.</code></p><pre><code><code>&#2331;&#2329;&#2381;&#2331;&#2329;
&#2360;&#2329;&#2381;&#2354;&#2379;
</code></code></pre><p><code>Second, the half or modified form of C1 and the full form of C2 conjoin to give a consonant.</code></p><pre><code><code>&#2352;&#2340;&#2381;&#2344;
&#2344;&#2367;&#2361;&#2340;&#2381;&#2341;&#2366;
&#2349;&#2369;&#2354;&#2381;&#2325;
</code></code></pre><p><code>Third, the full form C1 and the half or modified form of C2 conjoin to give a consonant.</code></p><pre><code><code>&#2346;&#2381;&#2352;&#2339;&#2366;&#2350;
&#2348;&#2332;&#2381;&#2352;
&#2331;&#2366;&#2346;&#2381;&#2352;&#2379;
</code></code></pre><h2><code>Visarga</code></h2><p><code>Visarga is a frequent occurrence in sanskrit texts. In Nepali, a handful of words borrowed from sanskrit contains visarga. Few of such words are listed below.</code></p><pre><code><code>&#2342;&#2369;:&#2326;
&#2344;&#2367;:&#2360;&#2381;&#2357;&#2366;&#2352;&#2381;&#2341;
&#2350;&#2370;&#2354;&#2340;:
&#2346;&#2381;&#2352;&#2341;&#2350;&#2340;:
</code></code></pre><p><code>This sums up the basic introduction to written Nepali.</code></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Tokenization in Nepali]]></title><description><![CDATA[Tokenization is generally the first step in text analysis applications.]]></description><link>https://www.icodeformybhasa.com/p/tokenization-in-nepali</link><guid isPermaLink="false">https://www.icodeformybhasa.com/p/tokenization-in-nepali</guid><dc:creator><![CDATA[Shreeya]]></dc:creator><pubDate>Mon, 17 Jul 2017 04:22:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fd6e7a89-206d-4cdb-b5d0-58bba1b2d7cb_781x319.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Tokenization is generally the first step in text analysis applications. It is the process of splitting the given string into units, called tokens. A token is a sequence of characters, usually a word or sentence that is semantically significant for text analysis. Tokenization is a language-specific task; for instance, a language like Chinese that has no space between words requires a language-specific approach towards tokenization. However, Nepali, being a language where words are separated by white spaces, the general boundary-defined tokenization method can be used.</p><h2><strong>Sentence-level Tokenization</strong></h2><p>In cases where we want our tokens to be sentences, our possible token boundary is either &#2346;&#2370;&#2352;&#2381;&#2339;&#2357;&#2367;&#2352;&#2366;&#2350;(&#2404;) or &#2346;&#2381;&#2352;&#2358;&#2381;&#2344; &#2330;&#2367;&#2344;&#2381;&#2361;(?) or &#2357;&#2367;&#2360;&#2381;&#2350;&#2351;&#2366;&#2342;&#2367;&#2348;&#2379;&#2343;&#2325;(!). So, by splitting the given text at &#2346;&#2370;&#2352;&#2381;&#2339;&#2357;&#2367;&#2352;&#2366;&#2350;(&#2404;) or &#2346;&#2381;&#2352;&#2358;&#2381;&#2344; &#2330;&#2367;&#2344;&#2381;&#2361;(?) or &#2357;&#2367;&#2360;&#2381;&#2350;&#2351;&#2366;&#2342;&#2367;&#2348;&#2379;&#2343;&#2325;(!), sentence-level tokenization can be achieved.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>&#2346;&#2370;&#2352;&#2381;&#2339;&#2357;&#2367;&#2352;&#2366;&#2350;(&#2404;) in Nepali is equivalent to a full stop (.) in English.</p><pre><code><code># Split at ?, &#2404; or !
return re.split('(?&lt;=[&#2404;?!]) +', text)

INPUT: 
&#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2344;&#2327;&#2352;&#2368; &#2361;&#2369;&#2344;&#2381;&#2331;? &#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2360;&#2347;&#2354;&#2340;&#2366;&#2325;&#2379; &#2319;&#2325; &#2350;&#2366;&#2340;&#2381;&#2352; &#2348;&#2366;&#2335;&#2379; &#2361;&#2379;&#2404; &#2332;&#2379; &#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2327;&#2352;&#2381;&#2331;, &#2313;&#2361;&#2368; &#2360;&#2347;&#2354; &#2361;&#2369;&#2344;&#2381;&#2331;&#2404; &#2309;&#2348; &#2340; &#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2327;&#2352;&#2381;&#2331;&#2380; &#2344;&#2367;? &#2344;&#2327;&#2352;&#2368; &#2325;&#2361;&#2366;&#2305; &#2361;&#2369;&#2344;&#2381;&#2331; &#2340;!

OUTPUT:
['&#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2344;&#2327;&#2352;&#2368; &#2361;&#2369;&#2344;&#2381;&#2331;?', '&#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2360;&#2347;&#2354;&#2340;&#2366;&#2325;&#2379; &#2319;&#2325; &#2350;&#2366;&#2340;&#2381;&#2352; &#2348;&#2366;&#2335;&#2379; &#2361;&#2379;&#2404;', '&#2332;&#2379; &#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2327;&#2352;&#2381;&#2331;, &#2313;&#2361;&#2368; &#2360;&#2347;&#2354; &#2361;&#2369;&#2344;&#2381;&#2331;&#2404;', '&#2309;&#2348; &#2340; &#2346;&#2352;&#2367;&#2358;&#2381;&#2352;&#2350; &#2327;&#2352;&#2381;&#2331;&#2380; &#2344;&#2367;?', '&#2344;&#2327;&#2352;&#2368; &#2325;&#2361;&#2366;&#2305; &#2361;&#2369;&#2344;&#2381;&#2331; &#2340;!']
</code></code></pre><p>You can find out more about punctuation marks in Nepali at: [Punctuation in Nepali] (<a href="https://nepalgo.tumblr.com/post/71951951192/punctuation-marks">https://nepalgo.tumblr.com/post/71951951192/punctuation-marks</a>).</p><h2><strong>Word-level Tokenization</strong></h2><p>In languages that have words separated by blank spaces, the token boundary for word-level tokenization is the blank/white space. Nepali is one such language, so word-level tokenization in Nepali can be achieved by stripping tokens at those white spaces. However, it is not as simple as it looks, especially when dealing with punctuations. Some punctuation is easy to handle. All that you need to do is replace them with a white space and you are good to go.</p><p>Cases involving hyphen (-) and colon (:) need to be handled differently.</p><h2><strong>Replacing Punctuations with White Space</strong></h2><p>The following is the list of punctuations that can be handled by simply replacing them with a white space.</p><pre><code><code>,
)
(
{
}
[]
!
&#8216;
&#8217;
&#8220;
&#8221;
:-
?
&#2404;
/
&#8212;
</code></code></pre><pre><code><code>INPUT:
&#2352;&#2366;&#2350; &#2310;&#2351;&#2379; &#2352; &#2349;&#2344;&#2381;&#2351;&#2379;, "&#2342;&#2366;&#2311; &#2352; &#2342;&#2367;&#2342;&#2367;, &#2351;&#2340;&#2367; &#2342;&#2367;&#2344; &#2325;&#2340;&#2366; &#2361;&#2369;&#2344;&#2369;&#2361;&#2369;&#2344;&#2381;&#2341;&#2381;&#2351;&#2379;?" &#2340;&#2348;, &#2342;&#2366;&#2311;/&#2342;&#2367;&#2342;&#2367;&#2354;&#2375; &#2325;&#2375;&#2361;&#2367; &#2344;&#2348;&#2379;&#2354;&#2368; &#2310;&#2347;&#2381;&#2344;&#2379; (&#2348;&#2366;&#2335;&#2379;) &#2354;&#2366;&#2327;&#2381;&#2344;&#2369;&#2349;&#2351;&#2379;&#2404;

OUTPUT:
['&#2352;&#2366;&#2350;', '&#2310;&#2351;&#2379;', '&#2352;', '&#2349;&#2344;&#2381;&#2351;&#2379;', '&#2342;&#2366;&#2311;', '&#2352;', '&#2342;&#2367;&#2342;&#2367;', '&#2351;&#2340;&#2367;', '&#2342;&#2367;&#2344;', '&#2325;&#2340;&#2366;', '&#2361;&#2369;&#2344;&#2369;&#2361;&#2369;&#2344;&#2381;&#2341;&#2381;&#2351;&#2379;', '&#2340;&#2348;', '&#2342;&#2366;&#2311;', '&#2342;&#2367;&#2342;&#2367;&#2354;&#2375;', '&#2325;&#2375;&#2361;&#2367;', '&#2344;&#2348;&#2379;&#2354;&#2368;', '&#2310;&#2347;&#2381;&#2344;&#2379;', '&#2348;&#2366;&#2335;&#2379;', '&#2354;&#2366;&#2327;&#2381;&#2344;&#2369;&#2349;&#2351;&#2379;']
</code></code></pre><h2><strong>Hyphen (-)</strong></h2><p>In Nepali, a Hyphen (&#2351;&#2379;&#2332;&#2325; &#2330;&#2367;&#2344;&#2381;&#2361;) is used in linking word pairs: opposite, analogy or similar, together. In such cases, the hyphen is considered as a part of the token itself.</p><pre><code><code>&#2332;&#2368;&#2357;&#2344;-&#2346;&#2381;&#2352;&#2325;&#2381;&#2352;&#2367;&#2351;&#2366;

&#2310;-&#2310;&#2347;&#2381;&#2344;&#2379;

&#2360;-&#2360;&#2366;&#2344;&#2379;
</code></code></pre><p>However, in many online texts, hyphens are also being used in place of one of the &#2344;&#2367;&#2352;&#2381;&#2342;&#2375;&#2358;&#2325; &#2330;&#2367;&#2344;&#2381;&#2361;: dash (&#8212;). In this case, there are two ways in which a hyphen is used.</p><p>For the first case, the hyphen occurs independently.</p><pre><code><code># Independent hyphen i.e. not attached to the word
&#2310;&#2325;&#2381;&#2352;&#2379;&#2358; - &#2328;&#2366;&#2350;
</code></code></pre><p>In case, as shown above, the hyphen is simply replaced with a white space.</p><p>In the second case the hyphen is attached to the end of a word. In such cases the hyphen is tokenized with the word as a part of the word and then all the hyphens that occurs as the last character in the token is removed.</p><pre><code><code>if word[len(word) - 1:] == '-':
    words.append(word[:len(word) - 1])

</code></code></pre><pre><code><code>INPUT: 

&#2310;-&#2310;&#2347;&#2381;&#2344;&#2379; &#2348;&#2366;&#2335;&#2379; &#2354;&#2366;&#2327;&#2375;- &#2349;&#2344;&#2381;&#2342;&#2376; - &#2358;&#2381;&#2351;&#2366;&#2350;&#2346;&#2344;&#2367; &#2310;&#2347;&#2381;&#2344;&#2379; &#2348;&#2366;&#2335;&#2379; &#2361;&#2367;&#2337;&#2381;&#2351;&#2379;&#2404;

OUTPUT:

['&#2310;-&#2310;&#2347;&#2381;&#2344;&#2379;', '&#2348;&#2366;&#2335;&#2379;', '&#2354;&#2366;&#2327;&#2375;', '&#2349;&#2344;&#2381;&#2342;&#2376;', '&#2358;&#2381;&#2351;&#2366;&#2350;&#2346;&#2344;&#2367;', '&#2310;&#2347;&#2381;&#2344;&#2379;', '&#2348;&#2366;&#2335;&#2379;', '&#2361;&#2367;&#2337;&#2381;&#2351;&#2379;']
</code></code></pre><h2><strong>Colon(:)</strong></h2><p>Colon in Nepali, can occur as a part of word or as &#2344;&#2367;&#2352;&#2381;&#2342;&#2375;&#2358;&#2325; &#2330;&#2367;&#2344;&#2381;&#2361; in place of a dash(&#8212;). Colon, which is a part of word can appear either in between or at the end of the word. Some of such words are listed below.</p><pre><code><code>&#2342;&#2369;:&#2326;
&#2344;&#2367;:&#2360;&#2381;&#2357;&#2366;&#2352;&#2381;&#2341;
&#2350;&#2370;&#2354;&#2340;:
&#2346;&#2381;&#2352;&#2341;&#2350;&#2340;:
&#2325;&#2381;&#2352;&#2350;&#2358;:
</code></code></pre><p>For colon that appear as in place of dash, they have two cases similar to the ones discussed above in hyphen. The first case is handled in the same way the first case of hyphen was handled i.e. by replacing the punctuation with a white space. However, handling the second case where colon appears as the last character of the word is a little tricky because it is difficult to identify if is a part of the word or is used in place of a dash. Since, a handful of words in Nepali end with colon, the current tokenizer uses a lexicon of such words to to understand if the end-of-word colon is a part of the word or is it used in place of a dash.</p><p>The colon is replaced with a white space if the word doesn't exist in the lexicon of words.</p><pre><code><code>if word[len(word) - 1:] == ':' and word not in colon_lexicon:
    words.append(word[:len(word) - 1])
else:
    words.append(word)
</code></code></pre><pre><code><code>INPUT:

&#2351;&#2360;&#2381;&#2340;&#2366; &#2331;&#2344;&#2381;: &#2346;&#2381;&#2352;&#2341;&#2350;&#2340;: &#2344;&#2367;:&#2360;&#2381;&#2357;&#2366;&#2352;&#2381;&#2341;&#2404;

OUTPUT: 

['&#2351;&#2360;&#2381;&#2340;&#2366;', '&#2331;&#2344;&#2381;', '&#2346;&#2381;&#2352;&#2341;&#2350;&#2340;:', '&#2344;&#2367;:&#2360;&#2381;&#2357;&#2366;&#2352;&#2381;&#2341;']
</code></code></pre><h2><strong>Period(.)</strong></h2><p>Period is another punctuation used in Nepali. Unlike in English where a period can be used in two cases: ending a sentence i.e. as a fullstop and as a part of abbreviation, in Nepali it is used for latter only.</p><pre><code><code>&#2327;&#2366;.&#2357;&#2367;.&#2360;.
&#2337;&#2366;.
&#2325;&#2367;.&#2350;&#2368;.
</code></code></pre><p>So, for tokenization of Nepali texts, period is considered as a part of the token itself.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.icodeformybhasa.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading #icodeformy&#2349;&#2366;&#2359;&#2366;! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>