prompts
genlm.eval.domains.livecodebench_multilingual.prompts
Per-language prompt construction for multilingual LiveCodeBench (stdin/stdout problems).
Mirrors Multi-LCB's stdin prompt so the 12 Multi-LCB languages are prompt-comparable to the
paper. extract_code matches Multi-LCB's extractor (first fenced block, placeholder
stripped), not the Python-only domain's, so grading matches the Multi-LCB pipeline.
extract_code(model_output)
First fenced code block, matching Multi-LCB's extractor.
Drops a leading span, takes the first ``` block, and strips the "YOUR CODE HERE" placeholder. The Python-only domain's extractor takes the last block and keeps the placeholder.
Source code in genlm/eval/domains/livecodebench_multilingual/prompts.py
multilingual_chat_messages(instance)
The [system, user] chat messages for instance (for chat/API model adapters).
Source code in genlm/eval/domains/livecodebench_multilingual/prompts.py
agnostics_chat_messages(instance)
Agnostics Ag-LCB-X eval prompt: one user message naming the target language.
Mirrors agnostics-framework make_prompt_from_lcbx_row (a "# Problem / # Task" block, no system message). Pair with grading="exact" for an Agnostics-parity run.
Source code in genlm/eval/domains/livecodebench_multilingual/prompts.py
format_multilingual_prompt(tokenizer, instance, use_chat_format=False, enable_thinking=None)
Build the multilingual LCB prompt for instance and return token ids.
use_chat_format=True applies the tokenizer's chat template (instruct models); otherwise
the system and user messages are concatenated as a raw completion string. Mirrors the
existing default_prompt_formatter interface.
Source code in genlm/eval/domains/livecodebench_multilingual/prompts.py
chat_messages(instance)
Chat messages for instance in its source's prompt style: Multi-LCB languages get the
Multi-LCB prompt, Agnostics low-resource languages get the Agnostics prompt with the
per-language nudge. Prefer this over the style-specific builders so each prompt matches its
dataset.
Source code in genlm/eval/domains/livecodebench_multilingual/prompts.py
default_grading(language)
Grading comparator matching each prompt source: exact (Agnostics rstrip-equality) for the
Agnostics low-resource languages, lenient (Multi-LCB per-line comparator) otherwise.
Source code in genlm/eval/domains/livecodebench_multilingual/prompts.py
format_prompt(tokenizer, instance, use_chat_format=False, enable_thinking=None)
Source-correct token ids for instance (Multi-LCB or Agnostics prompt by language source).
The generation-side analogue of format_multilingual_prompt but style-selecting via
chat_messages. enable_thinking=None omits the toggle for models without a thinking mode.