feat: Paper results pipeline and robustness improvements#46
Merged
Conversation
…ts with duplicate targets
…to solve dynamic dataset loading that can result in 0-length query or target tasks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds end-to-end support for reproducing paper benchmark results — from running experiments to generating publication-ready LaTeX tables — while fixing several robustness issues discovered during large-scale multilingual evaluation runs.
Changes
New: Paper results pipeline
examples/run_paper_results.py— Script to run the full benchmark suite across multilingual and monolingual model configurations (BM25, JobBERT-v2/v3, Qwen3, ConTeXTMatch, CurriculumMatch).examples/generate_paper_table.py— Script to load saved results and generate a formatted LaTeX comparison table with model grouping, short names, bold-best highlighting, and optional dataset count rows.src/workrb/metrics/reporting.py— Newformat_results_latex()function (~290 lines) that builds a complete LaTeXtableenvironment from multipleBenchmarkResults, with support for model groups,\midruleseparators, column renaming/reordering,\resizebox, and per-group dataset count rows.src/workrb/results.py— NewBenchmarkResults.get_dataset_counts()method to report how many datasets contribute to each task group or task score after language filtering.New: Duplicate handling in ranking datasets
DuplicateStrategyenum (ALLOW,RAISE,RESOLVE) replaces the old booleanallow_duplicate_queries/allow_duplicate_targetsflags inRankingDataset.RESOLVEmode (new default) deterministically deduplicates:target_indicesvia set union for identical query texts.melo,mels,skillnorm, etc.) updated to use the new API.tests/test_duplicate_strategy.py— 210-line test suite coveringRAISE,ALLOW, andRESOLVEstrategies for both queries and targets.New: Graceful handling of unsupported dataset configs
DatasetConfigNotSupportedexception — New exception type inbase.pyfor datasets that dynamically produce 0 queries or targets (e.g., an ESCO language/version lacking skill alternatives).Task._load_datasets()catchesDatasetConfigNotSupportedand logs a warning instead of crashing, then updatesself.dataset_idsto reflect only successfully loaded datasets.RankingDatasetvalidation raisesDatasetConfigNotSupportedwhen query or target count is 0.New: ConTeXTMatch query batching for large ranking tasks
ConTeXTMatchModel._compute_rankings()now scores queries in configurable chunks (scoring_batch_size, default 32) to prevent OOM from the(num_queries, num_targets, seq_len)intermediate tensor.batch_sizeparameter toencode_batch_sizefor clarity.tests/test_models/test_contextmatch_model.py— 108-line test suite for the ConTeXTMatch model including batching behavior.Fix: Version-dependent ESCO language support
ESCO.get_supported_languages(version)returns the correct language set per major.minor version (e.g., Icelandic/Norwegian/Arabic/Ukrainian only available from v1.1+).ESCO.get_supported_languages(self.esco_version)instead of the staticSUPPORTED_ESCO_LANGUAGEStuple.Fix: Miscellaneous
.float()before.numpy()to avoid dtype errors with bfloat16 models.sorted(set(...))instead oflist(set(...))for deterministic index ordering.Files changed (22)
examples/run_paper_results.py,examples/generate_paper_table.pysrc/workrb/metrics/reporting.py,src/workrb/metrics/__init__.py,src/workrb/metrics/classification.py,src/workrb/metrics/ranking.pysrc/workrb/models/bi_encoder.pysrc/workrb/results.pysrc/workrb/tasks/abstract/base.py,src/workrb/tasks/abstract/ranking_base.py,src/workrb/tasks/__init__.pyjob2skill.py,skill2job.py,skill_extraction.py,jobnorm.py,skillnorm.py,melo.py,mels.pysrc/workrb/data/esco.pysrc/workrb/tasks/classification/job2skill.pytests/test_duplicate_strategy.py,tests/test_models/test_contextmatch_model.pyTest plan
tests/test_duplicate_strategy.py— validatesRAISE,ALLOW, andRESOLVEstrategies for both query and target deduplicationtests/test_models/test_contextmatch_model.py— validates ConTeXTMatch encoding and batched scoringexamples/run_paper_results.pyexecutes end-to-end with at least one modelexamples/generate_paper_table.pygenerates valid LaTeX output from saved resultsBreaking changes
RankingDataset.__init__signature changed:allow_duplicate_queries/allow_duplicate_targetsreplaced byduplicate_query_strategy/duplicate_target_strategy(enum-based). Any external callers using the old boolean flags will need to update.ConTeXTMatchModel.encode()parameter renamed frombatch_sizetoencode_batch_size.