Dataset Viewer
Auto-converted to Parquet Duplicate
Search is not available for this dataset
image
imagewidth (px)
1.35k
3.33k
label
class label
2 classes
0erdos
0erdos
0erdos
0erdos
0erdos
0erdos
0erdos
0erdos
0erdos
0erdos
1graphqa
1graphqa
1graphqa
1graphqa
1graphqa
1graphqa
1graphqa
1graphqa
1graphqa
1graphqa

Serialization-invariance audit of LLM graph code generation

Does an LLM that solves a graph problem by writing code return the same answer under equivalent serializations of the same graph -- and if not, does the fragility enter when it transcribes the graph into its program, when it constructs a structure from that copy, or in the solution logic?

Produced by ml_graphs at commit 2f43c6f.

Design

Each instance (one graph + one task + one query) is rendered into several equivalent serializations differing in exactly one axis: relabel, order, structure, syntax. Every variant is put to the model in three modes, two of them crossed with a solving library:

mode graph arrives as transcribes? library arms
direct (M1) text -- none
code (M2) text + a fixed program template yes networkx, native
graph_as_code (M3) nodes/edges pre-filled by the harness no networkx, native

M2 and M3 are a minimal pair: the same template, differing only in who fills the two declaration lines. The M2-M3 difference is therefore the cost of transcription alone.

Models

  • hf-deepseek-v3.1-novita
  • hf-qwen3-8b-nscale

Both served through HuggingFace Inference Providers at temperature 0. The provider is part of the identity: the same Qwen3-8B degenerated on 29% of prompts on one provider and 0% on another (see the repo's docs/pipeline-and-caching.md).

Files

tables/<dataset>/accuracy.csv             mean(correct) per dataset x task x mode x library x axis x model
                 invariance.csv           frac_identical -- the headline metric, per instance then aggregated
                 gap.csv                  M2 - M3 invariance, within a library arm = the cost of transcription
                 ladder.csv               failure shares across prose -> json -> networkx code -> injected
                 failures.csv             failure-class decomposition among code-mode failures
                 silent_transcription.csv wrong graph, right answer
figs/<dataset>/*.png                      the same, plotted, one file per model
scored/<dataset>/<model>.jsonl.gz         one row per record: every intermediate + the verdict
data/<dataset>/instances.jsonl            which graphs, tasks and queries were sampled

Reading scored/

One row per (instance, variant, mode, library, model). Beyond correct and failure_class it carries the diagnostics that make attribution possible:

field meaning
declared_ok the nodes/edges the model wrote == the graph it was shown (transcription)
construction_ok the graph the program built == what it declared (networkx arm only)
ans_is_literal ans was written down, not computed
finish_reason length = the reply was cut off; exclude these before quoting invariance
n_calls (tables) distinct model replies behind a cell

n is not n_calls. M3's prompt contains no graph text, so for a task whose question names no node (cycle_check, node_count, density, ...) every instance and variant collapses to one reply, executed against every graph. Such a cell can hold 1,000 rows backed by a single model decision -- read n_calls before quoting it.

Failure classes

ok wrong execution format transcription construction logic no_computation unverifiable -- defined in the repo's docs/scoring-and-classification.md. construction is separable in the networkx arm only, so never pool the failure decomposition across library.

Accuracy

Computed from scored/:

Qwen3-8B (nscale) DeepSeek-V3.1 (novita)
GraphQA 0.899 0.853
Erdos 0.759 0.936

The models rank oppositely on the two datasets. DeepSeek is far stronger on Erdos -- 0.951 in direct mode against Qwen's 0.647 -- yet slightly weaker on GraphQA, whose graphs are small enough for an 8B model to compete.

Full file layout

tables/<dataset>/*.csv              the six analysis tables (both models in each file)
figs/<dataset>/*.png                five charts per model
scored/<dataset>/<model>.jsonl.gz   one row per record: every intermediate + the verdict
responses/<dataset>/<model>.jsonl.gz  raw reply per record + token usage + finish_reason
exec/<dataset>/<model>.jsonl.gz     sandbox output: ans, declared/built graph, exceptions
data/<dataset>/instances.jsonl      which graphs, tasks and queries were sampled
raw_replies/<model>.tar.gz          every reply keyed by prompt hash (65,624 files per model)

raw_replies/ is the paid artifact: unpack it into results/cache/<model>/ and the whole pipeline re-runs from --stages exec,score with no API calls.

Abandoned runs, kept as evidence

  • responses/graphqa/hf-qwen3-8b.jsonl.gz -- Qwen3-8B on featherless, stopped after ~8,700 records. It degenerated on 29% of prompts (the the the..., or one edge pair repeated to the 4,096-token ceiling) and those calls consumed 68% of the wall time. The same model on nscale with /no_think: zero loops. The provider is part of a model's identity.
  • responses/graphqa/hf-deepseek-v3.jsonl.gz -- the 20-instance pilot on DeepSeek-V3.

Reproducing

git clone https://github.com/ramramk/ml_graphs && cd ml_graphs
pip install -e .
# drop raw_replies/<model>/ into results/cache/<model>/, then:
python scripts/run.py --config configs/graphqa.yaml --models hf-qwen3-8b-nscale --stages exec,score
python scripts/analyze.py --config configs/graphqa.yaml
Downloads last month
132