ChatPaper.aiChatPaper

FoNE: Embedding Precise di Numeri a Singolo Token tramite Caratteristiche di Fourier

FoNE: Precise Single-Token Number Embeddings via Fourier Features

February 13, 2025
Autori: Tianyi Zhou, Deqing Fu, Mahdi Soltanolkotabi, Robin Jia, Vatsal Sharan
cs.AI

Abstract

I Large Language Models (LLMs) rappresentano tipicamente i numeri utilizzando più token, il che richiede al modello di aggregare questi token per interpretare i valori numerici. Questa frammentazione rende sia l'addestramento che l'inferenza meno efficienti e influisce negativamente sulle prestazioni del modello nei compiti legati ai numeri. Ispirati dall'osservazione che i LLMs pre-addestrati apprendono internamente caratteristiche di tipo Fourier per i token numerici, proponiamo Fourier Number Embedding (FoNE), un metodo innovativo che mappa direttamente i numeri nello spazio di embedding con le loro caratteristiche di Fourier. FoNE codifica ogni numero come un singolo token con solo due dimensioni di embedding per cifra, catturando efficacemente i valori numerici senza frammentazione. Questa rappresentazione compatta accelera sia l'addestramento che l'inferenza. Rispetto ai tradizionali embedding subword e cifra per cifra, FoNE non solo riduce il sovraccarico computazionale ma raggiunge anche una maggiore accuratezza in vari compiti numerici, tra cui addizione, sottrazione e moltiplicazione. Nell'addizione decimale a 6 cifre, FoNE richiede 64 volte meno dati per raggiungere il 99% di accuratezza rispetto agli embedding subword e cifra per cifra, utilizzando rispettivamente 3 volte e 6 volte meno token per numero. Inoltre, FoNE è l'unico metodo che ottiene il 100% di accuratezza su oltre 100.000 esempi di test per addizione, sottrazione e moltiplicazione. I codici e le visualizzazioni sono disponibili all'indirizzo https://fouriernumber.github.io/.
English
Large Language Models (LLMs) typically represent numbers using multiple tokens, which requires the model to aggregate these tokens to interpret numerical values. This fragmentation makes both training and inference less efficient and adversely affects the model's performance on number-related tasks. Inspired by the observation that pre-trained LLMs internally learn Fourier-like features for number tokens, we propose Fourier Number Embedding (FoNE), a novel method that directly maps numbers into the embedding space with their Fourier features. FoNE encodes each number as a single token with only two embedding dimensions per digit, effectively capturing numerical values without fragmentation. This compact representation accelerates both training and inference. Compared to traditional subword and digit-wise embeddings, FoNE not only reduces computational overhead but also achieves higher accuracy across various numerical tasks including addition, subtraction and multiplication. On 6-digit decimal addition, FoNE requires 64times less data to achieve 99% accuracy than subword and digit-wise embeddings while using 3times and 6times fewer tokens per number, respectively. Furthermore, FoNE is the only method that yields 100% accuracy on over 100,000 test examples for addition, subtraction, and multiplication. The codes and visualization are available at https://fouriernumber.github.io/.

Summary

AI-Generated Summary

PDF133February 17, 2025