Results
H2 is the holdout: 867 functions that were unnamed when the training data was frozen and were
named later (2026-11-26). Most of them were found by name searches on the remaining unknowns, so
they look like the functions the model is used on. 600 are class members; 267 are free functions or
initializers, whose answer is a namespace or (global).
Table with columns: H2 rows, n, top-1, top-5, p ≥ 0.8: n, right| H2 rows | n | top-1 | top-5 | p ≥ 0.8: n, right |
|---|
| all | 867 | 47.2% | 64.5% | 478, 69% |
| members | 600 | 41.0% | 56.0% | 330, 61% |
namespace or (global) | 267 | 61.0% | 83.5% | 148, 86% |
For comparison, a card-only model trained the same way on member labels only got 26.9% top-1 and
40.9% top-5 on H2.
The model's own p is overconfident. A small gradient-boosted combiner recalibrates it, using
the model's top-5, a class ranker and neighbour vote from the same repo, and how the function's
this accesses fit known class layouts. By 5-fold cross-validation on H2, it gets 51.1% top-1. It
gives 276 functions P ≥ 0.8, and 92.4% of those are right. Its 100, 250 and 500 most confident picks
are 100%, 97.2% and 78.2% right.
In use. These batches of name searches were picked by an earlier build of this model, trained
the same way but without the lambda masking described below. On H2 it scored within a point of this
one (46.9% top-1, 65.4% top-5).
Table with columns: Picked at combiner P, cards searched, names recovered| Picked at combiner P | cards searched | names recovered |
|---|
| ≥ 0.898 (the 60 most confident of 3,897 unknowns) | 60 | 39 (65%) |
| 0.6–0.9 | 144 | 36 (25%) |
| 0.4–0.6 | 159 | 18 (11%) |
| ≥ 0.8, from a second pool of 8,953 unknowns | 128 | 42 (33%) |
Batches picked by an earlier card-only model recovered 36%, and batches picked by the class ranker
alone recovered 8–16%. On solves at P ≥ 0.8, the model's first pick was the right scope about 80%
of the time. Most of the gain is in free-function templates (CreateHandle, CreateUniquePtr,
rtti::CallFunction, ...), which the older member-only labels could not express.
Compared with general LLM agents
The same task was given to Claude Opus 5.5 and Claude Sonnet 5.5 agents and to GLM-5.3-Flash: 200
functions drawn at random from H2, in 8 batches of 25. Each got the same masked card + asm text the
model gets, plus 8 solved examples from the training set, and was asked for its 5 best scopes with
honest probabilities. The Claude agents could read only those two files: no search, no tools, no
web. GLM-5.3-Flash got the same instructions and both files in one message, through Ollama's cloud
API at temperature 0. The H2 names were found after the training cutoffs of the Claude models.
Table with columns: 200 H2 functions, this model, GLM-5.3-Flash, Sonnet 5.5, Opus 5.5| 200 H2 functions | this model | GLM-5.3-Flash | Sonnet 5.5 | Opus 5.5 |
|---|
| top-1 | 50.5% | 36.0% | 49.5% | 63.5% |
| top-5 | 68.0% | 58.5% | 70.0% | 75.0% |
| members, top-1 | 46.3% | 44.0% | 48.5% | 55.2% |
namespace or (global), top-1 | 59.1% | 19.7% | 51.5% | 80.3% |
| answers at p ≥ 0.5: n, right | 179, 55% | 63, 56% | 103, 69% | 89, 85% |
| right where this model is wrong | | 13 | 25 | 37 |
| wrong where this model is right | | 42 | 27 | 11 |
Opus is clearly more accurate, and most of its lead is on free functions. Its probabilities are also
more honest than the model's raw p, which needs the combiner to be calibrated. Sonnet is about level
with the model. GLM-5.3-Flash is behind on members and far behind on free functions, where it
mostly answers a class instead of a namespace.
Cost. Times are wall clock per batch of 25. The model's is its whole H2 run (867 functions,
1,369 s including loading) scaled to 25, while another decode shared the GPU; alone it is about a
second per function.
Table with columns: per batch of 25, this model, GLM-5.3-Flash, Sonnet 5.5, Opus 5.5| per batch of 25 | this model | GLM-5.3-Flash | Sonnet 5.5 | Opus 5.5 |
|---|
| runs on | local RTX 2070 SUPER | Ollama cloud | Claude API | Claude API |
| time, mean (range) | 39 s, sharing the GPU | 594 s (292–851) | 41 s (17–66) | 56 s (51–64) |
| tokens in | 14,500 | 19,200 | 131,000 in all | 131,000 in all |
| tokens out | 5 short scopes | 64,400, mostly reasoning | | |
The model's prompts are counted with its own tokenizer, GLM's by Ollama. The Claude figure is the
total Claude Code reports per agent; it includes Claude Code's own instructions and tool
definitions and does not split input from output. The task text itself is about 20,000 tokens per
batch.
The model's case is volume: it ranks a pool of 10,000 unknowns overnight, locally, at no cost. And
110 of Opus's 127 right answers were already in the model's top-5, so a cheap pairing is to let the
model rank a pool and an agent choose among its top-5 for the functions that will be searched. The
other arms' answers are in comparison/.
The prompt is a function card, a compact text summary of one function, followed by its assembly:
### Function<card lines>asm:<listing>### Class
The card has these lines, in this order. A line is left out when it would be empty. Names are
demangled (MSVC undname style) and every name longer than 90 characters is cut to 87 plus ....
Names containing a lambda, a backtick or ':: are never shown.
Table with columns: Line, What| Line | What |
|---|
zone <z>, <n> bytes, <m> insns, returns <ret> | z: the kind of address range it sits in, source (one source file's functions in source order), sorted (functions laid out in name order) or mixed; n: bytes to the next function; ret: the inferred return kind, one of void, bool, int, int64/ptr, this, arg-ptr (a by-value struct through the hidden pointer), float, double, ? |
params a0:i64 a1:i32* a2:float | each argument register read before it is written, in slot order: integer width or float/double, * if dereferenced |
near: A | B | C | D | up to two named functions on each side within 48 functions in address order (70-character cut) |
calls (<u> unnamed): ... | up to 10 named callees; u counts the unnamed ones |
called by (<u> unnamed): ... | up to 8 named callers |
strings: "..." | "..." | up to 6 referenced string literals, JSON-quoted, cut to 60 |
data: ... | up to 6 named data symbols it references |
this: +8:8r +10:4w ... lea +18 | up to 20 accesses through the first argument as +offset:width and r/w (offsets in hex), then lea offsets |
this vcalls slot 3,7 | vtable slots called through the first argument's own vtable |
cnames: ... | up to 8 64-bit immediates that are FNV-1a 64 hashes of known CNames, as strings |
neighbour classes: A | B ... | the top-5 classes of a class ranker voting over the call graph and address neighbours |
body classes: mh A, B ; lay C ; ... | up to 3 classes per body-only source: mh nearest labelled bodies by MinHash, cnm RTTI-name hashes, lay this layout, vsl vtable slots, kon constants, alc allocation calls, siz allocation size equal to a class's size |
The listing is the function's own instructions, at most 400 tokens of it, cut at a whole line and
ended with ... +N insns when cut. Unattested lambda hashes are masked to <lambda> everywhere in
the prompt, the same way as in training.
The model completes it with a scope and EOS. Decoding is a beam search (k = 5) constrained to a
trie over the 51,237 scopes in classes.txt, so every answer is a real scope; p is the softmax
of the five finished beams' log-probs. Prompts are cut to 1,100 tokens inside the card text, so
### Class always survives.
The model only works on prompts in this format, built from the 2.5 executable. It tolerates missing
lines (many cards have no near: or body classes:), but not other formats.
Files
Table with columns: File, What| File | What |
|---|
adapter_model.safetensors, adapter_config.json | the LoRA adapter (r = 32, alpha 64, on every attention and MLP projection) |
classes.txt | the decoding vocabulary: every scope the model can answer, one per line |
h2_predictions.jsonl | the model's top-5 on H2, with the right answer: {offset, zone, target, pred: [[scope, p] x5], lp} |
predict.py | the constrained beam search: card text in, top-5 scopes out |
comparison/ | the 200 sampled H2 offsets and the top-5 of Opus 5.5, Sonnet 5.5 and GLM-5.3-Flash for each: {offset, pred: [[scope, p] x5]} |
The combiner is not shipped: its other inputs (the class ranker and the layout features) come from
the private tools. Its numbers above are cross-validated on h2_predictions.jsonl and those inputs.
Use
pip install torch transformers peft huggingface_hubhf download b4rtm0ss/cp2077-scope-qwen3-0.6b --local-dir cp2077-scopepython cp2077-scope/predict.py cards.jsonl > preds.jsonl
cards.jsonl has one object per line with text, the card plus "\nasm:\n" and the listing, and
any other fields, which are passed through. Each output line adds pred: [[scope, p] x5] and
lp, the five beams' summed log-probs. It runs on a GPU with a few GB free or, slowly, on the CPU
(--cpu); about a second per function on an RTX 2070 SUPER.
Training
- Labels. The scope of each confirmed name: a member's class; a free function's namespace or
(global); a ??__E / ??__F initializer's enclosing scope. Lambdas are left out, because their
scope is not a C++ name.
- Lambda masking. MSVC names a lambda
<lambda_H>, with H a hash over its source file. A hash
is kept only when a public binary prints it (the game's own RTTI descriptors and std::function
targets, or Microsoft's CRT and STL libraries). Every other one is replaced by <lambda> in the
prompts and the training answers, so the model never sees or emits a hash that is not already
public. It is the same rule cp2077-symbols uses for the names it publishes. The 13 scopes that
came out as <lambda> or a template over it, such as job::prv::JobShim<<lambda>,job::PoolJobs2Data>,
are left out of classes.txt: an answer like that can't lead to a name, so the decoder never
gives one. Checked on this release by a fresh scan, not the cached set: its files carry 736 distinct lambda
hashes, all in classes.txt (14 of them also in h2_predictions.jsonl). 723 are printed by
Cyberpunk2077.exe 2.5 itself, every one in an RTTI type descriptor (.?AV<lambda_H>@...), and
the other 13 by Microsoft's libraries (12 by libucrt.lib, 1 by clang_rt.fuzzer_MD-x86_64.lib).
None is unattested.
- Data. 120,000 named functions from a card build frozen on 2026-11-24, plus 1,609 functions
named after it, with 828 for validation. H2 is held out.
- Recipe. One epoch: 2,789 optimizer steps of four 6,000-token micro-batches. lr 2e-4 with a
50-step warmup and linear decay. Loss is on the scope tokens only. The base model runs in fp16 and
the LoRA weights in fp32 under autocast with gradient checkpointing (Turing has no bf16). It takes
about 7.5 hours on one RTX 2070 SUPER (8 GB).
- The training data is not published. Every prompt holds disassembly of the game's executable.
Limitations
- Game version 2.5 only. Function cards from another build differ in addresses, neighbours and
code.
- A confident scope does not make a name recoverable. MSVC names every lambda
<lambda_H>,
with H a hash over its whole source file. About 129,000 unnamed functions need a lambda hash
that no known name attests, mostly the engine's script-native registration lambdas. The model
often names their scope with high confidence, but the name itself can't be found, so filter out
the functions whose names must contain an unseen lambda hash before ranking.
- It confuses containers with their users. When a container method is inlined into a class's
own code, it can answer the container (
red::DynArray<X::Node>) where the scope is X. When
this is a field of another class, it can answer the outer class.
- For a namespace or
(global) pick, the function is free. Try free functions and initializers
under it first.
License
Apache-2.0, like the base model. Built with Qwen.