livecodebench_multilingual
genlm.eval.domains.livecodebench_multilingual
MultilingualLCBDataset
Bases: Dataset[MultilingualLCBInstance]
LiveCodeBench stdin problems for a single target language.
Source code in genlm/eval/domains/livecodebench_multilingual/dataset.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
to_jsonl(path)
Write the stdin rows as a language-independent snapshot (language is a per-run tag,
not stored; reload with from_jsonl(path, language=...)).
Source code in genlm/eval/domains/livecodebench_multilingual/dataset.py
from_hf(language, *, release='release_v6', start_date='2024-01-01', end_date=None, difficulties=None, holdout=None, test_frac=0.3, seed=12345, shuffle=False, max_instances=None, max_tests_per_problem=None, cumulative=True, cache_dir=None)
classmethod
Load stdin LiveCodeBench problems for language (testtypes forced to stdin).
start_date defaults to the base loader's 2024-01-01; pass the paper's window
(e.g. None or '2024-07-01') to match a specific problem set.
Source code in genlm/eval/domains/livecodebench_multilingual/dataset.py
from_jsonl(path, language, *, start_date=None, end_date=None, difficulties=None, holdout=None, test_frac=0.3, seed=12345, shuffle=False, max_instances=None)
classmethod
Load stdin problems from a snapshot JSONL for language (testtypes forced).
Source code in genlm/eval/domains/livecodebench_multilingual/dataset.py
MultilingualLCBInstance
Bases: LiveCodeBenchInstance
One LiveCodeBench stdin problem paired with a target language.
instance_id is the composite <question_id>@<language> (so the runner caches each
language separately); question_id keeps the raw id for grouping/metadata.
Source code in genlm/eval/domains/livecodebench_multilingual/dataset.py
resolve_language(name)
Resolve a language name (case-insensitive, with aliases) to a Language; raises ValueError.
Source code in genlm/eval/domains/livecodebench_multilingual/dataset.py
capture_run(code, inputs, outputs, language, timeout=10.0, grading='exact', max_completion_seconds=1000000000.0)
Run every test of one solution and return (solved, per_test_records), no short-circuit.
Each record has test_idx, passed, output (untruncated stdout), error_message, error_code
(rollouts convention), status, and time_s. solved is all(per-test passed). A per-completion
wall cap (max_completion_seconds) records tests past the cap as not-passed, status "capped".
Source code in genlm/eval/domains/livecodebench_multilingual/capture.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
MBPPAgnosticDataset
Bases: Dataset[MultilingualLCBInstance]
Ag-MBPP-X problems for one target language, validated and deduplicated.
platform='mbpp-agnostic' and question_id='mbppx_<task_id>' keep instances
distinguishable from LCB problems.
Source code in genlm/eval/domains/livecodebench_multilingual/mbpp_agnostic.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
from_rows(raw_rows, language, *, strict=False)
classmethod
Validate raw rows: schema, size and character checks, an injection-marker scan,
contradictory-test detection, and dedup by task id and normalized description.
Failing rows are dropped and counted in drop_counts (strict=True raises).
Source code in genlm/eval/domains/livecodebench_multilingual/mbpp_agnostic.py
from_hf(language, *, config='sanitized', revision=PINNED_REVISION, strict=False, cache_dir=None)
classmethod
Load from HF at the PINNED revision (pass revision explicitly to move it).
Source code in genlm/eval/domains/livecodebench_multilingual/mbpp_agnostic.py
overlap_with(other)
Normalized-description collisions against another dataset (contamination check).
Returns [(our question_id, their question_id)]; expected empty against LCB.
Source code in genlm/eval/domains/livecodebench_multilingual/mbpp_agnostic.py
LocalSubprocessExecutor
Grade candidates by compiling/running them locally via the vendored executor.
No container isolation: generated code runs as host subprocesses with only rlimit + process-group SIGKILL. Run on a dedicated/disposable node only.
Source code in genlm/eval/domains/livecodebench_multilingual/executor.py
MultilingualCodeExecutor
Bases: Protocol
Source code in genlm/eval/domains/livecodebench_multilingual/executor.py
prepare(language)
run(code, inputs, outputs, language, timeout)
Return (solved, metadata) for one candidate against the stdin/stdout tests.
Source code in genlm/eval/domains/livecodebench_multilingual/executor.py
is_toolchain_available(language)
True if every binary language needs is on PATH (python is always available).
Source code in genlm/eval/domains/livecodebench_multilingual/executor.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
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
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
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
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.
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).