메뉴
HN
Hacker News • 21일 전

LLM을 '다음 토큰 예측기'로 보는 건 잘못된 사고방식이다

IMP
7/10
핵심 요약

LLM을 단순한 '다음 토큰 예측기'로 이해하는 것은 사전학습(pre-training)만 설명하는 불완전한 모델이라는 주장입니다. 검증 가능한 보상 기반 강화학습(RLVR)을 통한 후속학습(post-training)은 모델이 기존 학습 데이터를 모방하는 것을 넘어, 스스로 생성한 새로운 시퀀스의 결과로부터 학습하게 만듭니다. 체스 엔진 비유를 통해 '기존 데이터의 다음 수를 예측하는 것'과 '이기는 수를 선택하는 것'의 차이를 설명합니다.

번역된 본문

LLM을 엄격히 '다음 토큰 예측기'로 생각하는 것을 멈춰라

엄밀히 말해 "LLM은 다음 토큰 예측기(next-token predictor)다"라는 말은 틀린 것이 아니지만, 불완전하다. 이는 훌륭한 영차 근사(zeroth-order approximation)이며, 실제 근거에 기반한다. 트랜스포머 기반 언어 모델은 토큰을 자기회귀적(autoregressive)으로 생성한다:

while not done:
    tokens.append(model.sample_next_token(tokens))

이것은 분명 다음 토큰 예측기라고 부를 만한 형태를 하고 있다. 사전학습(pre-training) 동안 모델은 반복적으로 이전 토큰들을 받아들이고, 그 뒤에 실제로 이어진 토큰을 살펴보며, 그 토큰이 다음에 샘플링될 가능성을 높인다. 개념적으로 사전학습 루프는 다음과 같다:

for tokens in training_data:
    for position in range(1, len(tokens)):
        prior_tokens = tokens[:position]
        actual_next_token = tokens[position]
        model.make_more_likely(actual_next_token, after=prior_tokens)

물론 make_more_likely는 여기서 막대한 작업을 수행한다. 내부적으로는 손실 함수(loss function), 그래디언트(gradient), 파라미터 업데이트가 있지만, 이 글에서는 그것들의 종합적인 효과만 중요하다. 즉, 실제로 다음에 왔던 토큰이 더 likely해진다는 것이다. 결정적으로, 모든 actual_next_token은 학습 데이터에 존재하는 기존 시퀀스에서 온다.

베이스 모델(base model) 또한 다음 토큰 예측기처럼 행동한다고 하는 것이 공정할 것이다. 베이스 모델은 학습 데이터에서 나타나는 대로 다음 토큰을 예측하도록 학습되었기 때문이다.

하지만 우리가 사용하는 LLM은 단순한 베이스 모델이 아니다. 이들은 후속학습(post-training)을 거쳤으며, 현대적 후속학습의 핵심 부분은 검증 가능한 보상 기반 강화학습(RLVR, reinforcement learning with verifiable rewards)이다.

사전학습 동안 모델은 학습 데이터에 이미 존재하는 시퀀스로만 학습한다. 반면 RLVR 동안 모델은 새로운 시퀀스를 생성하며 탐색(explore)하고, 그 결과로부터 학습한다. 개념적으로 RLVR 학습 루프는 다음과 같다:

for task in training_tasks:
    for explored_tokens in model.explore(task):
        reward = evaluate_outcome(task, explored_tokens)
        for position in range(len(explored_tokens)):
            prior_tokens = task + explored_tokens[:position]
            explored_next_token = explored_tokens[position]
            model.make_more_likely(explored_next_token,
                                   after=prior_tokens,
                                   according_to=reward)

make_more_likely는 두 루프에서 같은 종류의 작업을 수행하지만, 근본적으로 다른 이유에서다. 사전학습에서는 그 토큰이 학습 데이터에 나타났기 때문에 actual_next_token을 더 likely하게 만든다. 반면 RLVR에서는 그 토큰을 포함한 탐색된 시퀀스가 높은 보상을 얻었기 때문에 explored_next_token을 더 likely하게 만든다.

따라서 후속학습을 거친 LLM은 여전히 한 번에 토큰 하나씩 생성한다는 점에서 다음 토큰 예측기의 형태를 갖고 있지만, 더 이상 기존 텍스트를 예측하는 것만으로 학습하지 않는다. 자신의 탐색을 통해 만들어진 새로운 시퀀스로부터도 학습한다.

체스 비유

체스 엔진은 이 구분을 더 쉽게 보여준다. 두 개의 체스 시스템을 상상해 보라.

첫 번째는 거대한 그랜드마스터 기보 데이터베이스로 학습된 시스템이다. 그랜드마스터들이 다양한 보드 상황에 어떻게 대응하는지에 있는 패턴을 학습한다. 새로운 포지션이 주어지면, 그랜드마스터가 가장 likely하게 다음에 둘 수를 예측한다. 이것이 '다음 수 예측기(next-move predictor)'다.

두 번째는 가능한 모든 게임을 탐색한 이상화된 체스 엔진이다. 그 철저한 탐색으로부터 모든 가능한 보드 포지션에서의 승리 확률을 알고 있다. 포지션이 주어지면 승리 확률을 가장 높이는 수를 선택한다. 첫 번째 시스템과 달리, 그랜드마스터가 이미 둔 게임만으로 학습하지 않는다. 자신의 탐색이 생성한 게임으로부터도 학습한다.

두 번째 시스템을 "다음 수 예측기"라고 부르는 것은 이상할 것이다. 이것은 데이터셋에 어떤 수가 다음에 나타났는지 예측하려는 것이 아니다. 이기는 수를 선택하려는 것이다.

맺음말

이 글에서 다루지 않았지만, 다른 후속학습 기법들도 중요하다. 예를 들어 인간 피드백 기반 강화학습(RLHF, reinforcement learning from human feedback)은 모델이 사전학습 데이터 전체를 모방하는 것에서 벗어나 유용한 어시스턴트를 시뮬레이션하는 방향으로 이동시킨다. 그리고

원문 보기
원문 보기 (영어)
Stop Thinking of LLMs as Next-Token Predictors Strictly speaking, the statement “LLMs are next-token predictors” isn’t wrong, but it’s incomplete. It’s a fine zeroth-order approximation, and it is grounded in something real: transformer-based language models emit tokens autoregressively: while not done : tokens . append ( model . sample_next_token ( tokens )) This certainly has the shape of something you might call a next-token predictor. During pre-training, the model repeatedly takes some prior tokens, looks at the token that actually followed them, and makes that token more likely to be sampled next. Conceptually, the training loop looks something like this: for tokens in training_data : for position in range ( 1 , len ( tokens )): prior_tokens = tokens [: position ] actual_next_token = tokens [ position ] model . make_more_likely ( actual_next_token , after = prior_tokens , ) make_more_likely is, of course, doing a heroic amount of work here. Under the hood are loss functions, gradients, and parameter updates, but for this post we only care about their combined effect: the token that actually came next becomes more likely. Crucially, every actual_next_token comes from an existing sequence in training_data . It’s probably fair to say that the base model also behaves as a next-token predictor: it is trained to predict next tokens as they occur in its training data. But the LLMs we use are not just base models. They are post-trained, and a key part of modern post-training is reinforcement learning with verifiable rewards (RLVR). During pre-training, the model learns only from sequences that already exist in the training data. During RLVR, the model explores by generating new sequences and learning from their outcomes. Conceptually, the RLVR training loop looks something like this: for task in training_tasks : for explored_tokens in model . explore ( task ): reward = evaluate_outcome ( task , explored_tokens ) for position in range ( len ( explored_tokens )): prior_tokens = task + explored_tokens [: position ] explored_next_token = explored_tokens [ position ] model . make_more_likely ( explored_next_token , after = prior_tokens , according_to = reward , ) make_more_likely is doing the same kind of work in both loops, but for a fundamentally different reason. During pre-training, it makes an actual_next_token more likely because that token appeared in the training data. During RLVR, it makes an explored_next_token more likely because the explored sequence containing it earned a high reward. So while a post-trained LLM still has the shape of a next-token predictor, emitting tokens one at a time, it no longer learns only by predicting existing text. It also learns from new sequences produced through its own exploration. Chess Analogy A chess engine makes this distinction easier to see. Imagine two chess systems. The first is trained on a large database of grandmaster games. It learns patterns in how grandmasters respond to different board positions. Given a new position, it predicts the move a grandmaster would most likely play next. That is a next-move predictor. The second is an idealized chess engine that has explored every possible game. From that exhaustive exploration, it knows the probability of winning from every possible board position. Given a position, it chooses the move that leads to the highest probability of winning. Unlike the first system, it is not trained only on games that grandmasters already played. It also learns from games generated by its own exploration. Calling the second system a “next-move predictor” would be strange. It is not trying to predict what move appeared next in a dataset. It is trying to choose a move that wins. Closing Thoughts I didn’t touch on other post-training techniques in this post, but they matter too. Reinforcement learning from human feedback (RLHF), for example, shifts the model away from imitating its pre-training data as a whole and toward simulating a helpful assistant. And as we saw in this post, RLVR goes further still: it allows an LLM to explore and learn from ideas never seen in its training data. That is why “next-token predictor” is the wrong mental model. It describes the shape of the mechanism, one token emitted after another, while ignoring what that mechanism encodes. A simulation of a helpful assistant and knowledge discovered through exploration can both be encoded in exactly the same next-token loop.