메뉴
HN
Hacker News • 9일 전

제프(Jev) 유사 모델 역설계 공개

IMP
5/10
핵심 요약

TypeSafe가 설계를 공개하지 않은 상업용 'Jev' 모델과 동일한 입출력 구조를 가진 독립 스타터 모델이 오픈소스로 공개되었습니다. 이 모델은 텍스트와 N개의 선택지를 받아 한 번의 패스로 각 옵션별 확률을 반환하는 구조이며, 옵션-어텐션(option-attention) 헤드가 게임 컨트롤러 버튼 선택(둠, 체스)에도 재사용될 수 있음을 데모로 보여줍니다. 합성 데이터 생성·학습·평가·예측까지 빠르게 실행할 수 있는 CLI 퀵스타트도 포함되어 있습니다.

번역된 본문

Jevlike: 변하는 텍스트 옵션 목록 중에서 하나를 선택하는 작은 모델을 학습시킵니다. Jev 유사 모델은 하나의 텍스트와 N개의 텍스트 옵션 목록을 입력받아, 각 옵션에 대해 하나의 확률을 반환합니다. 답을 한 단어씩 생성하는 방식이 아니라 한 번의 패스로 처리합니다. Jev는 TypeSafe가 이런 종류의 작업을 위해 만든 상업용 모델이지만, TypeSafe는 그 설계를 공개하지 않았습니다. 이 저장소는 동일한 입력·출력 형태를 가진 독립적인 스타터 모델입니다.

데모: 동일한 옵션-어텐션 헤드로 이미지 패치에서 컨트롤러 버튼의 점수를 매길 수 있습니다. 10초짜리 영상은 선택된 두 개의 5초 구간을 이어 붙인 것으로, 첫 번째는 둠(Doom)의 7개 버튼으로 치명적인 복도(deadly_corridor)에서 실제 전투를 벌이는 장면, 두 번째는 체스 컨트롤러가 5개 키를 사용해 걸어다니며 수를 두는 장면입니다. 다이어그램은 각 결정에 사용된 텐서를 보여줍니다. 둠 구간은 제공된 공동(joint) 체크포인트에서 나왔으며, 기록된 10개 에피소드에서 평균 0.60킬, 보상 -97.50을 기록했습니다. 체스 구간은 더 강력한 체스 전용 체크포인트에서 나왔으며, 무작위 움직이는 상대(random mover)와의 샘플링된 50게임에서 4승 46무 0패를 기록했지만, Stockfish 레벨 0 상대로는 0승 2무 48패였습니다. 이 구간들은 활동량 기준으로 선별되었으며 일반적인 플레이나 실력을 주장하는 것이 아닙니다.

게임 추가 기능을 설치하고, 공개된 공동 체크포인트로 새로운 640x480 둠 트레이스를 기록하세요:

uv pip install -e '.[games]' python examples/doom/play.py examples/checkpoints/joint-imitation.pt --episodes 10 --game-seconds 35.3 --device cpu --capture-resolution 640x480 --output runs/doom.mp4 --trace runs/doom-trace.json

같은 시각 레이아웃으로 트레이스를 렌더링하세요. 저자 소유의 사운드트랙 원본이 저장소에 포함되어 있지 않아 무성 영상으로 출력됩니다.

(cd examples/film && npm install && npx playwright install chromium) examples/film/make-film.sh runs/doom-trace.json runs/doom-film.mp4 10

릴리스에는 둠 예제, 체스 예제, 단일 게임 체크포인트, 공유 12-옵션 체크포인트가 포함되어 있습니다. 두 게임 모두 jevlike.vision에서 시각 스코어러를 임포트하며, 어느 예제에도 두 번째 모델 복사본이 없습니다.

아키텍처: 각 옵션은 쿼리 벡터(query vector)가 되는데, 이는 해당 텍스트를 나타내는 짧은 숫자 목록입니다. 쿼리는 컨텍스트 토큰에 어텐션 가중치를 할당합니다. 그 가중치로 해당 옵션에 대한 하나의 컨텍스트 벡터가 만들어집니다. 공유 내적(dot product)이 각 옵션-컨텍스트 쌍을 하나의 점수로 바꿉니다. 점수를 합이 1인 확률로 변환하는 소프트맥스(softmax)가 옵션들 전체에 걸쳐 실행됩니다. 기본 인코더는 바이트 임베딩을 처음부터 학습합니다. 인코더는 텍스트를 벡터로 변환하는 부분입니다. 선택적 Hugging Face 경로는 사전학습된 인코더를 동결(frozen)해 사용하며, 기존 가중치는 고정된 채 작은 스코어러만 학습합니다.

데이터 형식: 한 줄에 하나의 JSON 객체를 사용하세요:

{ "context": "고객이 환불을 원합니다.", "options": ["환불", "영업", "기술 지원"], "label": 0 }

label은 정답 옵션의 0부터 시작하는 인덱스입니다. 각 행은 서로 다른 수의 옵션을 가질 수 있으며 최소 2개입니다.

퀵스타트: 저장소 루트에서 다음 명령을 실행하세요. 로컬 합성 데이터를 생성하고, 학습하고, 저장된 모델을 평가하고, 새로운 메뉴 하나에 점수를 매깁니다.

uv venv source .venv/bin/activate uv pip install -e '.[dev]' jevlike-data synthetic --output data/synthetic jevlike-train data/synthetic/train.jsonl --validation data/synthetic/validation.jsonl --output runs/synthetic.pt jevlike-eval runs/synthetic.pt data/synthetic/test.jsonl jevlike-predict runs/synthetic.pt --context "정확히 amber badger 배지를 선택하세요. 배지: amber badger." --option "azure crane" --option "amber badger" --option "gold heron"

평가는 Top-1 정확도(첫 번째 선택이 정답인 비율)를 출력합니다. Top-3 정확도는 가장 점수가 높은 세 개 중에 정답이 있는 비율입니다. 기대 보정 오차(expected calibration error)는 신뢰도와 실제 정확도를 비교합니다. 이 명령은 또한 셔플된 컨텍스트 대조군(shuffled-context control)을 출력하는데, 각 메뉴를 잘못된 컨텍스트와 짝짓는 것입니다. 유용한 모델이라면 이 대조군보다 나은 성능을 보여야 합니다.

자신의 데이터 사용: 학습 데이터를 내보내고...

원문 보기
원문 보기 (영어)
Jevlike Train a small model that chooses among a changing list of text options. A Jev-like model takes a piece of text and a list of N text options. It returns one probability for each option. It does this in one pass instead of writing an answer word by word. Jev is TypeSafe's commercial model for this kind of task. TypeSafe has not published its design. This repository is an independent starter model with the same input and output shape. Demo The same option-attention head can score controller buttons from image patches. This ten-second film joins two selected five-second windows: live deadly_corridor combat on the seven Doom buttons, then a chess controller walking to and playing moves with five keys. The diagram shows the tensors used for each decision. The Doom window came from the supplied joint checkpoint, which averaged 0.60 kills and -97.50 reward across its ten recorded episodes. The chess window came from the stronger chess-only checkpoint, which scored 4 wins, 46 draws and 0 losses in 50 sampled games against a random mover, but 0 wins, 2 draws and 48 losses against Stockfish level 0. The windows were selected for activity and are not typical-play or competence claims. Install the game extras and record a fresh 640 by 480 Doom trace from the released joint checkpoint: uv pip install -e ' .[games] ' python examples/doom/play.py examples/checkpoints/joint-imitation.pt --episodes 10 --game-seconds 35.3 --device cpu --capture-resolution 640x480 --output runs/doom.mp4 --trace runs/doom-trace.json Render the trace in the same visual layout. This writes a silent film because the author-owned soundtrack source is not part of the repository. (cd examples/film && npm install && npx playwright install chromium) examples/film/make-film.sh runs/doom-trace.json runs/doom-film.mp4 10 The release includes the Doom example , the chess example , the single-game checkpoints and the shared 12-option checkpoint. Both games import the visual scorer from jevlike.vision ; there is no second model copy in either example. Architecture Each option becomes a query vector, which is a short list of numbers representing its text. The query assigns attention weights to the context tokens. Those weights make one context vector for that option. A shared dot product turns each option and context pair into one score. A softmax, which converts scores into probabilities that sum to one, runs across the options. The default encoder learns byte embeddings from scratch. An encoder is the part that turns text into vectors. The optional Hugging Face path uses a frozen pretrained encoder, whose existing weights stay fixed while the small scorer learns. Data format Use one JSON object per line: { "context" : " The customer needs a refund. " , "options" :[ " refund " , " sales " , " technical support " ], "label" : 0 } label is the zero-based index of the correct option. Each row may have a different number of options, with a minimum of two. Quickstart Run these commands from the repository root. They create local synthetic data, train on it, evaluate the saved model and score one new menu. uv venv source .venv/bin/activate uv pip install -e ' .[dev] ' jevlike-data synthetic --output data/synthetic jevlike-train data/synthetic/train.jsonl \ --validation data/synthetic/validation.jsonl \ --output runs/synthetic.pt jevlike-eval runs/synthetic.pt data/synthetic/test.jsonl jevlike-predict runs/synthetic.pt \ --context " Choose the exact badge amber badger. Badge: amber badger. " \ --option " azure crane " \ --option " amber badger " \ --option " gold heron " The evaluation prints top-1 accuracy, which is the fraction of correct first choices. Top-3 accuracy is the fraction with the right answer among the three highest scores. Expected calibration error compares confidence with observed accuracy. The command also prints a shuffled-context control, which pairs each menu with the wrong context. A useful model should beat that control. Use your own data Export train, validation and test JSONL files in the format above. Keep all options that the model will see at prediction time in each row. Split related records together. For example, keep all records for one customer or one target page in one split. This prevents near-duplicates from leaking into the test set. Run jevlike-train with your train and validation files. Run jevlike-eval once on the held-out test file. Held-out means the file was never used for training or model selection. The default byte encoder truncates context to 192 bytes and each option to 32 bytes. Raise --context-tokens or --option-tokens when your text needs more room. Training supports CPU, Apple MPS for a Mac GPU, and CUDA for an NVIDIA GPU through --device . Use a frozen pretrained encoder Install the optional dependency and name any compatible encoder from Hugging Face: uv pip install -e ' .[transformers] ' jevlike-train data/synthetic/train.jsonl \ --validation data/synthetic/validation.jsonl \ --output runs/qwen-head.pt \ --encoder hf \ --hf-model Qwen/Qwen2.5-0.5B \ --rank 256 \ --batch-size 8 The checkpoint stores the trained scorer head and the encoder name. It does not copy the frozen encoder weights. Loading the checkpoint therefore needs access to the same Hugging Face model. --rank sets the width of the small scorer head. A wider head has more trainable weights and uses more memory. Wikispeedia example scripts/get_wikispeedia.sh downloads the public SNAP archives and builds next-click JSONL files. The data stay outside this repository. scripts/get_wikispeedia.sh jevlike-train data/wikispeedia/jsonl/train.jsonl \ --validation data/wikispeedia/jsonl/validation.jsonl \ --output runs/wikispeedia.pt Cite Robert West and Jure Leskovec, Human Wayfinding in Information Networks , WWW 2012. Review the source data terms on the SNAP dataset page . What to expect In the experiments that led to this starter, the one-pass scorer reached about 98% accuracy on synthetic menus. On target-disjoint Wikispeedia next-click data, a frozen Qwen2.5-0.5B encoder plus the scorer reached 26%, against about 8% for shuffled and random-encoder controls. A small model trained from scratch on 40,000 clicks reached 29%. At eight options, one pass was about 100 times faster than a small decoder forced to write 400 tokens. These numbers describe local experiments, not this quickstart run. We did not show equal quality with Jev or reproduce TypeSafe's private training method. Limitations This is a research starter, not a copy of Jev. Accuracy depends on data quality, split quality and the encoder. The byte encoder is cheap but weak on language meaning. The pretrained path may download a large model and needs more memory. One-pass scoring requires the complete option list before prediction. The speed comparison used a small local decoder rather than a large commercial model. Licence Code is released under the MIT License . Downloaded datasets and pretrained models keep their own terms.