Run this model with HF Jobs

Run DannieAI/bge-base-Apple-matryoshka on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/DannieAI/bge-base-Apple-matryoshka. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/DannieAI/bge-base-Apple-matryoshka on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Apple data Matryoshka

This is a sentence-transformers model finetuned from BAAI/bge-base-en-v1.5 on the json dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: BAAI/bge-base-en-v1.5
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text
  • Training Dataset:
    • json
  • Language: en
  • License: apache-2.0

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
  (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'cls', 'include_prompt': True})
  (2): Normalize({})
)

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 SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("DannieAI/bge-base-Apple-matryoshka")
# Run inference
queries = [
    'projects. The five Green Source Rider projects have \na combined capacity of 22 megawatts. In 2017, \nwe made long-term commitments to five more \nsolar projects in North Carolina, for an additional \n85 megawatts of renewable energy.\nThe energy efficiency measures we’ve implemented \nat our Maiden data centers include use of outside air \ncooling through a waterside economizer during night \nand cool-weather hours, which, along with water \nstorage, allows the chillers to be idle 75 percent \nof\xa0the time.\nMaiden, North Carolina: Grid mix versus. Apple-sourced renewable energy \nElectricity use in 2023: 453 million kWh\nEmissions avoided in 2023: 121,00 million MT CO2e3\nDefault grid mix\n%\nx\nApple actual renewable energy allocation\n%\nGas\n43\nApple’s solar projects\n88\nNuclear\n32\nApple’s wind projects\n12\nCoal\n11\nSource: 2023 energy data. \nRenewable\n10\nHydro\n4\nSource: eGRID 2022.\n2 \t In our 2023 Environmental Progress Report, \nwe stated that we operate eight data centers. \nFor fiscal year 2023, we no longer include the \nNewark, CA data center as it has been sold in \nfiscal year 2022.\n3 \t Emissions avoided are calculated using the GHG \nProtocol methodology for calculating market-\nbased emissions.\n2024  Environmental Progress Report\x08 89\nEngagement and Advocacy\nEnvironmental Initiatives\nData\nIntroduction \nContents\nAppendixPrineville, Oregon\n100 percent renewable since opening May 2012\nTo support our Prineville data center, we signed a \n200-megawatt power purchase agreement for a \nnew Oregon wind farm, the Montague Wind Power \nFacility, which entered commercial operation at the \nend of 2019.\nThis is in addition to our power purchase agreement \nfor the 56-megawatt Solar Star Oregon II project \nlocated just a few miles from our data center. This \nsolar PV project came online and began supporting \nthe data center in 2017. To strengthen the connection \nbetween Apple and these projects, we use Oregon’s \nDirect Access program to supply the renewable \nenergy from these projects directly to our data center.\nAlso supporting the data center are two microhydro \nprojects that harness the power of water flowing \nthrough local irrigation canals that have been \noperating for over 60 years. To supplement these \nprojects, we executed a long-term purchase \nagreement for all environmental attributes from \na 69-megawatt portfolio of eight solar projects \nin Oregon.\nOur Prineville data center takes advantage of the cool \nand dry climate by cooling its servers with outside \nair whenever possible. Indirect evaporative cooling \nis enabled when the outside air temperature gets too \nhigh to cool the servers with outside air alone.\nPrineville, Oregon: Grid mix versus Apple-sourced renewable energy\nElectricity use in 2023: 269 million kWh\nEmissions avoided in 2023: 79,800 million CO2e4\nDefault grid mix\n%\nx\nApple actual renewable energy allocation\n%\nHydro\n51\nApple’s solar projects\n38\nGas\n31\nApple’s wind projects\n60\nRenewable\n18\nApple’s microhydro projects\n2\nSource: eGrid 2022.\nSource: 2023 energy data. \nReno, Nevada\n100 percent renewable since opening',
]
documents = [
    'how many million kWh of electricity did the prineville data center use in 2023?',
    'why is sea freight preferred over air cargo for reducing carbon footprint?',
    'What year has been set as the goal to transition to fully fiber-based device packaging?',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.6869, 0.2901, 0.2612]])

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.0069
cosine_accuracy@3 0.0138
cosine_accuracy@5 0.0138
cosine_accuracy@10 0.055
cosine_precision@1 0.0069
cosine_precision@3 0.0046
cosine_precision@5 0.0028
cosine_precision@10 0.0055
cosine_recall@1 0.0069
cosine_recall@3 0.0138
cosine_recall@5 0.0138
cosine_recall@10 0.055
cosine_ndcg@10 0.0234
cosine_mrr@10 0.0147
cosine_map@100 0.0481

Information Retrieval

Metric Value
cosine_accuracy@1 0.0069
cosine_accuracy@3 0.0138
cosine_accuracy@5 0.0138
cosine_accuracy@10 0.0505
cosine_precision@1 0.0069
cosine_precision@3 0.0046
cosine_precision@5 0.0028
cosine_precision@10 0.005
cosine_recall@1 0.0069
cosine_recall@3 0.0138
cosine_recall@5 0.0138
cosine_recall@10 0.0505
cosine_ndcg@10 0.0223
cosine_mrr@10 0.0144
cosine_map@100 0.0481

Information Retrieval

Metric Value
cosine_accuracy@1 0.0069
cosine_accuracy@3 0.0115
cosine_accuracy@5 0.0115
cosine_accuracy@10 0.0482
cosine_precision@1 0.0069
cosine_precision@3 0.0038
cosine_precision@5 0.0023
cosine_precision@10 0.0048
cosine_recall@1 0.0069
cosine_recall@3 0.0115
cosine_recall@5 0.0115
cosine_recall@10 0.0482
cosine_ndcg@10 0.0205
cosine_mrr@10 0.013
cosine_map@100 0.0465

Information Retrieval

Metric Value
cosine_accuracy@1 0.0023
cosine_accuracy@3 0.0046
cosine_accuracy@5 0.0046
cosine_accuracy@10 0.0413
cosine_precision@1 0.0023
cosine_precision@3 0.0015
cosine_precision@5 0.0009
cosine_precision@10 0.0041
cosine_recall@1 0.0023
cosine_recall@3 0.0046
cosine_recall@5 0.0046
cosine_recall@10 0.0413
cosine_ndcg@10 0.0146
cosine_mrr@10 0.0073
cosine_map@100 0.0402

Information Retrieval

Metric Value
cosine_accuracy@1 0.0069
cosine_accuracy@3 0.0115
cosine_accuracy@5 0.0115
cosine_accuracy@10 0.0413
cosine_precision@1 0.0069
cosine_precision@3 0.0038
cosine_precision@5 0.0023
cosine_precision@10 0.0041
cosine_recall@1 0.0069
cosine_recall@3 0.0115
cosine_recall@5 0.0115
cosine_recall@10 0.0413
cosine_ndcg@10 0.0187
cosine_mrr@10 0.0124
cosine_map@100 0.0409

Training Details

Training Dataset

json

  • Dataset: json
  • Size: 3,924 training samples
  • Columns: positive and anchor
  • Approximate statistics based on the first 100 samples:
    positive anchor
    type string string
    modality text text
    details
    • min: 487 tokens
    • mean: 511.69 tokens
    • max: 512 tokens
    • min: 10 tokens
    • mean: 17.83 tokens
    • max: 27 tokens
  • Samples:
    positive anchor
    from home, upstream impacts
    from scope 1 fuels, and third-
    party cloud services.
    Avoided emissions
    Gross emissions
    Emissions offset
    15.6 Million Metric Tons Net Greenhouse Gas Emissions*
    59%
    29%
    9%
    <1%
    <1%
    <1%
    3%
    Emissions
    Offsets
    Product footprint
    Product use clean energy†:
    0.05 million metric tons avoided
    Low-carbon logistics:
    0.2 million metric tons avoided
    Supplier energy efficiency:
    1.7 million metric tons avoided
    Low-carbon materials**:
    5.8 million metric tons avoided
    Supplier clean energy:
    18.5 million metric tons avoided
    Direct emissions abatement:
    2.7 million metric tons avoided
    Corporate footprint
    Corporate
    energy
    efficiency:
    0.08 million
    metric tons
    avoided
    Use of
    renewable
    electricity:
    2.0 million
    metric tons
    avoided
    Apple’s comprehensive carbon footprint
    Product
    manufacturing
    (Scope 3)
    Product use
    (Scope 3)
    Product transport
    (Scope 3)
    End-of-life
    product processes
    (Scope 3)
    Direct emissions
    (Scope 1)
    Electricity
    (Scope 2)
    Business
    operations‡
    (Scope...
    What is the breakdown of avoided carbon emissions across initiatives like low-carbon materials and clean energy?
    stores in California.
    2013
    GreenEnergy Rider: We opened a new data center
    in Reno, Nevada. With no PURPA or Direct Access
    options in Nevada, we worked directly with the local
    utility, NV Energy, to create a whole new regulatory
    structure. The Nevada GreenEnergy Rider enables
    us to secure a long-term, fixed-price contract for
    renewable electricity from a new solar PV project
    built for us but managed by the utility. We’ve used
    this partnership to create four solar projects totaling
    320 megawatts.
    2014
    Equity investment: We invested in two 20-megawatt
    solar PV projects in Sichuan, China, to support
    all our in-country retail stores, corporate offices,
    and data storage facilities. This project represented
    the first time a commercial company created a new
    large-scale project in China for its own use. We’ve
    since replicated this model many times for Apple’s
    supply chain.
    2015 & 2016
    Portfolio solutions: We adapted to land scarcity
    constraints in Singapore and Japan by contrac...
    How does onsite power generation from rooftop solar and biogas work with battery microgrids?
    from home, upstream impacts
    from scope 1 fuels, and third-
    party cloud services.
    Avoided emissions
    Gross emissions
    Emissions offset
    15.6 Million Metric Tons Net Greenhouse Gas Emissions*
    59%
    29%
    9%
    <1%
    <1%
    <1%
    3%
    Emissions
    Offsets
    Product footprint
    Product use clean energy†:
    0.05 million metric tons avoided
    Low-carbon logistics:
    0.2 million metric tons avoided
    Supplier energy efficiency:
    1.7 million metric tons avoided
    Low-carbon materials**:
    5.8 million metric tons avoided
    Supplier clean energy:
    18.5 million metric tons avoided
    Direct emissions abatement:
    2.7 million metric tons avoided
    Corporate footprint
    Corporate
    energy
    efficiency:
    0.08 million
    metric tons
    avoided
    Use of
    renewable
    electricity:
    2.0 million
    metric tons
    avoided
    Apple’s comprehensive carbon footprint
    Product
    manufacturing
    (Scope 3)
    Product use
    (Scope 3)
    Product transport
    (Scope 3)
    End-of-life
    product processes
    (Scope 3)
    Direct emissions
    (Scope 1)
    Electricity
    (Scope 2)
    Business
    operations‡
    (Scope...
    How many metric tons of greenhouse gases were avoided through supplier clean energy programs and low-carbon materials?
  • Loss: MatryoshkaLoss with these parameters:
    {
        "loss": "MultipleNegativesRankingLoss",
        "matryoshka_dims": [
            768,
            512,
            256,
            128,
            64
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • num_train_epochs: 4
  • learning_rate: 2e-05
  • lr_scheduler_type: cosine
  • warmup_steps: 0.1
  • gradient_accumulation_steps: 16
  • per_device_eval_batch_size: 16
  • load_best_model_at_end: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 32
  • num_train_epochs: 4
  • max_steps: -1
  • learning_rate: 2e-05
  • lr_scheduler_type: cosine
  • lr_scheduler_kwargs: None
  • warmup_steps: 0.1
  • optim: adamw_torch_fused
  • optim_args: None
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 16
  • average_tokens_across_devices: True
  • max_grad_norm: 1.0
  • label_smoothing_factor: 0.0
  • bf16: False
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: False
  • project: huggingface
  • trackio_space_id: None
  • trackio_bucket_id: None
  • trackio_static_space_id: None
  • per_device_eval_batch_size: 16
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: False
  • hub_private_repo: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 42
  • data_seed: None
  • use_cpu: False
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • dataloader_multiprocessing_context: None
  • dataloader_in_order: True
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_static_graph: None
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: None
  • fsdp_config: None
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • local_rank: -1
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}
  • warmup_ratio: None

Training Logs

Epoch Step Training Loss dim_768_cosine_ndcg@10 dim_512_cosine_ndcg@10 dim_256_cosine_ndcg@10 dim_128_cosine_ndcg@10 dim_64_cosine_ndcg@10
1.0 4 - 0.0169 0.0222 0.0156 0.0140 0.0140
2.0 8 - 0.0219 0.0252 0.0205 0.0139 0.0182
2.5161 10 10.9379 - - - - -
3.0 12 - 0.0234 0.0238 0.0198 0.0169 0.0193
4.0 16 - 0.0234 0.0223 0.0205 0.0146 0.0187
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 1.1 hours

Framework Versions

  • Python: 3.13.16
  • Sentence Transformers: 5.7.0
  • Transformers: 5.20.2
  • PyTorch: 2.11.0+cu130
  • Accelerate: 1.15.0
  • Datasets: 4.8.5
  • Tokenizers: 0.23.3

Additional Resources

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",
}

MatryoshkaLoss

@misc{kusupati2024matryoshka,
    title={Matryoshka Representation Learning},
    author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
    year={2024},
    eprint={2205.13147},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

MultipleNegativesRankingLoss

@misc{oord2019representationlearningcontrastivepredictive,
      title={Representation Learning with Contrastive Predictive Coding},
      author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
      year={2019},
      eprint={1807.03748},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1807.03748},
}
Downloads last month
24
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for DannieAI/bge-base-Apple-matryoshka

Finetuned
(517)
this model

Papers for DannieAI/bge-base-Apple-matryoshka

Evaluation results