• bitcoinBitcoin(BTC)$60,602.00-0.30%
  • ethereumEthereum(ETH)$1,697.72-0.11%
  • tetherTether(USDT)$1.000.00%
  • binancecoinBNB(BNB)$555.66-0.23%
  • usd-coinUSDC(USDC)$1.000.01%
  • rippleXRP(XRP)$0.95-0.36%
  • solanaSolana(SOL)$71.380.52%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.070.86%
  • tronTRON(TRX)$0.3037980.24%
  • HyperliquidHyperliquid(HYPE)$62.681.51%
  • zcashZcash(ZEC)$703.93-9.35%
  • dogecoinDogecoin(DOGE)$0.0567010.07%
  • moneroMonero(XMR)$461.77-11.03%
  • leo-tokenLEO Token(LEO)$9.101.28%
  • whitebitWhiteBIT Coin(WBT)$61.193.90%
  • chainlinkChainlink(LINK)$9.321.50%
  • USDSUSDS(USDS)$1.00-0.01%
  • cardanoCardano(ADA)$0.1492341.05%
  • Ethena USDeEthena USDe(USDE)$1.00-0.05%
  • stellarStellar(XLM)$0.126840-1.77%
  • daiDai(DAI)$1.000.02%
  • bitcoin-cashBitcoin Cash(BCH)$212.071.77%
  • nearNEAR Protocol(NEAR)$3.06-1.00%
  • litecoinLitecoin(LTC)$44.101.59%
  • CantonCanton(CC)$0.074098-5.98%
  • avalanche-2Avalanche(AVAX)$6.62-0.71%
  • tether-goldTether Gold(XAUT)$3,580.610.62%
  • USD1USD1(USD1)$1.00-0.04%
  • uniswapUniswap(UNI)$4.68-1.86%
  • Ripple USDRipple USD(RLUSD)$1.000.00%
  • suiSui(SUI)$0.67-0.75%
  • the-open-networkGram (prev. Toncoin)(GRAM)$0.96-0.98%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • hedera-hashgraphHedera(HBAR)$0.0539601.75%
  • paypal-usdPayPal USD(PYUSD)$1.000.02%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.15-0.10%
  • quant-networkQuant(QNT)$148.201.66%
  • BittensorBittensor(TAO)$183.53-0.60%
  • shiba-inuShiba Inu(SHIB)$0.000004-0.10%
  • Spiko Amundi Overnight Swap Fund (EUR)Spiko Amundi Overnight Swap Fund (EUR)(EURSAFO)$1.120.01%
  • Circle USYCCircle USYC(USYC)$1.150.00%
  • crypto-com-chainCronos(CRO)$0.039956-0.16%
  • MemeCoreMemeCore(M)$0.83-1.03%
  • RainRain(RAIN)$0.002488-9.69%
  • okbOKB(OKB)$83.190.92%
  • Falcon USDFalcon USD(USDF)$1.000.04%
  • United StablesUnited Stables(U)$1.000.03%
  • pax-goldPAX Gold(PAXG)$3,575.690.53%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • BitwayBitway(BTW)$0.9910.32%
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

Backloggd Urges Users To Change Their Passwords After A Breach

1Password Says It Was Hacked But Users’ Vaults Are Safe

ShareTweetSendSharePin

Related Posts

Backloggd Urges Users To Change Their Passwords After A Breach
AI & Technology

Backloggd Urges Users To Change Their Passwords After A Breach

November 26, 2026
1Password Says It Was Hacked But Users’ Vaults Are Safe
AI & Technology

1Password Says It Was Hacked But Users’ Vaults Are Safe

November 26, 2026
Canada Invests 0 Million More to Expand AI Compute Access Fund – Unite.AI
AI & Technology

Canada Invests $700 Million More to Expand AI Compute Access Fund – Unite.AI

November 26, 2026
Amazon Workers Around The World Plan Strikes And Protests On Black Friday And Cyber Monday
AI & Technology

Amazon Workers Around The World Plan Strikes And Protests On Black Friday And Cyber Monday

November 26, 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
Democratic congressman resigns over sexual misconduct allegations

Democratic congressman resigns over sexual misconduct allegations

November 24, 2026
Rep. Gomez to resign after report of misconduct

Rep. Gomez to resign after report of misconduct

November 24, 2026
🔴Live  – Huge RALLY!!!

🔴Live – Huge RALLY!!!

November 23, 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!