YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
DRU-RE EntityPair-TwoHead AraBERTv02-Large
This package trains and releases a single Arabic relation extraction model in the EntityPair-TwoHead family. The only relation encoder is aubmindlab/bert-large-arabertv02.
The pair representation is:
[CLS ; subject marker ; object marker ; |subject-object| ; subject*object ; directional type vector]
The directional type vector is 42-dimensional: 21 subject-type one-hot values followed by 21 object-type one-hot values. For AraBERTv02-large the verified encoder hidden size is 1024, so the pair feature size is 5 * 1024 + 42 = 5162.
The classifier has a shared MLP:
- Linear(5162, 1024), LayerNorm, GELU, Dropout(0.10)
- Linear(1024, 512), LayerNorm, GELU, Dropout(0.10)
It then predicts relation existence with a 2-way head and positive relation type with a 40-way head. The positive head loss is applied only to rows whose gold label is not no_relation.
Setup
cd /root/workspace/DRU_RE_EntityPair_TwoHead_AraBERTv02_Large
bash setup_env.sh
bash run_smoke_tests.sh
The workspace must contain /root/workspace/.env with nonempty HF_TOKENONE and HF_TOKENTWO. Token values must never be printed or uploaded.
Training and resume
bash run_train.sh
bash run_resume.sh
Best checkpoint selection uses validation positive micro-F1 excluding no_relation with existence threshold 0.5. The final optimizer step is saved separately as the last checkpoint.
Evaluation
bash run_evaluate_best.sh
bash run_evaluate_last.sh
Evaluation artifacts are written under outputs/evaluation/best/ and outputs/evaluation/last/.
Completed run summary:
- Best checkpoint: optimizer step 2000, validation positive micro-F1 excluding
no_relation= 0.533958, all-label accuracy = 0.622407. - Last checkpoint: optimizer step 2943, validation positive micro-F1 excluding
no_relation= 0.507371, all-label accuracy = 0.611144. - Training duration: 2588.11 seconds on one NVIDIA A40.
Blind-test Codabench generation
bash run_test_all.sh
bash validate_all_submissions.sh
The local /root/workspace/test.jsonl is read in place, row order is preserved, and it is not uploaded. Candidate generation finds every exact occurrence of both entity strings, applies a conservative Arabic-normalized fallback only when exact matching fails, runs U4RASD/TypePredictor once per unique occurrence, applies ontology masking, and writes a validated submission ZIP for each checkpoint/strategy pair.
Strategies: max_joint, top_existence, max_positive, majority_vote, soft_pool, top_confidence, legacy_majority_sum, plus preserved legacy aliases any_positive_max_q and soft_joint_pool.
Release
python -m dru_re_arabert_large.package_release
bash push_release.sh
The Hugging Face repository is U4RASD/DRU-RE-EntityPair-TwoHead-AraBERTv02-Large. It is created private by default.
Known limitations: full determinism is not guaranteed on CUDA; span-free inference cannot fabricate spans when an entity string is absent; strongly negative candidates can dominate top_confidence by design.