• bitcoinBitcoin(BTC)$79,350.00-2.27%
  • ethereumEthereum(ETH)$2,282.16-3.28%
  • tetherTether(USDT)$1.00-0.05%
  • binancecoinBNB(BNB)$707.01-6.55%
  • rippleXRP(XRP)$1.26-5.39%
  • usd-coinUSDC(USDC)$1.00-0.02%
  • solanaSolana(SOL)$97.52-4.69%
  • tronTRON(TRX)$0.3441074.84%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.03-0.36%
  • HyperliquidHyperliquid(HYPE)$93.5815.46%
  • zcashZcash(ZEC)$1,285.56-0.99%
  • dogecoinDogecoin(DOGE)$0.076585-4.34%
  • moneroMonero(XMR)$617.463.27%
  • USDSUSDS(USDS)$1.00-0.16%
  • whitebitWhiteBIT Coin(WBT)$76.06-2.41%
  • leo-tokenLEO Token(LEO)$9.460.37%
  • chainlinkChainlink(LINK)$11.16-5.59%
  • cardanoCardano(ADA)$0.194087-5.95%
  • stellarStellar(XLM)$0.165169-4.68%
  • bitcoin-cashBitcoin Cash(BCH)$278.07-3.74%
  • nearNEAR Protocol(NEAR)$4.22-10.95%
  • RainRain(RAIN)$0.006747-2.39%
  • daiDai(DAI)$1.000.05%
  • Ethena USDeEthena USDe(USDE)$1.00-0.06%
  • litecoinLitecoin(LTC)$55.75-6.05%
  • uniswapUniswap(UNI)$6.71-7.82%
  • USD1USD1(USD1)$1.00-0.13%
  • CantonCanton(CC)$0.096476-4.13%
  • avalanche-2Avalanche(AVAX)$8.52-5.58%
  • suiSui(SUI)$0.89-6.01%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.19-4.45%
  • tether-goldTether Gold(XAUT)$4,013.05-1.11%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • hedera-hashgraphHedera(HBAR)$0.070175-7.05%
  • paypal-usdPayPal USD(PYUSD)$1.00-0.13%
  • BittensorBittensor(TAO)$240.83-6.93%
  • shiba-inuShiba Inu(SHIB)$0.000005-5.23%
  • quant-networkQuant(QNT)$185.28-7.29%
  • crypto-com-chainCronos(CRO)$0.051893-3.32%
  • Ripple USDRipple USD(RLUSD)$1.00-0.07%
  • EthenaEthena(ENA)$0.189834-9.75%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.15-0.01%
  • okbOKB(OKB)$112.491.25%
  • Circle USYCCircle USYC(USYC)$1.140.01%
  • MemeCoreMemeCore(M)$1.02-2.49%
  • BitwayBitway(BTW)$1.52-12.23%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • pepePepe(PEPE)$0.000005-2.47%
  • aaveAave(AAVE)$126.57-6.73%
  • OndoOndo(ONDO)$0.396625-6.16%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

What is Tokenization Drift and How to Fix It?

May 3, 2026
in AI & Technology
Reading Time: 2 mins read
A A
What is Tokenization Drift and How to Fix It?
ShareShareShareShareShare
words     = [p[1] for p in pairs]
ids_ws    = [tokenizer.encode(" " + w,  add_special_tokens=False)[0] for w in words]
ids_nws   = [tokenizer.encode(w, add_special_tokens=False)[0] for w in words]
delta     = [abs(a - b) for a, b in zip(ids_ws, ids_nws)]
 
x = np.arange(len(words))
width = 0.35
 
fig, axes = plt.subplots(1, 2, figsize=(14, 5))
fig.patch.set_facecolor("#FAFAF8")
 
# Left: side-by-side token IDs
ax = axes[0]
ax.set_facecolor("#FAFAF8")
bars1 = ax.bar(x - width/2, ids_ws,  width, label="With leading space",    color="#3B6FE0", alpha=0.85)
bars2 = ax.bar(x + width/2, ids_nws, width, label="Without leading space",  color="#E05C3B", alpha=0.85)
ax.set_xticks(x)
ax.set_xticklabels(words, rotation=30, ha="right", fontsize=9)
ax.set_ylabel("Token ID", fontsize=10)
ax.set_title("Token IDs: ' word'  vs  'word'", fontsize=12, fontweight="bold", pad=12)
ax.legend(fontsize=9)
ax.spines[["top", "right"]].set_visible(False)
ax.grid(axis="y", alpha=0.3)
 
for bar in bars1:
    ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 50,
            str(int(bar.get_height())), ha="center", va="bottom", fontsize=7, color="#3B6FE0")
for bar in bars2:
    ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 50,
            str(int(bar.get_height())), ha="center", va="bottom", fontsize=7, color="#E05C3B")
 
# Right: delta
ax2 = axes[1]
ax2.set_facecolor("#FAFAF8")
color_bars = ["#E05C3B" if d > 500 else "#F0A070" if d > 100 else "#A8C4F0" for d in delta]
bars3 = ax2.bar(words, delta, color=color_bars, alpha=0.9)
ax2.set_ylabel("Absolute Token ID Distance", fontsize=10)
ax2.set_title("How Far Apart Are the Token IDs?", fontsize=12, fontweight="bold", pad=12)
ax2.set_xticklabels(words, rotation=30, ha="right", fontsize=9)
ax2.spines[["top", "right"]].set_visible(False)
ax2.grid(axis="y", alpha=0.3)
 
for bar, d in zip(bars3, delta):
    ax2.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 10,
             str(d), ha="center", va="bottom", fontsize=9, fontweight="bold")
 
high  = mpatches.Patch(color="#E05C3B", alpha=0.9, label="> 500 apart")
med   = mpatches.Patch(color="#F0A070", alpha=0.9, label="100-500 apart")
low   = mpatches.Patch(color="#A8C4F0", alpha=0.9, label="< 100 apart")
ax2.legend(handles=[high, med, low], fontsize=8)
 
plt.tight_layout(pad=2)
plt.suptitle("Tokenization Artifacts: One Space, Completely Different Token", 
             fontsize=14, fontweight="bold", y=1.02)
plt.savefig("tokenization_artifact.png", dpi=150, bbox_inches="tight", facecolor="#FAFAF8")
plt.show()

Credit: Source link

YOU MAY ALSO LIKE

SoFi Says It’s Well Positioned for Economic Uncertainty

Defense Contractor Anduril Will Build American-Made Laptop With Qualcomm

ShareTweetSendSharePin

Related Posts

SoFi Says It’s Well Positioned for Economic Uncertainty
AI & Technology

SoFi Says It’s Well Positioned for Economic Uncertainty

October 29, 2026
Defense Contractor Anduril Will Build American-Made Laptop With Qualcomm
AI & Technology

Defense Contractor Anduril Will Build American-Made Laptop With Qualcomm

October 29, 2026
Breaking Down Anthropic’s S1 Filing
AI & Technology

Breaking Down Anthropic’s S1 Filing

October 29, 2026
Rivian Licenses AI Voice Assistant Technology Through Volkswagen JV – Unite.AI
AI & Technology

Rivian Licenses AI Voice Assistant Technology Through Volkswagen JV – Unite.AI

October 29, 2026
Next Post
Sakana AI Introduces KAME: A Tandem Speech-to-Speech Architecture That Injects LLM Knowledge in Real Time

Sakana AI Introduces KAME: A Tandem Speech-to-Speech Architecture That Injects LLM Knowledge in Real Time

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
The Ideal Switch 2 Controller For Players On The Go

The Ideal Switch 2 Controller For Players On The Go

October 23, 2026
U.S. citizen among 12 killed in attack on Saudi airport

U.S. citizen among 12 killed in attack on Saudi airport

October 27, 2026
‘Republican wave’ unlikely but House GOP can ‘hold their own,’ says outgoing congressman

‘Republican wave’ unlikely but House GOP can ‘hold their own,’ says outgoing congressman

October 25, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!