• bitcoinBitcoin(BTC)$60,081.00-1.80%
  • ethereumEthereum(ETH)$1,691.75-1.72%
  • tetherTether(USDT)$1.00-0.02%
  • binancecoinBNB(BNB)$548.50-1.28%
  • usd-coinUSDC(USDC)$1.00-0.01%
  • rippleXRP(XRP)$0.92-2.45%
  • solanaSolana(SOL)$69.97-3.44%
  • tronTRON(TRX)$0.3079790.25%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.040.00%
  • HyperliquidHyperliquid(HYPE)$62.25-2.71%
  • zcashZcash(ZEC)$722.79-8.97%
  • moneroMonero(XMR)$496.93-1.06%
  • dogecoinDogecoin(DOGE)$0.055100-1.04%
  • leo-tokenLEO Token(LEO)$9.14-0.09%
  • chainlinkChainlink(LINK)$8.86-0.70%
  • whitebitWhiteBIT Coin(WBT)$56.92-2.95%
  • USDSUSDS(USDS)$1.00-0.01%
  • cardanoCardano(ADA)$0.144383-0.89%
  • Ethena USDeEthena USDe(USDE)$1.000.00%
  • stellarStellar(XLM)$0.124899-2.93%
  • daiDai(DAI)$1.000.00%
  • bitcoin-cashBitcoin Cash(BCH)$197.48-1.10%
  • nearNEAR Protocol(NEAR)$2.88-4.11%
  • litecoinLitecoin(LTC)$40.45-1.31%
  • CantonCanton(CC)$0.075040-2.32%
  • avalanche-2Avalanche(AVAX)$6.58-2.01%
  • tether-goldTether Gold(XAUT)$3,616.820.13%
  • uniswapUniswap(UNI)$4.69-1.22%
  • USD1USD1(USD1)$1.00-0.01%
  • Ripple USDRipple USD(RLUSD)$1.00-0.01%
  • the-open-networkGram (prev. Toncoin)(GRAM)$0.96-2.89%
  • suiSui(SUI)$0.65-3.18%
  • Global DollarGlobal Dollar(USDG)$1.00-0.01%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.150.02%
  • paypal-usdPayPal USD(PYUSD)$1.00-0.01%
  • hedera-hashgraphHedera(HBAR)$0.050658-3.15%
  • quant-networkQuant(QNT)$147.29-6.24%
  • BittensorBittensor(TAO)$182.40-3.95%
  • RainRain(RAIN)$0.002973-3.77%
  • shiba-inuShiba Inu(SHIB)$0.000004-1.94%
  • crypto-com-chainCronos(CRO)$0.040045-1.75%
  • Spiko Amundi Overnight Swap Fund (EUR)Spiko Amundi Overnight Swap Fund (EUR)(EURSAFO)$1.120.26%
  • Circle USYCCircle USYC(USYC)$1.140.00%
  • MemeCoreMemeCore(M)$0.781.40%
  • Falcon USDFalcon USD(USDF)$0.99-0.10%
  • okbOKB(OKB)$81.26-2.10%
  • pax-goldPAX Gold(PAXG)$3,618.020.13%
  • United StablesUnited Stables(U)$1.00-0.03%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • usddUSDD(USDD)$1.00-0.11%
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

Stochastic Gradient Descent (SGD’s) Frequency Bias and How Adam Fixes It 

May 18, 2026
in AI & Technology
Reading Time: 3 mins read
A A
Stochastic Gradient Descent (SGD’s) Frequency Bias and How Adam Fixes It 
ShareShareShareShareShare
BG   = "#fafaf8"
DARK = "#1a1a1a"

# Color ramp: blue for common tokens, red for rare
TOKEN_COLORS = ["#1a5276", "#2471a3", "#5dade2", "#e67e22", "#c0392b", "#7d2a2a"]

steps = np.arange(N_STEPS)

fig = plt.figure(figsize=(16, 11), facecolor=BG)
fig.suptitle(
    "SGD vs. Adam on Rare Tokens -- Frequency Bias and Variance Normalization",
    fontsize=14, fontweight="bold", color=DARK, y=0.99
)

gs = gridspec.GridSpec(2, 3, figure=fig, hspace=0.45, wspace=0.35)

# ── 1. SGD weight trajectories ────────────────────────────────
ax1 = fig.add_subplot(gs[0, :2])
ax1.set_facecolor(BG)
ax1.axhline(1.0, color=DARK, lw=1, ls="--", alpha=0.3, label="True weight = 1.0")

for i, (token, color) in enumerate(zip(TOKENS, TOKEN_COLORS)):
    ax1.plot(steps, sgd_history[:, i], color=color, lw=1.8,
             label=f"{token} (freq={FREQ[i]:.3f})")

ax1.set_title("SGD -- Weight Trajectories\nRare tokens barely move from zero", fontsize=11, color=DARK)
ax1.set_xlabel("Training Step", fontsize=9)
ax1.set_ylabel("Learned Weight", fontsize=9)
ax1.legend(fontsize=8, loc="right")
ax1.set_ylim(-0.3, 1.6)
ax1.spines[["top", "right"]].set_visible(False)

# Annotate failure zone
ax1.annotate(
    "Rare tokens stuck\nnear zero",
    xy=(N_STEPS * 0.95, sgd_history[-1, 5]),
    xytext=(N_STEPS * 0.65, -0.15),
    fontsize=8.5, color="#c0392b",
    arrowprops=dict(arrowstyle="->", color="#c0392b", lw=1.2),
    bbox=dict(boxstyle="round,pad=0.3", facecolor="#fff0f0", edgecolor="#c0392b", alpha=0.85)
)

# ── 2. Final weight error bar chart ───────────────────────────
ax2 = fig.add_subplot(gs[0, 2])
ax2.set_facecolor(BG)

x      = np.arange(6)
w_sgd  = sgd_final
w_adam = adam_final
width  = 0.35

bars_sgd  = ax2.bar(x - width/2, np.abs(w_sgd  - TRUE_W), width, color="#c0392b", alpha=0.85, label="SGD error")
bars_adam = ax2.bar(x + width/2, np.abs(w_adam - TRUE_W), width, color="#2980b9", alpha=0.85, label="Adam error")

ax2.set_xticks(x)
ax2.set_xticklabels([t[:8] for t in TOKENS], rotation=30, ha="right", fontsize=8)
ax2.set_ylabel("|learned w − true w|", fontsize=9)
ax2.set_title("Final Weight Error\n(lower = better)", fontsize=11, color=DARK)
ax2.legend(fontsize=8)
ax2.spines[["top", "right"]].set_visible(False)

# ── 3. Adam weight trajectories ───────────────────────────────
ax3 = fig.add_subplot(gs[1, :2])
ax3.set_facecolor(BG)
ax3.axhline(1.0, color=DARK, lw=1, ls="--", alpha=0.3, label="True weight = 1.0")

for i, (token, color) in enumerate(zip(TOKENS, TOKEN_COLORS)):
    ax3.plot(steps, adam_history[:, i], color=color, lw=1.8,
             label=f"{token} (freq={FREQ[i]:.3f})")

ax3.set_title("Adam -- Weight Trajectories\nRare tokens converge via variance normalization", fontsize=11, color=DARK)
ax3.set_xlabel("Training Step", fontsize=9)
ax3.set_ylabel("Learned Weight", fontsize=9)
ax3.legend(fontsize=8, loc="right")
ax3.set_ylim(-0.3, 1.6)
ax3.spines[["top", "right"]].set_visible(False)

ax3.annotate(
    "Rare tokens converge\ndespite sparse gradients",
    xy=(N_STEPS * 0.95, adam_history[-1, 5]),
    xytext=(N_STEPS * 0.60, 0.3),
    fontsize=8.5, color="#27ae60",
    arrowprops=dict(arrowstyle="->", color="#27ae60", lw=1.2),
    bbox=dict(boxstyle="round,pad=0.3", facecolor="#f0fff4", edgecolor="#27ae60", alpha=0.85)
)

# ── 4. Effective LR vs frequency ─────────────────────────────
ax4 = fig.add_subplot(gs[1, 2])
ax4.set_facecolor(BG)

ax4.scatter(FREQ, effective_lr, c=TOKEN_COLORS, s=120, zorder=5, edgecolors="white", lw=1.5)
for i, token in enumerate(TOKENS):
    ax4.annotate(token, (FREQ[i], effective_lr[i]),
                 textcoords="offset points", xytext=(6, 4), fontsize=7.5, color=TOKEN_COLORS[i])

ax4.axhline(LR, color=DARK, lw=1, ls="--", alpha=0.4)
ax4.text(0.5, LR * 1.05, f"Nominal LR = {LR}", fontsize=8, color=DARK, alpha=0.6)

ax4.set_xscale("log")
ax4.set_yscale("log")
ax4.set_xlabel("Token Frequency (log scale)", fontsize=9)
ax4.set_ylabel("Adam Effective LR  lr/√v̂  (log scale)", fontsize=9)
ax4.set_title("Adam's Automatic Equalizer\nRare tokens get amplified LR", fontsize=11, color=DARK)
ax4.spines[["top", "right"]].set_visible(False)

plt.savefig("sgd_vs_adam.png", dpi=150, bbox_inches="tight", facecolor=BG)
plt.show()

Credit: Source link

YOU MAY ALSO LIKE

Exein Launches Ray AI Agent to Prioritize Firmware Security Fixes – Unite.AI

ASRock Industrial Launches RBK-100 Physical AI Development Kit – Unite.AI

ShareTweetSendSharePin

Related Posts

Exein Launches Ray AI Agent to Prioritize Firmware Security Fixes – Unite.AI
AI & Technology

Exein Launches Ray AI Agent to Prioritize Firmware Security Fixes – Unite.AI

November 24, 2026
ASRock Industrial Launches RBK-100 Physical AI Development Kit – Unite.AI
AI & Technology

ASRock Industrial Launches RBK-100 Physical AI Development Kit – Unite.AI

November 24, 2026
OpenAI Employee Who Secretly Recorded Meetings Allegedly Affiliated With The Saudi Government
AI & Technology

OpenAI Employee Who Secretly Recorded Meetings Allegedly Affiliated With The Saudi Government

November 24, 2026
ATOM Signs ¥4.5B in Loan Facilities for GPU Cluster, Humanoid Output – Unite.AI
AI & Technology

ATOM Signs ¥4.5B in Loan Facilities for GPU Cluster, Humanoid Output – Unite.AI

November 24, 2026
Next Post
TrumpRx expands to offer over 600 generic drugs, partners with Mark Cuban

TrumpRx expands to offer over 600 generic drugs, partners with Mark Cuban

Leave a Reply Cancel reply

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

Search

No Result
View All Result
Russian operative likely behind fake videos targeting Texas Senate candidate James Talarico

Russian operative likely behind fake videos targeting Texas Senate candidate James Talarico

November 18, 2026
Suspected Chinese spy Alice Huang’s husband Kang Wei ran state-backed AI empire: report

Suspected Chinese spy Alice Huang’s husband Kang Wei ran state-backed AI empire: report

November 17, 2026
Anthropic Makes Historic Debut on Nasdaq

Anthropic Makes Historic Debut on Nasdaq

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!