<?xml version="1.0" encoding="UTF-8" ?><!-- generator=Zoho Sites --><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><atom:link href="https://www.nownextlater.ai/Insights/tag/tokenizer/feed" rel="self" type="application/rss+xml"/><title>Now Next Later AI - Blog #Tokenizer</title><description>Now Next Later AI - Blog #Tokenizer</description><link>https://www.nownextlater.ai/Insights/tag/tokenizer</link><lastBuildDate>Wed, 26 Nov 2025 21:23:55 +1100</lastBuildDate><generator>http://zoho.com/sites/</generator><item><title><![CDATA[Language Model Tokenization Reveals Significant Disparities Across Languages: Implications for Businesses and Users]]></title><link>https://www.nownextlater.ai/Insights/post/language-model-tokenization-reveals-significant-disparities-across-languages-implications-for-busine</link><description><![CDATA[<img align="left" hspace="5" src="https://www.nownextlater.ai/Screenshot 2024-04-29 at 12.25.09 pm.png"/>In this article, we'll dive into a recent study that uncovers substantial disparities in the tokenization process used by language models across different languages.]]></description><content:encoded><![CDATA[<div class="zpcontent-container blogpost-container "><div data-element-id="elm_C3_ooyGQRiyFng1ZLDBhOw" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer-fluid zpcontainer"><div data-element-id="elm_k3QeQrRoTvSjKQeOk60gvg" data-element-type="row" class="zprow zprow-container zpalign-items- zpjustify-content- " data-equal-column=""><style type="text/css"></style><div data-element-id="elm_u8BcqDWMTWSgs5iEhH5Usg" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_F6-dDNDmBOusriRjt3xREQ" data-element-type="image" class="zpelement zpelem-image "><style> @media (min-width: 992px) { [data-element-id="elm_F6-dDNDmBOusriRjt3xREQ"] .zpimage-container figure img { width: 500px ; height: 564.58px ; } } @media (max-width: 991px) and (min-width: 768px) { [data-element-id="elm_F6-dDNDmBOusriRjt3xREQ"] .zpimage-container figure img { width:500px ; height:564.58px ; } } @media (max-width: 767px) { [data-element-id="elm_F6-dDNDmBOusriRjt3xREQ"] .zpimage-container figure img { width:500px ; height:564.58px ; } } [data-element-id="elm_F6-dDNDmBOusriRjt3xREQ"].zpelem-image { border-radius:1px; } </style><div data-caption-color="" data-size-tablet="" data-size-mobile="" data-align="center" data-tablet-image-separate="false" data-mobile-image-separate="false" class="zpimage-container zpimage-align-center zpimage-size-medium zpimage-tablet-fallback-medium zpimage-mobile-fallback-medium hb-lightbox " data-lightbox-options="
                type:fullscreen,
                theme:dark"><figure role="none" class="zpimage-data-ref"><span class="zpimage-anchor" role="link" tabindex="0" aria-label="Open Lightbox" style="cursor:pointer;"><picture><img class="zpimage zpimage-style-none zpimage-space-none " src="/Screenshot%202024-04-29%20at%2012.25.09%E2%80%AFpm.png" width="500" height="564.58" loading="lazy" size="medium" alt="Premiums with respect to En- glish on FLORES-200 for several English- centric models." data-lightbox="true"/></picture></span><figcaption class="zpimage-caption zpimage-caption-align-center"><span class="zpimage-caption-content">Premiums with respect to En- glish on FLORES-200 for several English- centric models.</span></figcaption></figure></div>
</div><div data-element-id="elm_Ol3GZWqPS1quBc9elQjJng" data-element-type="text" class="zpelement zpelem-text "><style> [data-element-id="elm_Ol3GZWqPS1quBc9elQjJng"].zpelem-text { border-radius:1px; } </style><div class="zptext zptext-align-center " data-editor="true"><div style="color:inherit;text-align:left;"><div style="color:inherit;text-align:left;">In this article, we'll dive into a recent <a href="https://arxiv.org/pdf/2305.15425" title="study" rel="">study</a> that uncovers substantial disparities in the tokenization process used by language models across different languages. These disparities have significant implications for businesses and users, affecting the cost, latency, and quality of service when using AI-powered language technologies. By understanding these issues, business leaders can make more informed decisions about the adoption and deployment of language models and advocate for the development of more equitable solutions. <br></div></div><div style="color:inherit;text-align:left;"><br><p><span style="font-family:&quot;Archivo Black&quot;, sans-serif;">The Importance of Tokenization in Language Models&nbsp;</span></p><p><br></p><p>Tokenization is the process of breaking down natural language text into smaller units called tokens, which are then used as input for language models. The choice of tokenization method can significantly impact a model's performance and efficiency. Subword tokenization, which breaks down complex words into smaller parts, has become the preferred approach for state-of-the-art language models.</p><p><br></p><p>However, the study revealed that even subword tokenization methods can lead to significant disparities in the number of tokens required to represent the same content across different languages. This has far-reaching consequences for businesses and users relying on language models for various applications.</p><p><span style="font-family:&quot;Archivo Black&quot;, sans-serif;"><br></span></p><p><span style="font-family:&quot;Archivo Black&quot;, sans-serif;">Tokenization Disparities Across Languages&nbsp;</span></p><p><br></p><p>The researchers analyzed the tokenization process of several popular language models, including GPT-2, RoBERTa, and the tokenizers used by ChatGPT and GPT-4. They found that the number of tokens required to represent the same text can vary drastically across languages. For example:</p><ol><li>GPT-2 requires 3 times more tokens to represent the same content in Japanese compared to English.</li><li>The ChatGPT and GPT-4 tokenizers use 1.6 times more tokens for Italian, 2.6 times more for Bulgarian, and 3 times more for Arabic compared to English.</li><li>For Shan, a language spoken in Myanmar, the difference can be as high as 15 times compared to English.</li></ol><p><br></p><p>These disparities persist even in tokenizers specifically designed for multilingual support, with some language pairs showing a 4-fold difference in the number of tokens required.</p><p><span style="font-family:&quot;Archivo Black&quot;, sans-serif;"><br></span></p><p><span style="font-family:&quot;Archivo Black&quot;, sans-serif;">Implications for Businesses and Users&nbsp;</span></p><p><br></p><p>The tokenization disparities across languages have significant implications for businesses and users:</p><ol><li>Cost: Many commercial language model services charge users per token. As a result, users of certain languages may end up paying significantly more for the same task compared to users of English or other more efficiently tokenized languages.</li><li>Latency: The number of tokens directly impacts the processing time for a task. Languages with longer tokenized representations can experience twice the latency compared to English, which may be critical for real-time applications like customer support or emergency services.</li><li>Long Context Processing: Language models often have a fixed context window, limiting the amount of text they can process at once. Users of more efficiently tokenized languages can work with much longer texts compared to users of languages with higher token counts, potentially leading to significant disparities in the quality of service.</li></ol><p><br></p><p><span style="font-family:&quot;Archivo Black&quot;, sans-serif;">The Path Forward: Multilingual Tokenization Fairness&nbsp;</span></p><p><br></p><p>To address these disparities and ensure more equitable access to language technologies, the researchers propose the concept of multilingual tokenization fairness. They argue that tokenizers should produce similar encoded lengths for the same content across languages. This can be achieved by:</p><ol><li>Recognizing that subword tokenization is necessary to achieve parity, as character-level and byte-level representations cannot fully address the issue.</li><li>Ensuring that tokenizers support all Unicode codepoints to handle characters from all languages.</li><li>Building a multilingually fair parallel corpus for training and evaluating tokenizers, with balanced representation of topics, named entities, and diverse translations.</li><li>Developing multilingually fair tokenizers by first training individual monolingual tokenizers for each target language and then merging them while maintaining parity.</li></ol><p>By adopting these principles, language model developers can create more equitable tokenizers that provide similar levels of service across languages, benefiting businesses and users worldwide.</p><p><br></p><p>As language models become increasingly integral to our daily lives, it is crucial that we prioritize fairness and inclusivity in their design and deployment. By understanding the implications of tokenization disparities and taking action to address them, business leaders can play a vital role in shaping a more equitable future for AI-powered language technologies.</p></div><p></p></div>
</div><div data-element-id="elm_BzWdTrdv9UYRWiOUuFgGVw" data-element-type="image" class="zpelement zpelem-image "><style> @media (min-width: 992px) { [data-element-id="elm_BzWdTrdv9UYRWiOUuFgGVw"] .zpimage-container figure img { width: 500px ; height: 500.00px ; } } @media (max-width: 991px) and (min-width: 768px) { [data-element-id="elm_BzWdTrdv9UYRWiOUuFgGVw"] .zpimage-container figure img { width:500px ; height:500.00px ; } } @media (max-width: 767px) { [data-element-id="elm_BzWdTrdv9UYRWiOUuFgGVw"] .zpimage-container figure img { width:500px ; height:500.00px ; } } [data-element-id="elm_BzWdTrdv9UYRWiOUuFgGVw"].zpelem-image { border-radius:1px; } </style><div data-caption-color="" data-size-tablet="" data-size-mobile="" data-align="center" data-tablet-image-separate="false" data-mobile-image-separate="false" class="zpimage-container zpimage-align-center zpimage-size-medium zpimage-tablet-fallback-medium zpimage-mobile-fallback-medium "><figure role="none" class="zpimage-data-ref"><a class="zpimage-anchor" href="/introduction-to-large-language-models-for-business-leaders-book" target="" rel=""><picture><img class="zpimage zpimage-style-none zpimage-space-none " src="/12.png" width="500" height="500.00" loading="lazy" size="medium" alt="Introduction to LLMs for Leaders"/></picture></a></figure></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Mon, 29 Apr 2024 12:28:39 +1000</pubDate></item><item><title><![CDATA[A New LLM for Finance: BloombergGPT]]></title><link>https://www.nownextlater.ai/Insights/post/A-New-LLM-for-Finance-BloombergGPT</link><description><![CDATA[When designing BloombergGPT, a new large language model optimized for financial data, the researchers at Bloomberg made an important decision around tokenization.]]></description><content:encoded><![CDATA[<div class="zpcontent-container blogpost-container "><div data-element-id="elm_LgERJvdpQnmGEWGJ0BF4iQ" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer-fluid zpcontainer"><div data-element-id="elm_dlLM9Wo0TcqY30xfrQFVJw" data-element-type="row" class="zprow zprow-container zpalign-items- zpjustify-content- " data-equal-column=""><style type="text/css"></style><div data-element-id="elm_-qyUhWkLTuK7dJU7MqTs4g" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"> [data-element-id="elm_-qyUhWkLTuK7dJU7MqTs4g"].zpelem-col{ border-radius:1px; } </style><div data-element-id="elm_HuJZ70YsFrNImBOyCB3h1A" data-element-type="image" class="zpelement zpelem-image "><style> @media (min-width: 992px) { [data-element-id="elm_HuJZ70YsFrNImBOyCB3h1A"] .zpimage-container figure img { width: 500px ; height: 327.53px ; } } @media (max-width: 991px) and (min-width: 768px) { [data-element-id="elm_HuJZ70YsFrNImBOyCB3h1A"] .zpimage-container figure img { width:500px ; height:327.53px ; } } @media (max-width: 767px) { [data-element-id="elm_HuJZ70YsFrNImBOyCB3h1A"] .zpimage-container figure img { width:500px ; height:327.53px ; } } [data-element-id="elm_HuJZ70YsFrNImBOyCB3h1A"].zpelem-image { border-radius:1px; } </style><div data-caption-color="" data-size-tablet="" data-size-mobile="" data-align="center" data-tablet-image-separate="false" data-mobile-image-separate="false" class="zpimage-container zpimage-align-center zpimage-size-medium zpimage-tablet-fallback-medium zpimage-mobile-fallback-medium hb-lightbox " data-lightbox-options="
                type:fullscreen,
                theme:dark"><figure role="none" class="zpimage-data-ref"><span class="zpimage-anchor" role="link" tabindex="0" aria-label="Open Lightbox" style="cursor:pointer;"><picture><img class="zpimage zpimage-style-none zpimage-space-none " src="/Screenshot%202023-08-10%20at%201.14.54%20pm.png" width="500" height="327.53" loading="lazy" size="medium" alt="Using BloombergGPT to generate short headline suggestions in a three-shot setting." data-lightbox="true"/></picture></span></figure></div>
</div><div data-element-id="elm_OuSKq5B78wofaYj1lQFryA" data-element-type="text" class="zpelement zpelem-text "><style> [data-element-id="elm_OuSKq5B78wofaYj1lQFryA"].zpelem-text { border-radius:1px; } </style><div class="zptext zptext-align-left " data-editor="true"><div style="color:inherit;"><div style="color:inherit;"><p>Financial technology companies are increasingly turning to artificial intelligence to help analyze data, automate processes, and improve decision making. Bloomberg recently unveiled a new AI system called BloombergGPT that is specially designed to understand financial and business language.</p><p>BloombergGPT is what's known as a large language model (LLM).&nbsp;</p><p><br></p><p>LLMs are AI systems that are trained on massive amounts of text data so they can generate human-like text and engage in tasks like question answering and summarization. They have become very popular in recent years thanks to advances in computing power and AI techniques. Some well-known examples are systems like GPT-4 from OpenAI and BLOOM from Anthropic.</p><p><br></p><p>What makes BloombergGPT different is that it was explicitly trained on financial data sources curated by Bloomberg analysts over decades. This includes 360 billion tokens (words) from sources like financial news, earnings reports, regulatory filings, press releases, and more. The goal was to create an AI system optimized for understanding nuanced financial language.</p><p><br></p><p>To supplement the financial data, BloombergGPT was also trained on 345 billion tokens of more general text from publicly available sources like Wikipedia, books, academic papers, and web content. The combination of financial and general data was intended to make the system adept at both financial tasks and general natural language processing abilities.</p><p><br></p><p>In terms of its technical details, BloombergGPT contains 50 billion parameters. Parameters refer to the adjustable settings inside the model that are tuned during training. More parameters allow the system to learn more complex patterns and relationships. For comparison, GPT-3 has 175 billion parameters.</p><p><br></p><p>BloombergGPT uses an architecture based on the transformer, which is the most common framework used today for large language models. Transformers process text by looking at the entire context rather than processing words one-by-one. This allows them to develop a more holistic understanding of language.</p><p><br></p><p>During training, BloombergGPT was optimized using techniques like activation checkpointing and mixed precision to lower memory usage and increase speed. The result was a system capable of 102 teraflops, or 102 trillion floating point operations per second. This level of compute power was needed to effectively train the 50 billion parameter model.</p><p><br></p><p>To evaluate the capabilities of BloombergGPT, the researchers tested it on a range of financial natural language tasks as well as standard AI benchmarks. On financial tasks, BloombergGPT achieved state-of-the-art results, outperforming other models by significant margins. It performed very well on financial question answering, named entity recognition, and sentiment analysis.</p><p><br></p><p>On general benchmarks, BloombergGPT proved competitive with some models over 100 times its size. While it wasn't always the top performer, it consistently outscored similarly sized models on benchmarks measuring abilities like reasoning, reading comprehension and common sense knowledge.</p><p><br></p><p>The researchers attribute BloombergGPT's effectiveness to three main factors. First and foremost was the high-quality domain-specific data. Second, they believe <a href="https://www.nownextlater.ai/Insights/post/turning-text-into-data-how-bloomberggpt-tokenizes-financial-language" title="their choice of tokenizer" rel="">their choice of tokenizer</a> - the system responsible for breaking text into pieces the model can process - was beneficial. Finally, the model architecture and training techniques allowed them to efficiently train a model competitive with far larger systems.</p><p></p><p><br></p><p>The researchers highlight that creating an AI system of this scale still poses challenges. Instabilities can arise during training that require careful monitoring and intervention. They logged their training process in detail to aid future work.</p><p><br></p><p>Additionally, the authors considered ethical issues like potential biases in financial data and possible misuse of the system. Bloomberg has extensive procedures in place to reduce risks and ensure responsible AI development. However, the company chose not to publicly release the model to minimize chances of data leakage or misuse.</p><p><br></p><p>In conclusion, BloombergGPT represents a milestone for domain-specific natural language AI. Its training process and strong performance on financial tasks demonstrate the value of curated in-domain data. While specialized, the system retains competitive general abilities as well. As financial institutions continue adopting AI, expect systems like BloombergGPT to play an increasing role in driving automation and insights.</p><p><br></p><p>Sources:</p><a href="https://arxiv.org/pdf/2303.17564.pdf" title="BloombergGPT: A Large Language Model for Finance" rel="">BloombergGPT: A Large Language Model for Finance</a></div></div><p></p></div>
</div><div data-element-id="elm_JFp2iWupUd22UPKvlveDzw" data-element-type="image" class="zpelement zpelem-image "><style> @media (min-width: 992px) { [data-element-id="elm_JFp2iWupUd22UPKvlveDzw"] .zpimage-container figure img { width: 800px ; height: 344.00px ; } } @media (max-width: 991px) and (min-width: 768px) { [data-element-id="elm_JFp2iWupUd22UPKvlveDzw"] .zpimage-container figure img { width:500px ; height:215.00px ; } } @media (max-width: 767px) { [data-element-id="elm_JFp2iWupUd22UPKvlveDzw"] .zpimage-container figure img { width:500px ; height:215.00px ; } } [data-element-id="elm_JFp2iWupUd22UPKvlveDzw"].zpelem-image { border-radius:1px; } </style><div data-caption-color="" data-size-tablet="" data-size-mobile="" data-align="center" data-tablet-image-separate="false" data-mobile-image-separate="false" class="zpimage-container zpimage-align-center zpimage-size-large zpimage-tablet-fallback-large zpimage-mobile-fallback-large "><figure role="none" class="zpimage-data-ref"><a class="zpimage-anchor" href="/aibooks" target="" rel=""><picture><img class="zpimage zpimage-style-none zpimage-space-none " src="/Untitled%20design%20-4-.png" width="500" height="215.00" loading="lazy" size="large"/></picture></a></figure></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Thu, 10 Aug 2023 13:43:14 +1000</pubDate></item><item><title><![CDATA[Turning Text into Data: How BloombergGPT Tokenizes Financial Language]]></title><link>https://www.nownextlater.ai/Insights/post/turning-text-into-data-how-bloomberggpt-tokenizes-financial-language</link><description><![CDATA[When designing BloombergGPT, a new large language model optimized for financial data, the researchers at Bloomberg made an important decision around tokenization.]]></description><content:encoded><![CDATA[<div class="zpcontent-container blogpost-container "><div data-element-id="elm_PpY_r34GRc6y7cF_plYJgw" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer-fluid zpcontainer"><div data-element-id="elm_BAutgZsvRw2AA4u_wjzjUA" data-element-type="row" class="zprow zprow-container zpalign-items- zpjustify-content- " data-equal-column=""><style type="text/css"></style><div data-element-id="elm_kU6fS6xMRwKzNS0fF1BgrA" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_ybwgRWJlSROZfRXPob3qLg" data-element-type="text" class="zpelement zpelem-text "><style> [data-element-id="elm_ybwgRWJlSROZfRXPob3qLg"].zpelem-text { border-radius:1px; } </style><div class="zptext zptext-align-left " data-editor="true"><div style="color:inherit;"><p>One of the fundamental challenges in natural language processing is transforming free-form human language into data that machines can understand. The first step in this process is called tokenization – breaking down sentences and documents into small chunks or “tokens”.</p><p><br></p><p>When designing <a href="https://www.nownextlater.ai/Insights/post/A-New-LLM-for-Finance-BloombergGPT" title="BloombergGPT, a new large language model optimized for financial data" rel="">BloombergGPT, a new large language model optimized for financial data</a>, the researchers at Bloomberg made an important decision around tokenization. They opted to use a method called unigram tokenization rather than the more standard approach of byte pair encoding (BPE).</p><p></p><p>To understand this choice, it helps to first understand what tokenization involves and the strengths of different techniques.</p><p><br></p><p><span style="font-family:&quot;Oswald&quot;, sans-serif;font-size:16px;">The Role of the Tokenizer</span></p><p></p><p><br></p><p>The job of a tokenizer is to split input text into tokens that contain one or more characters. Tokens become the basic unit that the model manipulates when processing language.</p><p><br></p><p>With English text, an obvious tokenization would be to split on spaces to get words and punctuation. But for machine learning, it’s common to break words down even further into subword units.</p><p><br></p><p>This offers two main advantages. First, it limits the size of the vocabulary that the model needs to represent. For example, instead of separate tokens for “training” and “trainer”, they can share a common root like “train”.</p><p><br></p><p>Second, the model can process words it hasn’t seen before by recognizing their subword components. This helps the model generalize.</p><p><br></p><p><span style="font-family:&quot;Oswald&quot;, sans-serif;font-size:16px;">Byte Pair Encoding</span></p><p></p><p><br></p><p>The most popular subword tokenization algorithm used in NLP is byte pair encoding (BPE). Originally developed for data compression, it builds up a vocabulary by scanning text and greedily merging frequent pairs of tokens.</p><p><br></p><p>BPE starts by assigning each character as a token. It then iteratively merges the most common pair of tokens until reaching a target vocabulary size. Popular pairs like “in+the” get merged early on.</p><p><br></p><p>This simple probabilistic approach works decently well in practice. BPE is fast to train and produces a vocabulary with reusable subword chunks.</p><p><br></p><p>However, BPE discards the probabilistic model after training. Each merge decision is hard-coded based on frequency alone. At test time, BPE tokenizes text greedily using this fixed vocabulary.</p><p><br></p><p><span style="font-family:&quot;Oswald&quot;, sans-serif;font-size:16px;">Unigram Tokenization</span></p><p></p><p></p><p><br></p><p>BloombergGPT implements a more advanced approach called unigram tokenization. A unigram tokenizer models the probability of tokens directly using techniques from statistical language modeling.</p><p><br></p><p>The probabilities allow unigram tokenizers to capture uncertainty and make “soft” decisions when tokenizing new text. Rather than greedily splitting input using a fixed vocabulary, it chooses the most probable segmentation based on context.</p><p><br></p><p>Unigram tokenizers are first trained on large datasets to learn these token probabilities. The training process gradually removes unlikely token candidates until reaching the target vocabulary size.</p><p><br></p><p>The main advantage over BPE is that unigram keeps the probabilistic model which allows for smarter, context-aware tokenization at inference time.</p><p><br></p><p><span style="font-family:&quot;Oswald&quot;, sans-serif;font-size:16px;">Implementation in BloombergGPT</span></p><p></p><p><br></p><p>For BloombergGPT, the unigram tokenizer was trained specifically on The Pile, a diverse dataset containing both general and domain-specific data.</p><p>After experimenting with different sizes, Bloomberg settled on a 217 token vocabulary (about 131,000 tokens). This is larger than typical for NLP models.</p><p>The researchers argue the customized tokenizer better captures financial terminology. And the large vocabulary encodes more meaning within each token.</p><p><br></p><p>In initial evaluations, BloombergGPT’s unigram tokenizer reduced the size of encoded text compared to BPE and other tokenizers. This suggests it forms an efficient token vocabulary for financial language.</p><p><br></p><p><span style="font-family:&quot;Oswald&quot;, sans-serif;font-size:16px;">Tradeoffs and Considerations</span></p><p></p><p><br></p><p>Unigram tokenization has tradeoffs to consider. The probabilistic modeling approach requires more data and compute to train compared to BPE. The tokenization decisions are also less explainable than simple frequency counts.</p><p><br></p><p>Additionally, vocabularies tailored for specific domains may not generalize as well to other data. So there are open questions around how to balance domain-specific and general tokenization.</p><p><br></p><p>The choice ultimately depends on use cases. For a financial model like BloombergGPT, the benefits of smarter domain-aware tokenization appear to outweigh the costs. But simple, fast methods like BPE remain appealing in many scenarios.</p><p><br></p><p>As language models continue advancing, we’re likely to see more specialized tokenization strategies like unigram. The tokenizer plays a key role in how systems represent and process language. Improvements here translate to downstream gains, enabling models like BloombergGPT to push the state-of-the-art in domains like finance.</p></div><p></p></div>
</div><div data-element-id="elm_2jK8b-RORhTos0e4wduTqg" data-element-type="image" class="zpelement zpelem-image "><style> @media (min-width: 992px) { [data-element-id="elm_2jK8b-RORhTos0e4wduTqg"] .zpimage-container figure img { width: 800px ; height: 344.00px ; } } @media (max-width: 991px) and (min-width: 768px) { [data-element-id="elm_2jK8b-RORhTos0e4wduTqg"] .zpimage-container figure img { width:500px ; height:215.00px ; } } @media (max-width: 767px) { [data-element-id="elm_2jK8b-RORhTos0e4wduTqg"] .zpimage-container figure img { width:500px ; height:215.00px ; } } [data-element-id="elm_2jK8b-RORhTos0e4wduTqg"].zpelem-image { border-radius:1px; } </style><div data-caption-color="" data-size-tablet="" data-size-mobile="" data-align="center" data-tablet-image-separate="false" data-mobile-image-separate="false" class="zpimage-container zpimage-align-center zpimage-size-large zpimage-tablet-fallback-large zpimage-mobile-fallback-large "><figure role="none" class="zpimage-data-ref"><a class="zpimage-anchor" href="/aibooks" target="" rel=""><picture><img class="zpimage zpimage-style-none zpimage-space-none " src="/Untitled%20design%20-4-.png" width="500" height="215.00" loading="lazy" size="large"/></picture></a></figure></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Thu, 10 Aug 2023 13:43:14 +1000</pubDate></item><item><title><![CDATA[What is Tokenization? Let's Explore, Using Novel AI's New Tokenizer as a Use Case]]></title><link>https://www.nownextlater.ai/Insights/post/does-novel-ai-s-new-tokenizer-really-boost-storytelling</link><description><![CDATA[What is Tokenization? Let's Explore, Using Novel AI's New Tokenizer as a Use Case]]></description><content:encoded><![CDATA[<div class="zpcontent-container blogpost-container "><div data-element-id="elm_j92KpyjVQguMwwTuLUblCw" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer-fluid zpcontainer"><div data-element-id="elm_y3ppOIQmQPatJLZsEqQmHA" data-element-type="row" class="zprow zprow-container zpalign-items- zpjustify-content- " data-equal-column=""><style type="text/css"></style><div data-element-id="elm_rPQvraI_QoWt9m8irgPCow" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_SotbxYsxTU7FCItxtgBEhg" data-element-type="image" class="zpelement zpelem-image "><style> @media (min-width: 992px) { [data-element-id="elm_SotbxYsxTU7FCItxtgBEhg"] .zpimage-container figure img { width: 500px ; height: 492.01px ; } } @media (max-width: 991px) and (min-width: 768px) { [data-element-id="elm_SotbxYsxTU7FCItxtgBEhg"] .zpimage-container figure img { width:500px ; height:492.01px ; } } @media (max-width: 767px) { [data-element-id="elm_SotbxYsxTU7FCItxtgBEhg"] .zpimage-container figure img { width:500px ; height:492.01px ; } } [data-element-id="elm_SotbxYsxTU7FCItxtgBEhg"].zpelem-image { border-radius:1px; } </style><div data-caption-color="" data-size-tablet="" data-size-mobile="" data-align="center" data-tablet-image-separate="false" data-mobile-image-separate="false" class="zpimage-container zpimage-align-center zpimage-size-medium zpimage-tablet-fallback-medium zpimage-mobile-fallback-medium hb-lightbox " data-lightbox-options="
                type:fullscreen,
                theme:dark"><figure role="none" class="zpimage-data-ref"><span class="zpimage-anchor" role="link" tabindex="0" aria-label="Open Lightbox" style="cursor:pointer;"><picture><img class="zpimage zpimage-style-none zpimage-space-none " src="/Screenshot%202023-08-10%20at%2011.38.41%20am.png" width="500" height="492.01" loading="lazy" size="medium" alt="Novel AI's Tokenizer" data-lightbox="true"/></picture></span></figure></div>
</div><div data-element-id="elm_M6sQVlnHS5-6esy1xFZy5w" data-element-type="text" class="zpelement zpelem-text "><style> [data-element-id="elm_M6sQVlnHS5-6esy1xFZy5w"].zpelem-text { border-radius:1px; } </style><div class="zptext zptext-align-left " data-editor="true"><div style="color:inherit;"><div style="color:inherit;"><p style="margin-bottom:12pt;"><span style="font-size:10.5pt;font-weight:400;">Tokenization is a foundational step in natural language processing (NLP) and machine learning.&nbsp;</span></p><p style="margin-bottom:12pt;"><span style="font-size:10.5pt;font-weight:400;">Large Language Models are big statistical calculators that work with numbers, not words. Tokenisation converts the words into numbers, with each number representing a position in a dictionary of all the possible words.</span></p><p style="margin-bottom:12pt;"><span style="font-size:10.5pt;font-weight:400;">Tokenization breaks down a piece of text into smaller units, called &quot;tokens.&quot; These tokens can represent whole words, parts of words, or even multiple words in some languages. For instance, the sentence &quot;ChatGPT is fun!&quot; might be broken down into tokens like [&quot;Chat&quot;, &quot;G&quot;, &quot;PT&quot;, &quot; is&quot;, &quot; fun&quot;, &quot;!&quot;].</span></p><p style="margin-bottom:12pt;"><span style="font-size:10.5pt;font-weight:400;">You can choose from multiple tokenization methods, but it's crucial to consistently use the same method during both training and text generation.</span></p><h1 style="margin-bottom:12pt;"><span style="font-size:20pt;font-weight:400;">Why is this important for large language models?</span></h1><ol><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Understanding Context:</span><span style="font-size:10.5pt;font-weight:400;"> By breaking text into tokens, the model can process and understand the context around each token. It's like looking at each puzzle piece and understanding where it might fit in the bigger picture.</span></p></li><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Efficiency: </span><span style="font-size:10.5pt;font-weight:400;">Language models have a limit to how many tokens they can process at once. By tokenizing text, they can manage and process information more efficiently.</span></p></li><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Flexibility:</span><span style="font-size:10.5pt;font-weight:400;"> Different languages have different structures. Tokenization allows these models to be flexible and work with multiple languages. For example, in English, spaces often separate words, but in languages like Chinese, words are often clustered together without spaces. Tokenization helps the model handle such variations.</span></p></li><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Training: </span><span style="font-size:10.5pt;font-weight:400;">When training these models on vast amounts of text, tokenization ensures that the model learns from consistent and standardized units of text.</span></p></li></ol><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">In essence, for large language models, tokenization is a foundational step that allows them to read, understand, and generate human-like text across various languages and contexts.</span></p><h1 style="margin-bottom:10pt;"><span style="font-size:20pt;font-weight:400;">Trade-offs</span></h1><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Different tokenization strategies come with their own sets of trade-offs. Let's delve into some of these key trade-offs:</span></p><ol><li style="font-size:10.5pt;font-weight:700;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Granularity:</span></p></li></ol><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Fine-grained (e.g., character-level):</span></p></li><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Pros: Can handle any word or term, even if it's never seen it before. It's very flexible and can be language-agnostic.</span></p></li><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Cons: Requires more tokens to represent a text, which can be computationally expensive and may not capture semantic meanings as effectively.</span></p></li></ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Coarse-grained (e.g., word-level):</span></p></li><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Pros: Can capture semantic meanings more directly and is often more efficient in terms of the number of tokens used.</span></p></li><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Cons: Struggles with out-of-vocabulary words and might not be as flexible across different languages.</span></p></li></ul></ul><ol start="2"><li style="font-size:10.5pt;font-weight:700;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Language Dependence:</span></p></li></ol><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Language-specific tokenizers:</span></p></li><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Pros: Optimized for a particular language, capturing its nuances and structures effectively.</span></p></li><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Cons: Not versatile. A separate tokenizer would be needed for each language, which isn't scalable for multilingual models.</span></p></li></ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Language-agnostic tokenizers:</span></p></li><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Pros: Can be used across multiple languages, making them ideal for multilingual models.</span></p></li><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Cons: Might not capture the intricacies of each individual language as effectively as a language-specific tokenizer.</span></p></li></ul></ul><ol start="3"><li style="font-size:10.5pt;font-weight:700;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Fixed vs. Dynamic Vocabulary:</span></p></li></ol><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Fixed Vocabulary:</span></p></li><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Pros: Deterministic and consistent in its tokenization. Easier to manage and deploy.</span></p></li><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Cons: Struggles with out-of-vocabulary terms and might become outdated as language evolves.</span></p></li></ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Dynamic (or adaptive) Vocabulary:</span></p></li><ul><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Pros: Can adjust to new terms or slang, making it more flexible and up-to-date.</span></p></li><li style="font-size:11pt;font-weight:400;margin-left:36pt;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:400;">Cons: More complex to implement and might introduce inconsistencies over time.</span></p></li></ul></ul><ol start="4"><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Efficiency vs. Coverage:</span><span style="font-size:10.5pt;font-weight:400;"> Some tokenizers aim for maximum coverage, ensuring they can handle any text thrown at them. Others prioritize efficiency, using the fewest tokens possible to represent a text. There's a balance to strike here: more coverage can mean more computational overhead, while prioritizing efficiency might mean sacrificing the ability to handle rare terms.</span></p></li><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Complexity and Overhead: </span><span style="font-size:10.5pt;font-weight:400;">Advanced tokenization methods, like Byte-Pair Encoding (BPE) or SentencePiece, can handle a wide range of text types and languages. However, they introduce additional computational and implementation overhead compared to simpler methods.</span></p></li><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Consistency:</span><span style="font-size:10.5pt;font-weight:400;"> Some tokenization methods might tokenize the same text differently based on context, leading to potential inconsistencies. While this can be beneficial in capturing nuanced meanings, it can also introduce unpredictability in the model's behavior.</span></p></li></ol><p style="margin-bottom:12pt;"><span style="font-size:10.5pt;font-weight:400;">Choosing a tokenizer for a large language model involves weighing these trade-offs based on the specific goals and constraints of the project. Whether the priority is multilingual support, computational efficiency, or capturing linguistic nuances, understanding these trade-offs is crucial in making an informed decision.</span></p><h1 style="margin-bottom:12pt;"><span style="font-size:20pt;font-weight:400;">Novel AI's Tokenizer to </span><span style="font-size:20pt;font-weight:400;font-style:italic;">&quot;enable stronger storytelling capabilities&quot;</span></h1><p style="margin-bottom:12pt;"><span style="font-size:11pt;font-weight:400;">Novel AI recently developed a custom tokenizer for their AI models. The </span><a href="https://github.com/NovelAI/novelai-tokenizer"><span style="font-size:11pt;font-weight:400;text-decoration:underline;">GitHub project</span></a><span style="font-size:11pt;font-weight:400;"> detailing their process provides an inside look at engineering tradeoffs like vocabulary size, compression ratio, and handling numerals. The focus of this project is to build a tokenizer that enables stronger storytelling capabilities. Let's explore!</span></p><p style="margin-bottom:12pt;"><span style="font-size:11pt;font-weight:400;">On the surface, the new tokenizer offers clear advantages:</span></p><ol><li style="font-size:11pt;font-weight:400;"><p><span style="font-size:11pt;font-weight:700;">Improved Granularity and Flexibility:</span><span style="font-size:11pt;font-weight:400;"> Unlike traditional tokenizers, this one offers a balance between </span><span style="font-size:11pt;font-weight:400;text-decoration:underline;background-color:rgb(2, 184, 187);">word-level and subword-level tokenization</span><span style="font-size:11pt;font-weight:400;">. By breaking down words into meaningful fragments, it can better understand and generate nuanced text. This is especially crucial for storytelling where context, nuance, and subtlety matter.</span></p></li></ol><br><ol start="2"><li style="font-size:11pt;font-weight:400;"><p><span style="font-size:11pt;font-weight:700;">Compression Ratio: </span><span style="font-size:11pt;font-weight:400;">A higher compression ratio means the model can process and understand larger chunks of text at once. </span><span style="font-size:11pt;font-weight:400;text-decoration:underline;background-color:rgb(2, 184, 187);">This is vital for maintaining context in long narratives or when referencing earlier parts of a story</span><span style="font-size:11pt;font-weight:400;">. By achieving a 7-19% higher compression ratio than the LLaMa tokenizer on significant parts of the English dataset, it's evident that the tokenizer is more efficient. This efficiency can translate to richer and more coherent narratives, especially in longer stories.</span></p></li></ol><br><ol start="3"><li style="font-size:11pt;font-weight:400;"><p><span style="font-size:11pt;font-weight:700;">Adaptability and Evolution: </span><span style="font-size:11pt;font-weight:400;">The iterative approach to tokenizer training, with multiple runs and rebalancing, ensures that the tokenizer is optimized for the specific nuances of your dataset. This adaptability is key for evolving storytelling styles and trends.</span></p></li></ol><br><p><span style="font-size:10.5pt;font-weight:400;">Some other pros are mentioned. These are more specific to the Novel AI project:</span></p><br><ol start="4"><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Multilingual Capabilities:</span><span style="font-size:10.5pt;font-weight:400;"> By accommodating both English and Japanese from the start, the tokenizer is designed for bilingual storytelling. This means it can seamlessly switch between languages or even blend them, offering richer narratives and reaching a broader audience.</span></p></li><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Efficient Handling of Unicode Characters: </span><span style="font-size:10.5pt;font-weight:400;">The ability to natively tokenize Unicode characters, especially emojis, allows for more expressive storytelling. Emojis, in modern communication, can convey emotions, context, and tone, making them valuable in narratives. But they are less relevant to novel writing.</span></p></li><li style="font-size:10.5pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:10.5pt;font-weight:700;">Numeric Understanding: </span><span style="font-size:10.5pt;font-weight:400;">Tokenizing numbers digit by digit enhances the model's capability to understand and manipulate numeric values. This is crucial for stories that involve dates, quantities, or any numerical context.</span></p></li></ol><br><p style="margin-bottom:12pt;"><span style="font-size:11pt;font-weight:700;">Disadvantages:</span></p><ol><li style="font-size:11pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:11pt;font-weight:700;">Complexity and Maintenance:</span><span style="font-size:11pt;font-weight:400;"> Training the tokenizer added development time and complexity.</span></p></li><li style="font-size:11pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:11pt;font-weight:700;">BPE vs. Unigram: </span><span style="font-size:11pt;font-weight:400;">The decision to choose BPE over Unigram was based on compression ratio. While BPE might offer better compression, Unigram might provide more natural word segmentations. <span style="background-color:rgb(2, 184, 187);">The storytelling quality might be affected if the tokenizer doesn't segment words in a way that's intuitive to human readers.</span></span></p></li><li style="font-size:11pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:11pt;font-weight:700;">Multilingual Limitations: </span><span style="font-size:11pt;font-weight:400;">While accommodating both English and Japanese is a strength, it might also be a limitation. The tokenizer might be overly specialized for these two languages, potentially making it less effective for other languages or multilingual contexts beyond English and Japanese.</span></p></li><li style="font-size:11pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:11pt;font-weight:700;">Vocabulary Size: </span><span style="font-size:11pt;font-weight:400;">The decision to use a vocabulary size of 65535 tokens, while efficient from a computational standpoint, might introduce limitations. Is this size sufficient to capture the nuances of both English and Japanese, especially given the richness of the Japanese writing system?</span></p></li><li style="font-size:11pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:11pt;font-weight:700;">Numeric Tokenization:</span><span style="font-size:11pt;font-weight:400;"> Tokenizing numbers digit by digit can indeed improve the model's understanding of numeric values. However, it might also make the model less adept at recognizing larger numerical patterns or relationships between numbers.</span></p></li><li style="font-size:11pt;font-weight:400;"><p style="margin-bottom:10pt;"><span style="font-size:11pt;font-weight:700;">Handling of Unicode Characters:</span><span style="font-size:11pt;font-weight:400;"> While the ability to natively tokenize Unicode characters is a strength, there's a potential for overfitting or misinterpretation. Emojis and other Unicode characters can have different meanings in different contexts or cultures. Relying heavily on them might lead to misunderstandings in generated narratives.</span></p></li></ol></div></div><p></p></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Thu, 10 Aug 2023 11:43:18 +1000</pubDate></item></channel></rss>