paper-with-me

홈 › Papers

Cut Your Losses in Large-Vocabulary Language Models

2024-11-13 · Erik Wijmans, Brody Huval, Alexander Hertzberg, Vladlen Koltun, Philipp Krähenbühl

As language models grow ever larger, so do their vocabularies. This has shifted the memory footprint of LLMs during training disproportionately to one single layer: the cross-entropy in the loss computation. Cross-entropy builds up a logit matrix with entries for each pair of input tokens and vocabulary items and, for small models, consumes an order of magnitude more memory than the rest of the LLM combined. We propose Cut Cross-Entropy (CCE), a method that computes the cross-entropy loss without materializing the logits for all tokens into global memory. Rather, CCE only computes the logit for the correct token and evaluates the log-sum-exp over all logits on the fly. We implement a custom kernel that performs the matrix multiplications and the log-sum-exp reduction over the vocabulary in flash memory, making global memory consumption for the cross-entropy computation negligible. This has a dramatic effect. Taking the Gemma 2 (2B) model as an example, CCE reduces the memory footprint of the loss computation from 24 GB to 1 MB, and the total training-time memory consumption of the classifier head from 28 GB to 1 GB. To improve the throughput of CCE, we leverage the inherent sparsity of softmax and propose to skip elements of the gradient computation that have a negligible (i.e., below numerical precision) contribution to the gradient. Experiments demonstrate that the dramatic reduction in memory consumption is accomplished without sacrificing training speed or convergence.

📄 PDF Abstract BibTeX arXiv:2411.09009

Code (2)

apple/ml-cross-entropy 공식 구현 pytorch
unslothai/unsloth pytorch

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
SPEED The monocular depth estimation (MDE) is the task of estimating depth from a single frame. This information is an essential knowledge in many computer vision tasks such as scene…

Similar Papers 제목 키워드 기반

Lay-Your-Scene: Natural Scene Layout Generation with Diffusion Transformers

2025-05-07 · Divyansh Srivastava, Xiang Zhang, He Wen, Chenru Wen 외

We present Lay-Your-Scene (shorthand LayouSyn), a novel text-to-layout generation pipeline for natural scenes. Prior scene layout generation methods are either closed-vocabulary or use proprietary large language models f…

Image GenerationLayout Generation

Check Your LLM's Secret Dictionary! Five Lines of Code Reveal What Your LLM Learned (Including What It Shouldn't Have)

2026-05-21 · Hisashi Miyashita arxiv

We show that singular value decomposition of the lm_head} weight matrix of a transformer-based large language model -- requiring only five lines of PyTorch and no model inference -- reveals interpretable semantic subspac…

RWTH-PHOENIX-Weather: A Large Vocabulary Sign Language Recognition and Translation Corpus

2012-05-01 · LREC 2012 5 · Jens Forster, Christoph Schmidt, Thomas Hoyoux, Oscar Koller 외

This paper introduces the RWTH-PHOENIX-Weather corpus, a video-based, large vocabulary corpus of German Sign Language suitable for statistical sign language recognition and translation. In contrastto most available sign …

Automatic Speech RecognitionAutomatic Speech Recognition (ASR)Machine TranslationSentence+4

Retrieval-Augmented Open-Vocabulary Object Detection

2024-04-08 · CVPR 2024 1 · Jooyeon Kim, Eulrang Cho, Sehyung Kim, Hyunwoo J. Kim

Open-vocabulary object detection (OVD) has been studied with Vision-Language Models (VLMs) to detect novel objects beyond the pre-trained categories. Previous approaches improve the generalization ability to expand the k…

Language ModelingLanguage ModellingLarge Language ModelObject+7

GenQuest: An LLM-based Text Adventure Game for Language Learners

2025-10-06 · Qiao Wang, Adnan Labib, Robert Swier, Michael Hofmeyr 외 arxiv

GenQuest is a generative text adventure game that leverages Large Language Models (LLMs) to facilitate second language learning through immersive, interactive storytelling. The system engages English as a Foreign Languag…