BAAI / LLARA-document

huggingface.co
Total runs: 187
24-hour runs: -4
7-day runs: 12
30-day runs: 30
Model's Last Updated: May 13 2024
sentence-similarity

Introduction of LLARA-document

Model Details of LLARA-document

For more details please refer to our github repo: https://github.com/FlagOpen/FlagEmbedding

LLARA ( paper )

In this project, we introduce LLaRA:

  • EBAE: Embedding-Based Auto-Encoding.
  • EBAR: Embedding-Based Auto-Regression.
Usage
import torch
from transformers import AutoModel, AutoTokenizer, LlamaModel

def get_query_inputs(queries, tokenizer, max_length=512):
    prefix = '"'
    suffix = '", predict the following passage within eight words: <s9><s10><s11><s12><s13><s14><s15><s16>'
    prefix_ids = tokenizer(prefix, return_tensors=None)['input_ids']
    suffix_ids = tokenizer(suffix, return_tensors=None)['input_ids'][1:]
    queries_inputs = []
    for query in queries:
        inputs = tokenizer(query,
                           return_tensors=None,
                           max_length=max_length,
                           truncation=True,
                           add_special_tokens=False)
        inputs['input_ids'] = prefix_ids + inputs['input_ids'] + suffix_ids
        inputs['attention_mask'] = [1] * len(inputs['input_ids'])
        queries_inputs.append(inputs)
    return tokenizer.pad(
            queries_inputs,
            padding=True,
            max_length=max_length,
            pad_to_multiple_of=8,
            return_tensors='pt',
        )

def get_passage_inputs(passages, tokenizer, max_length=512):
    prefix = '"'
    suffix = '", summarize the above passage within eight words: <s1><s2><s3><s4><s5><s6><s7><s8>'
    prefix_ids = tokenizer(prefix, return_tensors=None)['input_ids']
    suffix_ids = tokenizer(suffix, return_tensors=None)['input_ids'][1:]
    passages_inputs = []
    for passage in passages:
        inputs = tokenizer(passage,
                           return_tensors=None,
                           max_length=max_length,
                           truncation=True,
                           add_special_tokens=False)
        inputs['input_ids'] = prefix_ids + inputs['input_ids'] + suffix_ids
        inputs['attention_mask'] = [1] * len(inputs['input_ids'])
        passages_inputs.append(inputs)
    return tokenizer.pad(
            passages_inputs,
            padding=True,
            max_length=max_length,
            pad_to_multiple_of=8,
            return_tensors='pt',
        )

# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained('BAAI/LLARA-document')
model = AutoModel.from_pretrained('BAAI/LLARA-document')

# Define query and passage inputs
query = "What is llama?"
title = "Llama"
passage = "The llama is a domesticated South American camelid, widely used as a meat and pack animal by Andean cultures since the pre-Columbian era."
query_input = get_query_inputs([query], tokenizer)
passage_input = get_passage_inputs([passage], tokenizer)


with torch.no_grad():
    # compute query embedding
    query_outputs = model(**query_input, return_dict=True, output_hidden_states=True)
    query_embedding = query_outputs.hidden_states[-1][:, -8:, :]
    query_embedding = torch.mean(query_embedding, dim=1)
    query_embedding = torch.nn.functional.normalize(query_embedding, dim=-1)

    # compute passage embedding
    passage_outputs = model(**passage_input, return_dict=True, output_hidden_states=True)
    passage_embeddings = passage_outputs.hidden_states[-1][:, -8:, :]
    passage_embeddings = torch.mean(passage_embeddings, dim=1)
    passage_embeddings = torch.nn.functional.normalize(passage_embeddings, dim=-1)

    # compute similarity score
    score = query_embedding @ passage_embeddings.T
    print(score)
Acknowledgement

Thanks to the authors of open-sourced datasets, including MSMARCO, BEIR, etc. Thanks to the open-sourced libraries like Pyserini .

Citation

If you find this repository useful, please consider giving a star :star: and citation

@misc{li2023making,
      title={Making Large Language Models A Better Foundation For Dense Retrieval}, 
      author={Chaofan Li and Zheng Liu and Shitao Xiao and Yingxia Shao},
      year={2023},
      eprint={2312.15503},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Runs of BAAI LLARA-document on huggingface.co

187
Total runs
-4
24-hour runs
-5
3-day runs
12
7-day runs
30
30-day runs

More Information About LLARA-document huggingface.co Model

More LLARA-document license Visit here:

https://choosealicense.com/licenses/mit

LLARA-document huggingface.co

LLARA-document huggingface.co is an AI model on huggingface.co that provides LLARA-document's model effect (), which can be used instantly with this BAAI LLARA-document model. huggingface.co supports a free trial of the LLARA-document model, and also provides paid use of the LLARA-document. Support call LLARA-document model through api, including Node.js, Python, http.

LLARA-document huggingface.co Url

https://huggingface.co/BAAI/LLARA-document

BAAI LLARA-document online free

LLARA-document huggingface.co is an online trial and call api platform, which integrates LLARA-document's modeling effects, including api services, and provides a free online trial of LLARA-document, you can try LLARA-document online for free by clicking the link below.

BAAI LLARA-document online free url in huggingface.co:

https://huggingface.co/BAAI/LLARA-document

LLARA-document install

LLARA-document is an open source model from GitHub that offers a free installation service, and any user can find LLARA-document on GitHub to install. At the same time, huggingface.co provides the effect of LLARA-document install, users can directly use LLARA-document installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

LLARA-document install url in huggingface.co:

https://huggingface.co/BAAI/LLARA-document

Url of LLARA-document

LLARA-document huggingface.co Url

Provider of LLARA-document huggingface.co

BAAI
ORGANIZATIONS

Other API from BAAI

huggingface.co

Total runs: 58.5M
Run Growth: -6.1M
Growth Rate: -10.48%
Updated:February 22 2024
huggingface.co

Total runs: 31.9M
Run Growth: -6.2M
Growth Rate: -19.43%
Updated:July 03 2024
huggingface.co

Total runs: 10.0M
Run Growth: -2.0M
Growth Rate: -20.39%
Updated:February 21 2024
huggingface.co

Total runs: 9.0M
Run Growth: -1.5M
Growth Rate: -16.43%
Updated:February 21 2024
huggingface.co

Total runs: 2.3M
Run Growth: -81.5K
Growth Rate: -3.50%
Updated:April 17 2024
huggingface.co

Total runs: 417.9K
Run Growth: -395.8K
Growth Rate: -94.70%
Updated:October 12 2023
huggingface.co

Total runs: 351.1K
Run Growth: -812.9K
Growth Rate: -231.50%
Updated:April 02 2024
huggingface.co

Total runs: 193.5K
Run Growth: -29.8K
Growth Rate: -15.42%
Updated:December 13 2023
huggingface.co

Total runs: 114.5K
Run Growth: 62.2K
Growth Rate: 54.28%
Updated:October 12 2023
huggingface.co

Total runs: 44.2K
Run Growth: -5.5K
Growth Rate: -12.40%
Updated:November 14 2023
huggingface.co

Total runs: 41.4K
Run Growth: -24.6K
Growth Rate: -59.53%
Updated:July 13 2026
huggingface.co

Total runs: 37.9K
Run Growth: -20.5K
Growth Rate: -54.24%
Updated:October 12 2023
huggingface.co

Total runs: 32.8K
Run Growth: -6.2K
Growth Rate: -18.99%
Updated:January 15 2025
huggingface.co

Total runs: 12.1K
Run Growth: -3.7K
Growth Rate: -30.45%
Updated:April 16 2025
huggingface.co

Total runs: 10.3K
Run Growth: 10.3K
Growth Rate: 100.00%
Updated:September 16 2026
huggingface.co

Total runs: 10.0K
Run Growth: -57.8K
Growth Rate: -576.84%
Updated:October 12 2023
huggingface.co

Total runs: 4.2K
Run Growth: -6.5K
Growth Rate: -154.95%
Updated:October 12 2023
huggingface.co

Total runs: 3.4K
Run Growth: -1.6K
Growth Rate: -46.83%
Updated:May 20 2025
huggingface.co

Total runs: 3.0K
Run Growth: -2.5K
Growth Rate: -82.64%
Updated:April 19 2024
huggingface.co

Total runs: 1.9K
Run Growth: 1.9K
Growth Rate: 100.00%
Updated:October 01 2026
huggingface.co

Total runs: 1.6K
Run Growth: -33
Growth Rate: -2.01%
Updated:April 10 2026
huggingface.co

Total runs: 1.6K
Run Growth: -253
Growth Rate: -15.67%
Updated:January 15 2025
huggingface.co

Total runs: 1.4K
Run Growth: -2.2K
Growth Rate: -152.77%
Updated:September 11 2026
huggingface.co

Total runs: 1.2K
Run Growth: -818
Growth Rate: -65.70%
Updated:December 31 2022
huggingface.co

Total runs: 1.2K
Run Growth: -484
Growth Rate: -40.64%
Updated:April 10 2026
huggingface.co

Total runs: 1.2K
Run Growth: -203
Growth Rate: -17.38%
Updated:November 28 2024
huggingface.co

Total runs: 749
Run Growth: -43
Growth Rate: -5.64%
Updated:February 07 2024
huggingface.co

Total runs: 736
Run Growth: 717
Growth Rate: 97.42%
Updated:October 13 2025
huggingface.co

Total runs: 511
Run Growth: -54
Growth Rate: -10.57%
Updated:July 13 2026
huggingface.co

Total runs: 501
Run Growth: 301
Growth Rate: 60.08%
Updated:April 02 2024
huggingface.co

Total runs: 470
Run Growth: 53
Growth Rate: 11.28%
Updated:April 18 2023
huggingface.co

Total runs: 456
Run Growth: -312
Growth Rate: -68.42%
Updated:May 23 2025
huggingface.co

Total runs: 445
Run Growth: 122
Growth Rate: 27.42%
Updated:July 13 2026
huggingface.co

Total runs: 437
Run Growth: -843
Growth Rate: -192.91%
Updated:October 23 2024
huggingface.co

Total runs: 434
Run Growth: -16
Growth Rate: -3.69%
Updated:July 13 2026
huggingface.co

Total runs: 425
Run Growth: 139
Growth Rate: 32.71%
Updated:December 25 2025
huggingface.co

Total runs: 416
Run Growth: 111
Growth Rate: 27.27%
Updated:March 07 2024
huggingface.co

Total runs: 410
Run Growth: 20
Growth Rate: 4.88%
Updated:October 27 2023
huggingface.co

Total runs: 387
Run Growth: -686
Growth Rate: -177.26%
Updated:October 24 2024
huggingface.co

Total runs: 374
Run Growth: 6
Growth Rate: 1.60%
Updated:August 11 2026
huggingface.co

Total runs: 364
Run Growth: 162
Growth Rate: 44.51%
Updated:July 13 2026
huggingface.co

Total runs: 361
Run Growth: -16
Growth Rate: -4.43%
Updated:August 11 2026
huggingface.co

Total runs: 300
Run Growth: -191
Growth Rate: -63.67%
Updated:April 10 2026
huggingface.co

Total runs: 288
Run Growth: -31
Growth Rate: -10.76%
Updated:August 18 2026
huggingface.co

Total runs: 284
Run Growth: -71
Growth Rate: -25.00%
Updated:July 13 2026
huggingface.co

Total runs: 268
Run Growth: 45
Growth Rate: 16.79%
Updated:June 06 2025
huggingface.co

Total runs: 268
Run Growth: 60
Growth Rate: 22.39%
Updated:July 13 2026
huggingface.co

Total runs: 265
Run Growth: 83
Growth Rate: 31.32%
Updated:July 13 2026
huggingface.co

Total runs: 254
Run Growth: -33
Growth Rate: -12.99%
Updated:July 13 2026
huggingface.co

Total runs: 245
Run Growth: 100
Growth Rate: 40.82%
Updated:November 28 2023
huggingface.co

Total runs: 229
Run Growth: 50
Growth Rate: 21.83%
Updated:October 23 2024
huggingface.co

Total runs: 224
Run Growth: -86
Growth Rate: -38.39%
Updated:December 25 2025
huggingface.co

Total runs: 219
Run Growth: 57
Growth Rate: 26.03%
Updated:July 13 2026
huggingface.co

Total runs: 218
Run Growth: 84
Growth Rate: 38.53%
Updated:July 13 2026
huggingface.co

Total runs: 215
Run Growth: -8
Growth Rate: -3.72%
Updated:July 17 2026
huggingface.co

Total runs: 202
Run Growth: -1.0K
Growth Rate: -500.00%
Updated:September 11 2026
huggingface.co

Total runs: 198
Run Growth: 29
Growth Rate: 14.65%
Updated:June 24 2024
huggingface.co

Total runs: 191
Run Growth: 34
Growth Rate: 17.80%
Updated:May 13 2024
huggingface.co

Total runs: 189
Run Growth: 43
Growth Rate: 22.75%
Updated:June 24 2024
huggingface.co

Total runs: 186
Run Growth: 34
Growth Rate: 18.28%
Updated:May 13 2024
huggingface.co

Total runs: 185
Run Growth: 49
Growth Rate: 26.49%
Updated:December 21 2023
huggingface.co

Total runs: 184
Run Growth: 32
Growth Rate: 17.39%
Updated:May 31 2024
huggingface.co

Total runs: 183
Run Growth: 42
Growth Rate: 22.95%
Updated:December 21 2023