AI

Tokens are a big reason today’s generative AI falls short

Comment

LLM word with icons as vector illustration. AI concept of Large Language Models
Image Credits: Getty Images

Generative AI models don’t process text the same way humans do. Understanding their “token”-based internal environments may help explain some of their strange behaviors — and stubborn limitations.

Most models, from small on-device ones like Gemma to OpenAI’s industry-leading GPT-4o, are built on an architecture known as the transformer. Due to the way transformers conjure up associations between text and other types of data, they can’t take in or output raw text — at least not without a massive amount of compute.

So, for reasons both pragmatic and technical, today’s transformer models work with text that’s been broken down into smaller, bite-sized pieces called tokens — a process known as tokenization.

Tokens can be words, like “fantastic.” Or they can be syllables, like “fan,” “tas” and “tic.” Depending on the tokenizer — the model that does the tokenizing — they might even be individual characters in words (e.g., “f,” “a,” “n,” “t,” “a,” “s,” “t,” “i,” “c”).

Using this method, transformers can take in more information (in the semantic sense) before they reach an upper limit known as the context window. But tokenization can also introduce biases.

Some tokens have odd spacing, which can derail a transformer. A tokenizer might encode “once upon a time” as “once,” “upon,” “a,” “time,” for example, while encoding “once upon a ” (which has a trailing whitespace) as “once,” “upon,” “a,” ” .” Depending on how a model is prompted — with “once upon a” or “once upon a ,” — the results may be completely different, because the model doesn’t understand (as a person would) that the meaning is the same.

Tokenizers treat case differently, too. “Hello” isn’t necessarily the same as “HELLO” to a model; “hello” is usually one token (depending on the tokenizer), while “HELLO” can be as many as three (“HE,” “El,” and “O”). That’s why many transformers fail the capital letter test.

“It’s kind of hard to get around the question of what exactly a ‘word’ should be for a language model, and even if we got human experts to agree on a perfect token vocabulary, models would probably still find it useful to ‘chunk’ things even further,” Sheridan Feucht, a PhD student studying large language model interpretability at Northeastern University, told TechCrunch. “My guess would be that there’s no such thing as a perfect tokenizer due to this kind of fuzziness.”

This “fuzziness” creates even more problems in languages other than English.

Many tokenization methods assume that a space in a sentence denotes a new word. That’s because they were designed with English in mind. But not all languages use spaces to separate words. Chinese and Japanese don’t — nor do Korean, Thai or Khmer.

A 2023 Oxford study found that, because of differences in the way non-English languages are tokenized, it can take a transformer twice as long to complete a task phrased in a non-English language versus the same task phrased in English. The same study — and another — found that users of less “token-efficient” languages are likely to see worse model performance yet pay more for usage, given that many AI vendors charge per token.

Tokenizers often treat each character in logographic systems of writing — systems in which printed symbols represent words without relating to pronunciation, like Chinese — as a distinct token, leading to high token counts. Similarly, tokenizers processing agglutinative languages — languages where words are made up of small meaningful word elements called morphemes, such as Turkish — tend to turn each morpheme into a token, increasing overall token counts. (The equivalent word for “hello” in Thai, สวัสดี, is six tokens.)

In 2023, Google DeepMind AI researcher Yennie Jun conducted an analysis comparing the tokenization of different languages and its downstream effects. Using a dataset of parallel texts translated into 52 languages, Jun showed that some languages needed up to 10 times more tokens to capture the same meaning in English.

Beyond language inequities, tokenization might explain why today’s models are bad at math.

Rarely are digits tokenized consistently. Because they don’t really know what numbers are, tokenizers might treat “380” as one token, but represent “381” as a pair (“38” and “1”) — effectively destroying the relationships between digits and results in equations and formulas. The result is transformer confusion; a recent paper showed that models struggle to understand repetitive numerical patterns and context, particularly temporal data. (See: GPT-4 thinks 7,735 is greater than 7,926).

That’s also the reason models aren’t great at solving anagram problems or reversing words.

So, tokenization clearly presents challenges for generative AI. Can they be solved?

Maybe.

Feucht points to “byte-level” state space models like MambaByte, which can ingest far more data than transformers without a performance penalty by doing away with tokenization entirely. MambaByte, which works directly with raw bytes representing text and other data, is competitive with some transformer models on language-analyzing tasks while better handling “noise” like words with swapped characters, spacing and capitalized characters.

Models like MambaByte are in the early research stages, however.

“It’s probably best to let models look at characters directly without imposing tokenization, but right now that’s just computationally infeasible for transformers,” Feucht said. “For transformer models in particular, computation scales quadratically with sequence length, and so we really want to use short text representations.”

Barring a tokenization breakthrough, it seems new model architectures will be the key.

More TechCrunch

Featured Article

Apple Event 2024: iPhone 16, Apple Intelligence and all the other expected ‘Glowtime’ reveals

Apple’s Glowtime iPhone event will include the iPhone 16, but may also feature new AirPods, a new Apple Watch and possibly even new Macs.

Apple Event 2024: iPhone 16, Apple Intelligence and all the other expected ‘Glowtime’ reveals

Snap is testing a “simplified version of Snapchat,” CEO Evan Spiegel wrote in a letter to employees published on Snap’s website Tuesday. The CEO says the simplified version aims to…

Snap CEO says the company is testing a ‘simplified’  Snapchat

Prevention is better than cure, as the saying goes. Today, a splashy startup that has taken that concept to heart — literally and figuratively — is expanding. Neko Health was…

Neko Health, the body-scanning AI health startup from Spotify’s Daniel Ek, opens in London

The Federal Trade Commission (FTC) published a report about increasing fraud at Bitcoin ATMs. These ATMs allow people to turn their cash into crypto, but they’ve become a tool for…

Bitcoin ATMs are a hotbed for scams, FTC says

Volkswagen is taking its ChatGPT voice assistant experiment on the road. Or more specifically, to vehicles it sells in the United States.  The German automaker announced in January at CES…

Volkswagen is rolling out its ChatGPT assistant to the US

From idea to IPO, Disrupt charts startups at every stage on the roadmap to their next breakthrough. TechCrunch will gather some of the startup world’s leading companies — but our…

Learn startup best practices with MongoDB, Venture Backed, InterSystems and others at Disrupt 2024

Android introduced five updates on Tuesday as part of its latest release of the mobile operating system. Available for smartphones, tablets and Wear OS watches, the new features include audio…

Android’s latest update improves text-to-speech, Circle to Search, earthquake alerts and more

Google announced on Tuesday it’s releasing Android 15 and making its source code available ahead of the coming consumer launch, which will bring the new mobile operating system to supported…

Android 15 will be available on supported Pixel devices in the coming weeks

As new users downloaded the app, Bluesky jumped to becoming the app to No. 1 in Brazil over the weekend, ahead of Meta’s X competitor, Instagram Threads.

Bluesky continues to soar, adding 2M more new users in a matter of days

Welcome to TechCrunch Fintech! This week, we’re looking at a new real estate startup that’s making big waves with its offering, Klarna and Affirm’s financials, a neobank focused on immigrants…

The flat-rate real estate startup that’s got big players worried and BNPL’s turning a corner

Instagram’s latest feature aims to boost user interaction within Stories. The social media platform now allows followers to comment on each other’s Stories, making the experience more community-focused, akin to…

As more Instagram users engage with Stories, the app adds a comments feature

Curious about how top venture capitalists are positioning themselves for the next wave in the crypto market?  Dragonfly Capital’s Haseeb Qureshi, Galaxy Ventures’ Will Nuelle, and NFX’s Morgan Beller will…

Dragonfly Capital, Galaxy Ventures and NFX share insights on crypto scaling and strategy at TechCrunch Disrupt 2024

Get ready for TechCrunch Disrupt 2024, our signature event for startups of all stages, happening at Moscone West in San Francisco from October 28-30. This year, we’re expecting a massive…

Announcing the final agenda for the Builders Stage at TechCrunch Disrupt 2024

Spotter, the startup that provides financial solutions to content creators, announced Tuesday the launch of its new AI-powered creative suite. Dubbed Spotter Studio, the solution aims to support YouTubers throughout the…

Spotter launches AI tools to help YouTubers brainstorm video ideas, thumbnails and more

This second fund is significant because Gupta expanded it beyond a corporate fund with one main LP — Prudential Financial — into one supported by a number of financial and…

Former Citi, Battery VC has new $378M fund that helps startups land Prudential, Mutual of Omaha, others as investors and customers

The oil and fracking giant says it is “working to identify effects” of the ongoing cyberattack on its oil and fracking operations.

Halliburton confirms data was stolen in ongoing cyberattack

Is Elon’s rumble in the Amazonian jungle on course for a technical knockout? Over the weekend, the Brazilian high court voted to uphold a ban on X that another judge issued…

Elon Musk’s Brazil battle wages on

Flexible green methanol, which is made without fossil fuels, could rid carbon pollution from a range of industries.

Oxylus Energy strikes ‘beautiful balance’ to make e-fuels for aviation and shipping

French billionaire Xavier Niel is joining the board of directors of TikTok’s parent, ByteDance, the company told the South China Morning Post. It’s an interesting move as Niel isn’t a…

Xavier Niel replaces Coatue’s Laffont on board of TikTok parent ByteDance

The Netherlands’ data protection authority has imposed a penalty of €30.5M on Clearview AI for GDPR violations.

Clearview AI hit with its largest GDPR fine yet as Dutch regulator considers holding execs personally liable

X, the social network owned by Elon Musk, is finally rolling out one of the most sought-after features for direct messages: the ability to edit your message. Over the weekend,…

X now lets you edit DMs — here is how to use the feature

The Dubai-based startup, which now counts 50,000 retail and business customers in the UAE, has netted $22 million led by Altos Ventures.

Ziina banks $22M as growth explodes for the UAE-based fintech for small businesses

Fleet is launching several software services on top of its hardware-as-a-service proposition, from device management to cybersecurity and insurance.

Laptop-leasing startup Fleet wants to become the IT companion for small companies

The potential of Cercli’s payroll platform has attracted investor interest, leading to $4 million in seed funding.

Payroll startup Cercli inks $4M to build the ‘Rippling for the Middle East and North Africa’

Hospitals around the world regularly face bed shortages — an issue that can get exacerbated to breaking point when a health scare or other large-scale disaster occurs. A startup called…

‘Hospital at home’ startup Doccla raises $46 million for its European expansion

India’s fabless semiconductor startup BigEndian has raised $3 million in a seed round led by Vertex Ventures SEA and India.

BigEndian founders hope to use their deep chip experience to help establish India in semiconductors

SparkLabs — an early-stage venture capital firm that has made a name for itself for backing OpenAI as well as a host of other AI startups such as Vectara, Allganize,…

SparkLabs closes $50M fund to back AI startups

As companies grapple with the challenge of developing a sustainable business without sacrificing their core principles, open source has evolved from a niche approach to software development into the business…

Accel, Docker and Redis will discuss what’s next in open source as a business model at TechCrunch Disrupt 2024

Whether it’s a sophisticated cocktail party, a casual happy hour, a niche meetup, or a skill-building workshop, “Disrupt Week” offers you the flexibility to host a Side Event that truly…

Enhance your brand at TechCrunch Disrupt 2024 by hosting a Side Event

After joining the firm as an investor in 2022, Lu has seen how AI and new distribution platforms are changing the industry for the better.

a16z’s Joshua Lu says AI is already radically changing video games and Discord is the future