Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Give charts a single path in the layout prompt: tabulate - #94

Open
dlaird-ant wants to merge 1 commit into
run-llama:mainfrom
dlaird-ant:fix-9-charts-prompt
Open

Give charts a single path in the layout prompt: tabulate#94
dlaird-ant wants to merge 1 commit into
run-llama:mainfrom
dlaird-ant:fix-9-charts-prompt

Conversation

@dlaird-ant

Copy link
Copy Markdown
Contributor

Problem

The benchmark scores charts by looking for their data points in HTML
tables — ChartDataPointRule only reads tables. But the prompt never
clearly tells the model that a chart must become a table:

  • the chart instruction is worded as if tabulating were optional:
    "For charts/graphs being converted to tables: use flat combined column
    headers ..."
  • a separate instruction says to describe figures in brackets: "Describe
    images/figures briefly in square brackets like [Figure: description]"

    and a chart is a figure.

So a model can read a chart correctly and still just write
[Figure: bar chart of revenue by year]. When it does, every chart rule
fails, because the scorer can't read data out of a bracket description:

chart_data_point on "[Figure: bar chart ..., 2015 is 100]"  -> fail
chart_data_point on the same data as an HTML table          -> pass

The chart score then reflects which instruction the model followed, not how
well it read the chart.

Fix

Two wording changes so the prompt asks for exactly one thing:

  • the chart instruction becomes a direct command: "Convert
    charts/graphs/figures to tables, using flat combined column headers ..."
  • the describe instruction no longer mentions figures: "Describe
    images/pictures briefly in square brackets like [Picture: description]"

The wording carries into the GEMINI/ABS prompt variants automatically, and
a new test pins it.

Impact

Chart scores go up for models that were describing charts instead of
tabulating them, so before/after numbers aren't directly comparable for the
chart category. The same wording also appears in several per-provider
plain-parse prompts (anthropic, openai, google, gemma4, nemotron_omni,
dots_ocr); this PR changes only the shared layout prompt to keep the diff
small — happy to update the others too if you'd like consistency.

Testing

New test_layout_prompt_wording.py pins the new chart instruction and the
[Picture:] wording across all four prompt variants. Full suite passes;
ruff clean.

The benchmark scores charts by looking for their data points in HTML
tables - ChartDataPointRule only reads tables. But the prompt never
clearly tells the model that a chart must become a table: the chart
instruction is worded as if tabulating were optional ('For charts/graphs
being converted to tables: ...'), and a separate instruction says to
describe figures in brackets ('Describe images/figures ... like
[Figure: description]') - and a chart is a figure.

So a model can read a chart correctly and still just write
'[Figure: bar chart of revenue by year]'. When it does, every chart
rule fails, because the scorer can't read data out of a bracket
description:

    chart_data_point on '[Figure: bar chart ..., 2015 is 100]' -> fail
    chart_data_point on the same data as an HTML table         -> pass

The chart score then reflects which instruction the model followed,
not how well it read the chart.

Two wording changes so the prompt asks for exactly one thing:

- the chart instruction becomes a direct command: 'Convert
  charts/graphs/figures to tables, using flat combined column
  headers ...'
- the describe instruction no longer mentions figures: 'Describe
  images/pictures ... like [Picture: description]'

The wording carries into the GEMINI/ABS variants automatically (they
are built by replacing only the coordinate bullet) and is pinned by a
new test. Chart scores go up for models that were describing charts
instead of tabulating them. The same wording exists verbatim in several
per-provider plain-parse prompts and is left unchanged here to keep the
diff small.
@boyang-zhang1

Copy link
Copy Markdown
Member

Nice catch — the chart rules really do only read tables, so those two bullets were a coin flip on the score. Pulled the branch: suite passes, ruff clean.

One thing before merge: chart regions are ground-truthed as Picture in layout detection (Core11 has no Chart class), and parse_with_layout output gets cross-evaluated against that (runner.py:747). "Convert … to tables" makes data-label="Table" the natural wrapper, which costs us a Picture on the two chart annotations in layout.jsonl. items_to_markdown keeps the table in the scored markdown either way, so one clause gets both:

… flat combined column headers (…). Keep the chart's div data-label="Picture".

Optional: USER_PROMPT_LAYOUT (:69) still has the old hedge, and it ships in the same request as the system prompt.

Don't worry about the per-provider plain-parse prompts — I'll handle those separately. Keeping this to the shared layout prompt is the right scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants