Instructions to use gefgu/modernbert-poi-type-aligner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use gefgu/modernbert-poi-type-aligner with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("gefgu/modernbert-poi-type-aligner") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
CrossEncoder based on nomic-ai/modernbert-embed-base
This is a Cross Encoder model finetuned from nomic-ai/modernbert-embed-base using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
CityBehavEx
This checkpoint is the POI-type aligner (semantic POI/location-type selection) in
CityBehavEx, a scalable, empirically
validated LLM-assisted urban mobility simulation platform. It is served
alongside CityBehavEx's other CrossEncoder aligners by
scripts/serve_aligners.py and referenced directly by repo id in scenario
configs (e.g. schedule.alignment_model, activities.alignment_model,
profiles.coherence_alignment_model, profiles.ownership_alignment_model,
activities.poi_type_alignment_model).
If you use this model, please cite CityBehavEx:
@misc{santos2026citybehavex,
title = {CityBehavEx: A Scalable and Empirically Validated LLM-Assisted Urban Simulation Platform},
author = {Santos, Gustavo H. and Viana, Aline and Silva, Thiago H.},
year = {2026},
eprint = {2607.12086},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
url = {https://arxiv.org/abs/2607.12086}
}
Model Details
Model Description
- Model Type: Cross Encoder
- Base model: nomic-ai/modernbert-embed-base
- Maximum Sequence Length: 8192 tokens
- Number of Output Labels: 1 label
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Documentation: Cross Encoder Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Cross Encoders on Hugging Face
Full Model Architecture
CrossEncoder(
(0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'ModernBertForSequenceClassification'})
)
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("cross_encoder_model_id")
# Get scores for pairs of inputs
pairs = [
['Charlotte is a 33-year-old female working as a clerical support worker. They have bachelor level education and good health. They live as: couple without children. They own a car and a bike.\nSchedule block: diary routine-017, block 1, OTHER from 12:30 to 15:00.\nScore which kind of public place best fits this person and schedule block.', 'retail_shopping: public place type with example Overture categories academic_bookstore, adult_store, antique_store, appliance_store, aquatic_pet_store, archery_shop, audio_visual_equipment_store, auto_body_shop, avionics_shop, baby_gear_and_furniture, bagel_shop, beverage_store'],
['Charles is a 37-year-old male working as a elementary worker. They have vocational or technical level education and good health. They live as: living alone. They own a car.\nSchedule block: diary routine-021, block 4, OTHER from 14:00 to 18:00.\nScore which kind of public place best fits this person and schedule block.', 'work_industry: public place type with example Overture categories advertising_agency, agriculture, aircraft_manufacturer, appliance_manufacturer, auto_company, auto_manufacturers_and_distributors, bags_luggage_company, biotechnology_company, bottled_water_company, building_contractor, business_office_supplies_and_stationery, central_government_office'],
['Pauline is a 34-year-old female working as a craft or trades worker. They have secondary or less level education and good health. They live as: couple with children. They own a car.\nSchedule block: diary routine-016, block 2, OTHER from 08:30 to 12:00.\nScore which kind of public place best fits this person and schedule block.', 'personal_services: public place type with example Overture categories abuse_and_addiction_treatment, accountant, agricultural_service, aircraft_repair, alcohol_and_drug_treatment_centers, ambulance_and_ems_services, animal_rescue_service, appliance_repair_service, appraisal_services, archaeological_services, art_restoration_service, atms'],
['Marie is a 21-year-old female working as a craft or trades worker. They have secondary or less level education and poor health. They live as: couple with children. They rely on public transport or walking.\nSchedule block: diary routine-026, block 1, OTHER from 09:00 to 10:30.\nScore which kind of public place best fits this person and schedule block.', 'education: public place type with example Overture categories adult_education, art_school, boxing_class, circus_school, college_university, cooking_school, cosmetology_school, cycling_classes, dance_school, day_care_preschool, driving_school, education'],
['Mary is a 23-year-old female working as a manager. They have secondary or less level education and very good health. They live as: couple without children. They own a car and a bike.\nSchedule block: diary routine-029, block 5, OTHER from 11:00 to 12:00.\nScore which kind of public place best fits this person and schedule block.', 'health_care: public place type with example Overture categories acupuncture, aromatherapy, cannabis_clinic, childrens_hospital, chiropractor, clinical_laboratories, cosmetic_dentist, counseling_and_mental_health, dentist, dialysis_clinic, doctor, eye_care_clinic'],
]
scores = model.predict(pairs)
print(scores)
# [0.3402 0.1099 0.3431 0.1385 0.0929]
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'Charlotte is a 33-year-old female working as a clerical support worker. They have bachelor level education and good health. They live as: couple without children. They own a car and a bike.\nSchedule block: diary routine-017, block 1, OTHER from 12:30 to 15:00.\nScore which kind of public place best fits this person and schedule block.',
[
'retail_shopping: public place type with example Overture categories academic_bookstore, adult_store, antique_store, appliance_store, aquatic_pet_store, archery_shop, audio_visual_equipment_store, auto_body_shop, avionics_shop, baby_gear_and_furniture, bagel_shop, beverage_store',
'work_industry: public place type with example Overture categories advertising_agency, agriculture, aircraft_manufacturer, appliance_manufacturer, auto_company, auto_manufacturers_and_distributors, bags_luggage_company, biotechnology_company, bottled_water_company, building_contractor, business_office_supplies_and_stationery, central_government_office',
'personal_services: public place type with example Overture categories abuse_and_addiction_treatment, accountant, agricultural_service, aircraft_repair, alcohol_and_drug_treatment_centers, ambulance_and_ems_services, animal_rescue_service, appliance_repair_service, appraisal_services, archaeological_services, art_restoration_service, atms',
'education: public place type with example Overture categories adult_education, art_school, boxing_class, circus_school, college_university, cooking_school, cosmetology_school, cycling_classes, dance_school, day_care_preschool, driving_school, education',
'health_care: public place type with example Overture categories acupuncture, aromatherapy, cannabis_clinic, childrens_hospital, chiropractor, clinical_laboratories, cosmetic_dentist, counseling_and_mental_health, dentist, dialysis_clinic, doctor, eye_care_clinic',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
Training Details
Training Dataset
Unnamed Dataset
- Size: 8,000 training samples
- Columns:
sentence_0,sentence_1, andlabel - Approximate statistics based on the first 100 samples:
sentence_0 sentence_1 label type string string float modality text text details - min: 76 tokens
- mean: 80.8 tokens
- max: 86 tokens
- min: 58 tokens
- mean: 75.8 tokens
- max: 93 tokens
- min: 0.1
- mean: 0.36
- max: 0.8
- Samples:
sentence_0 sentence_1 label Charlotte is a 33-year-old female working as a clerical support worker. They have bachelor level education and good health. They live as: couple without children. They own a car and a bike.
Schedule block: diary routine-017, block 1, OTHER from 12:30 to 15:00.
Score which kind of public place best fits this person and schedule block.retail_shopping: public place type with example Overture categories academic_bookstore, adult_store, antique_store, appliance_store, aquatic_pet_store, archery_shop, audio_visual_equipment_store, auto_body_shop, avionics_shop, baby_gear_and_furniture, bagel_shop, beverage_store0.3Charles is a 37-year-old male working as a elementary worker. They have vocational or technical level education and good health. They live as: living alone. They own a car.
Schedule block: diary routine-021, block 4, OTHER from 14:00 to 18:00.
Score which kind of public place best fits this person and schedule block.work_industry: public place type with example Overture categories advertising_agency, agriculture, aircraft_manufacturer, appliance_manufacturer, auto_company, auto_manufacturers_and_distributors, bags_luggage_company, biotechnology_company, bottled_water_company, building_contractor, business_office_supplies_and_stationery, central_government_office0.1Pauline is a 34-year-old female working as a craft or trades worker. They have secondary or less level education and good health. They live as: couple with children. They own a car.
Schedule block: diary routine-016, block 2, OTHER from 08:30 to 12:00.
Score which kind of public place best fits this person and schedule block.personal_services: public place type with example Overture categories abuse_and_addiction_treatment, accountant, agricultural_service, aircraft_repair, alcohol_and_drug_treatment_centers, ambulance_and_ems_services, animal_rescue_service, appliance_repair_service, appraisal_services, archaeological_services, art_restoration_service, atms0.3 - Loss:
BinaryCrossEntropyLosswith these parameters:{ "activation_fn": "torch.nn.modules.linear.Identity", "pos_weight": null }
Training Hyperparameters
Non-Default Hyperparameters
num_train_epochs: 5
All Hyperparameters
Click to expand
per_device_train_batch_size: 8num_train_epochs: 5max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1label_smoothing_factor: 0.0bf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 8prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Nonedataloader_multiprocessing_context: Nonedataloader_in_order: Trueremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None
Training Logs
| Epoch | Step | Training Loss |
|---|---|---|
| 0.5 | 500 | 0.6695 |
| 1.0 | 1000 | 0.6311 |
| 1.5 | 1500 | 0.6157 |
| 2.0 | 2000 | 0.6106 |
| 2.5 | 2500 | 0.6032 |
| 3.0 | 3000 | 0.6017 |
| 3.5 | 3500 | 0.5981 |
| 4.0 | 4000 | 0.5911 |
| 4.5 | 4500 | 0.5884 |
| 5.0 | 5000 | 0.5864 |
Training Time
- Training: 6.6 minutes
Framework Versions
- Python: 3.12.13
- Sentence Transformers: 6.0.1
- Transformers: 5.17.0
- PyTorch: 2.11.0+cu130
- Accelerate: 1.15.0
- Datasets: 5.0.1
- Tokenizers: 0.23.2
Additional Resources
- Training and Finetuning Reranker Models with Sentence Transformers: the end-to-end guide for training or finetuning Cross Encoder (reranker) models.
- Multimodal Embedding & Reranker Models with Sentence Transformers: use text, image, audio, and video reranker models through the same API.
- Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers: training multimodal Cross Encoders.
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
- Downloads last month
- 57
Model tree for gefgu/modernbert-poi-type-aligner
Base model
answerdotai/ModernBERT-base