Skip to content

Let a custom profile inherit models with extends - #693

Merged
de-code merged 2 commits into
mainfrom
add-sequence-model-profile-extends
Aug 17, 2026
Merged

Let a custom profile inherit models with extends#693
de-code merged 2 commits into
mainfrom
add-sequence-model-profile-extends

Conversation

@de-code

@de-code de-code commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

part of https://github.com/eLifePathways/ScienceBeam2.0/issues/113

A profile that differs from an existing one in a single model had to repeat
all ten model entries. Those copies drift from the base as it moves, and the
review diff for a new profile shows ten paths when only one of them is the
point.

A profile can now name a base with extends and state only what it changes,
so putting a retrained model in front of the benchmark is a two-line profile
plus the one model that differs. Resolution is a deep merge, so overriding a
single key of a single model keeps the rest of that model rather than
replacing the whole entry. Chains work. An unknown base or a cycle raises
where the config is resolved, naming the chain it followed, rather than
surfacing later as a puzzling model path.

Adds grobid_custom_hybrid alongside it, extending grobid_crf_0_9_0 and
stating nothing of its own - the place for the retrained reference-segmenter
and citation models to be swapped in one at a time. It resolves to exactly
what grobid_crf resolves to today, asserted against the shipped config, so
the first real override shows up there as a difference rather than as a
wholesale replacement.

Nothing changes for the existing profiles.

A profile that differs from an existing one in a single model had to repeat
all ten entries, so the copies drift and the actual difference is hard to
see. A profile may now name a base with `extends` and state only what it
changes.

Resolution is a deep merge, so a profile can override one key of one model
and inherit the rest of that model rather than replacing the whole entry.
Chains are allowed. An unknown base and a cycle each raise, rather than
failing later with a confusing model path; the cycle names the chain in the
order it was followed, which is why the visited profiles are carried as a
tuple rather than a set.
Gives extends a caller in the shipped config and a place for custom models
to be swapped in one at a time. It currently states no models of its own, so
it resolves to exactly what grobid_crf resolves to, which is what the test
asserts - a model it later overrides will show up there as a difference.

The processors block is repeated rather than inherited: extends applies to
sequence_model_profiles, and profiles have no equivalent.
@github-actions

Copy link
Copy Markdown

ScienceBeam Parser Evaluation

Overall (60 docs across 6 corpora)

grobid 0.9.0-crf (default): 60 docs | sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf): 60 docs | sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid): 60 docs

Field (method) Type grobid 0.9.0-crf (default) sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf) sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid) Δ grobid 0.9.0-crf (default) Δ sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf)
title (exact) string 0.582 0.572 0.572 -0.010 +0.000
title (levenshtein) string 0.657 0.657 0.657 +0.000 +0.000
title (edit_sim) string 0.701 0.701 0.701 +0.000 +0.000
abstract (levenshtein) string 0.709 0.709 0.709 +0.000 +0.000
abstract (edit_sim) string 0.721 0.716 0.716 -0.005 +0.000
author_full_names (levenshtein) partial_ulist 0.720 0.706 0.706 -0.014 +0.000
author_full_names (edit_sim) partial_ulist 0.746 0.735 0.735 -0.012 +0.000
affiliation_text (levenshtein) partial_ulist 0.471 0.446 0.446 -0.025 +0.000
affiliation_text (edit_sim) partial_ulist 0.582 0.544 0.544 -0.039 +0.000
keywords (levenshtein) partial_ulist 0.766 0.000 0.000 -0.766 +0.000
keywords (edit_sim) partial_ulist 0.695 0.000 0.000 -0.695 +0.000
body_section_titles (levenshtein) partial_list 0.346 0.328 0.328 -0.018 +0.000
body_section_titles (edit_sim) partial_list 0.353 0.345 0.345 -0.008 +0.000
acknowledgement (levenshtein) string 0.474 0.361 0.361 -0.113 +0.000
acknowledgement (edit_sim) string 0.473 0.356 0.356 -0.117 +0.000
first_reference_text (levenshtein) string 0.552 0.552 0.552 +0.000 +0.000
first_reference_text (edit_sim) string 0.667 0.666 0.666 -0.001 +0.000
reference_title (levenshtein) partial_list 0.455 0.466 0.466 +0.011 +0.000
reference_title (edit_sim) partial_list 0.462 0.480 0.480 +0.019 +0.000
reference_doi (levenshtein) partial_ulist 0.711 0.567 0.567 -0.144 +0.000
reference_doi (edit_sim) partial_ulist 0.668 0.532 0.532 -0.136 +0.000
biorxiv (10 docs)

grobid 0.9.0-crf (default): 10 docs | sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf): 10 docs | sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid): 10 docs

Field (method) Type grobid 0.9.0-crf (default) sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf) sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid) Δ grobid 0.9.0-crf (default) Δ sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf)
title (exact) string 0.947 0.889 0.889 -0.058 +0.000
title (levenshtein) string 1.000 1.000 1.000 +0.000 +0.000
title (edit_sim) string 1.000 1.000 1.000 +0.000 +0.000
abstract (levenshtein) string 0.750 0.750 0.750 +0.000 +0.000
abstract (edit_sim) string 0.754 0.755 0.755 +0.001 +0.000
author_full_names (levenshtein) partial_ulist 0.994 0.994 0.994 +0.000 +0.000
author_full_names (edit_sim) partial_ulist 0.972 0.972 0.972 +0.000 +0.000
affiliation_text (levenshtein) partial_ulist 0.873 0.842 0.842 -0.031 +0.000
affiliation_text (edit_sim) partial_ulist 0.846 0.817 0.817 -0.029 +0.000
keywords (levenshtein) partial_ulist 0.966 0.000 0.000 -0.966 +0.000
keywords (edit_sim) partial_ulist 0.951 0.000 0.000 -0.951 +0.000
body_section_titles (levenshtein) partial_list 0.275 0.277 0.277 +0.002 +0.000
body_section_titles (edit_sim) partial_list 0.294 0.302 0.302 +0.007 +0.000
acknowledgement (levenshtein) string 0.875 0.500 0.500 -0.375 +0.000
acknowledgement (edit_sim) string 0.836 0.502 0.502 -0.333 +0.000
first_reference_text (levenshtein) string 0.947 0.947 0.947 +0.000 +0.000
first_reference_text (edit_sim) string 0.913 0.913 0.913 +0.000 +0.000
reference_title (levenshtein) partial_list 0.702 0.804 0.804 +0.102 +0.000
reference_title (edit_sim) partial_list 0.660 0.764 0.764 +0.104 +0.000
reference_doi (levenshtein) partial_ulist 0.964 0.942 0.942 -0.021 +0.000
reference_doi (edit_sim) partial_ulist 0.932 0.931 0.931 -0.001 +0.000
ore (10 docs)

grobid 0.9.0-crf (default): 10 docs | sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf): 10 docs | sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid): 10 docs

Field (method) Type grobid 0.9.0-crf (default) sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf) sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid) Δ grobid 0.9.0-crf (default) Δ sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf)
title (exact) string 0.667 0.667 0.667 +0.000 +0.000
title (levenshtein) string 0.750 0.750 0.750 +0.000 +0.000
title (edit_sim) string 0.840 0.840 0.840 +0.000 +0.000
abstract (levenshtein) string 0.824 0.824 0.824 +0.000 +0.000
abstract (edit_sim) string 0.805 0.807 0.807 +0.002 +0.000
author_full_names (levenshtein) partial_ulist 0.783 0.777 0.777 -0.006 +0.000
author_full_names (edit_sim) partial_ulist 0.775 0.770 0.770 -0.006 +0.000
affiliation_text (levenshtein) partial_ulist 0.565 0.517 0.517 -0.048 +0.000
affiliation_text (edit_sim) partial_ulist 0.574 0.522 0.522 -0.052 +0.000
keywords (levenshtein) partial_ulist 0.500 0.000 0.000 -0.500 +0.000
keywords (edit_sim) partial_ulist 0.446 0.000 0.000 -0.446 +0.000
body_section_titles (levenshtein) partial_list 0.279 0.323 0.323 +0.044 +0.000
body_section_titles (edit_sim) partial_list 0.298 0.343 0.343 +0.045 +0.000
acknowledgement (levenshtein) string 0.833 0.833 0.833 +0.000 +0.000
acknowledgement (edit_sim) string 0.870 0.802 0.802 -0.068 +0.000
first_reference_text (levenshtein) string 0.333 0.333 0.333 +0.000 +0.000
first_reference_text (edit_sim) string 0.528 0.528 0.528 +0.000 +0.000
reference_title (levenshtein) partial_list 0.228 0.284 0.284 +0.056 +0.000
reference_title (edit_sim) partial_list 0.265 0.315 0.315 +0.050 +0.000
reference_doi (levenshtein) partial_ulist 0.704 0.012 0.012 -0.692 +0.000
reference_doi (edit_sim) partial_ulist 0.558 0.003 0.003 -0.556 +0.000
pkp (10 docs)

grobid 0.9.0-crf (default): 10 docs | sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf): 10 docs | sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid): 10 docs

Field (method) Type grobid 0.9.0-crf (default) sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf) sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid) Δ grobid 0.9.0-crf (default) Δ sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf)
title (exact) string 0.750 0.750 0.750 +0.000 +0.000
title (levenshtein) string 0.824 0.824 0.824 +0.000 +0.000
title (edit_sim) string 0.805 0.805 0.805 +0.000 +0.000
abstract (levenshtein) string 0.933 0.933 0.933 +0.000 +0.000
abstract (edit_sim) string 0.914 0.915 0.915 +0.001 +0.000
author_full_names (levenshtein) partial_ulist 0.905 0.905 0.905 +0.000 +0.000
author_full_names (edit_sim) partial_ulist 0.917 0.917 0.917 +0.000 +0.000
affiliation_text (levenshtein) partial_ulist 0.667 0.600 0.600 -0.067 +0.000
affiliation_text (edit_sim) partial_ulist 0.743 0.666 0.666 -0.077 +0.000
keywords (levenshtein) partial_ulist 1.000 0.000 0.000 -1.000 +0.000
keywords (edit_sim) partial_ulist 1.000 0.000 0.000 -1.000 +0.000
body_section_titles (levenshtein) partial_list 0.678 0.714 0.714 +0.036 +0.000
body_section_titles (edit_sim) partial_list 0.650 0.685 0.685 +0.035 +0.000
acknowledgement (levenshtein) string 0.800 0.500 0.500 -0.300 +0.000
acknowledgement (edit_sim) string 0.800 0.500 0.500 -0.300 +0.000
first_reference_text (levenshtein) string 1.000 1.000 1.000 +0.000 +0.000
first_reference_text (edit_sim) string 0.995 0.995 0.995 +0.000 +0.000
reference_title (levenshtein) partial_list 0.799 0.770 0.770 -0.029 +0.000
reference_title (edit_sim) partial_list 0.770 0.740 0.740 -0.030 +0.000
reference_doi (levenshtein) partial_ulist 0.889 0.889 0.889 +0.000 +0.000
reference_doi (edit_sim) partial_ulist 0.889 0.889 0.889 +0.000 +0.000
scielo_br (10 docs)

grobid 0.9.0-crf (default): 10 docs | sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf): 10 docs | sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid): 10 docs

Field (method) Type grobid 0.9.0-crf (default) sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf) sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid) Δ grobid 0.9.0-crf (default) Δ sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf)
title (exact) string 0.462 0.462 0.462 +0.000 +0.000
title (levenshtein) string 0.571 0.571 0.571 +0.000 +0.000
title (edit_sim) string 0.628 0.628 0.628 +0.000 +0.000
abstract (levenshtein) string 0.750 0.750 0.750 +0.000 +0.000
abstract (edit_sim) string 0.697 0.692 0.692 -0.005 +0.000
author_full_names (levenshtein) partial_ulist 0.582 0.500 0.500 -0.082 +0.000
author_full_names (edit_sim) partial_ulist 0.635 0.566 0.566 -0.069 +0.000
affiliation_text (levenshtein) partial_ulist 0.000 0.000 0.000 +0.000 +0.000
affiliation_text (edit_sim) partial_ulist 0.357 0.299 0.299 -0.059 +0.000
keywords (levenshtein) partial_ulist 0.614 0.000 0.000 -0.614 +0.000
keywords (edit_sim) partial_ulist 0.544 0.000 0.000 -0.544 +0.000
body_section_titles (levenshtein) partial_list 0.449 0.271 0.271 -0.178 +0.000
body_section_titles (edit_sim) partial_list 0.485 0.354 0.354 -0.131 +0.000
acknowledgement (levenshtein) string 0.000 0.000 0.000 +0.000 +0.000
acknowledgement (edit_sim) string 0.000 0.000 0.000 +0.000 +0.000
first_reference_text (levenshtein) string 0.000 0.000 0.000 +0.000 +0.000
first_reference_text (edit_sim) string 0.391 0.369 0.369 -0.022 +0.000
reference_title (levenshtein) partial_list 0.443 0.457 0.457 +0.013 +0.000
reference_title (edit_sim) partial_list 0.451 0.468 0.468 +0.017 +0.000
reference_doi (levenshtein) partial_ulist 0.965 0.824 0.824 -0.141 +0.000
reference_doi (edit_sim) partial_ulist 0.960 0.718 0.718 -0.242 +0.000
scielo_mx (10 docs)

grobid 0.9.0-crf (default): 10 docs | sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf): 10 docs | sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid): 10 docs

Field (method) Type grobid 0.9.0-crf (default) sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf) sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid) Δ grobid 0.9.0-crf (default) Δ sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf)
title (exact) string 0.333 0.333 0.333 +0.000 +0.000
title (levenshtein) string 0.462 0.462 0.462 +0.000 +0.000
title (edit_sim) string 0.520 0.520 0.520 +0.000 +0.000
abstract (levenshtein) string 0.333 0.333 0.333 +0.000 +0.000
abstract (edit_sim) string 0.550 0.522 0.522 -0.027 +0.000
author_full_names (levenshtein) partial_ulist 0.627 0.627 0.627 +0.000 +0.000
author_full_names (edit_sim) partial_ulist 0.659 0.659 0.659 +0.000 +0.000
affiliation_text (levenshtein) partial_ulist 0.100 0.095 0.095 -0.005 +0.000
affiliation_text (edit_sim) partial_ulist 0.287 0.296 0.296 +0.009 +0.000
keywords (levenshtein) partial_ulist 0.814 0.000 0.000 -0.814 +0.000
keywords (edit_sim) partial_ulist 0.692 0.000 0.000 -0.692 +0.000
body_section_titles (levenshtein) partial_list 0.000 0.000 0.000 +0.000 +0.000
body_section_titles (edit_sim) partial_list 0.000 0.000 0.000 +0.000 +0.000
acknowledgement (levenshtein) string 0.000 0.000 0.000 +0.000 +0.000
acknowledgement (edit_sim) string 0.000 0.000 0.000 +0.000 +0.000
first_reference_text (levenshtein) string 0.571 0.571 0.571 +0.000 +0.000
first_reference_text (edit_sim) string 0.547 0.557 0.557 +0.010 +0.000
reference_title (levenshtein) partial_list 0.264 0.249 0.249 -0.014 +0.000
reference_title (edit_sim) partial_list 0.304 0.302 0.302 -0.001 +0.000
reference_doi (levenshtein) partial_ulist 0.000 0.000 0.000 +0.000 +0.000
reference_doi (edit_sim) partial_ulist 0.000 0.000 0.000 +0.000 +0.000
scielo_preprints-jats (10 docs)

grobid 0.9.0-crf (default): 10 docs | sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf): 10 docs | sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid): 10 docs

Field (method) Type grobid 0.9.0-crf (default) sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf) sciencebeam-parser:pr-693-8fd9d731-20260817.1050 (grobid_custom_hybrid) Δ grobid 0.9.0-crf (default) Δ sciencebeam-parser:main-487b2b93-20260817.1008 (grobid_crf)
title (exact) string 0.333 0.333 0.333 +0.000 +0.000
title (levenshtein) string 0.333 0.333 0.333 +0.000 +0.000
title (edit_sim) string 0.411 0.411 0.411 +0.000 +0.000
abstract (levenshtein) string 0.667 0.667 0.667 +0.000 +0.000
abstract (edit_sim) string 0.606 0.605 0.605 -0.000 +0.000
author_full_names (levenshtein) partial_ulist 0.431 0.435 0.435 +0.004 +0.000
author_full_names (edit_sim) partial_ulist 0.521 0.525 0.525 +0.004 +0.000
affiliation_text (levenshtein) partial_ulist 0.620 0.621 0.621 +0.001 +0.000
affiliation_text (edit_sim) partial_ulist 0.688 0.662 0.662 -0.026 +0.000
keywords (levenshtein) partial_ulist 0.704 0.000 0.000 -0.704 +0.000
keywords (edit_sim) partial_ulist 0.535 0.000 0.000 -0.535 +0.000
body_section_titles (levenshtein) partial_list 0.393 0.383 0.383 -0.010 +0.000
body_section_titles (edit_sim) partial_list 0.393 0.385 0.385 -0.008 +0.000
acknowledgement (levenshtein) string 0.333 0.333 0.333 +0.000 +0.000
acknowledgement (edit_sim) string 0.333 0.333 0.333 +0.000 +0.000
first_reference_text (levenshtein) string 0.462 0.462 0.462 +0.000 +0.000
first_reference_text (edit_sim) string 0.627 0.632 0.632 +0.005 +0.000
reference_title (levenshtein) partial_list 0.297 0.235 0.235 -0.062 +0.000
reference_title (edit_sim) partial_list 0.319 0.291 0.291 -0.028 +0.000
reference_doi (levenshtein) partial_ulist 0.744 0.735 0.735 -0.008 +0.000
reference_doi (edit_sim) partial_ulist 0.670 0.653 0.653 -0.016 +0.000

@de-code
de-code merged commit d0f4519 into main Aug 17, 2026
8 checks passed
@de-code
de-code deleted the add-sequence-model-profile-extends branch August 17, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant