BAAI / LLARA-document

huggingface.co
Total runs: 183
24-hour runs: -16
7-day runs: -27
30-day runs: 10
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

183
Total runs
-16
24-hour runs
-5
3-day runs
-27
7-day runs
10
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: 53.0M
Run Growth: -10.2M
Growth Rate: -19.27%
Updated:February 22 2024
huggingface.co

Total runs: 29.9M
Run Growth: -6.4M
Growth Rate: -21.52%
Updated:July 03 2024
huggingface.co

Total runs: 9.6M
Run Growth: -287.7K
Growth Rate: -2.98%
Updated:February 21 2024
huggingface.co

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

Total runs: 2.5M
Run Growth: 601.0K
Growth Rate: 24.01%
Updated:April 17 2024
huggingface.co

Total runs: 339.8K
Run Growth: -540.6K
Growth Rate: -159.06%
Updated:April 02 2024
huggingface.co

Total runs: 308.2K
Run Growth: -394.5K
Growth Rate: -128.01%
Updated:October 12 2023
huggingface.co

Total runs: 163.4K
Run Growth: -47.6K
Growth Rate: -29.15%
Updated:December 13 2023
huggingface.co

Total runs: 137.6K
Run Growth: 86.3K
Growth Rate: 62.71%
Updated:October 12 2023
huggingface.co

Total runs: 107.0K
Run Growth: 62.1K
Growth Rate: 58.08%
Updated:October 12 2023
huggingface.co

Total runs: 58.2K
Run Growth: 18.1K
Growth Rate: 31.06%
Updated:November 14 2023
huggingface.co

Total runs: 23.7K
Run Growth: -38.6K
Growth Rate: -162.86%
Updated:July 13 2026
huggingface.co

Total runs: 22.5K
Run Growth: -18.6K
Growth Rate: -82.77%
Updated:January 15 2025
huggingface.co

Total runs: 20.9K
Run Growth: 11.5K
Growth Rate: 55.15%
Updated:October 12 2023
huggingface.co

Total runs: 6.9K
Run Growth: -9.3K
Growth Rate: -135.83%
Updated:April 16 2025
huggingface.co

Total runs: 4.1K
Run Growth: -614
Growth Rate: -15.06%
Updated:April 19 2024
huggingface.co

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

Total runs: 2.7K
Run Growth: -2.7K
Growth Rate: -98.58%
Updated:May 20 2025
huggingface.co

Total runs: 2.7K
Run Growth: -72.5K
Growth Rate: -2709.15%
Updated:October 12 2023
huggingface.co

Total runs: 1.5K
Run Growth: -890
Growth Rate: -60.01%
Updated:April 10 2026
huggingface.co

Total runs: 1.4K
Run Growth: -591
Growth Rate: -42.34%
Updated:January 15 2025
huggingface.co

Total runs: 1.3K
Run Growth: -1.2K
Growth Rate: -88.45%
Updated:September 11 2026
huggingface.co

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

Total runs: 1.1K
Run Growth: -747
Growth Rate: -69.55%
Updated:April 10 2026
huggingface.co

Total runs: 1.1K
Run Growth: -690
Growth Rate: -65.53%
Updated:December 31 2022
huggingface.co

Total runs: 842
Run Growth: 447
Growth Rate: 53.09%
Updated:August 11 2026
huggingface.co

Total runs: 839
Run Growth: 483
Growth Rate: 57.57%
Updated:August 11 2026
huggingface.co

Total runs: 794
Run Growth: 779
Growth Rate: 98.11%
Updated:October 13 2025
huggingface.co

Total runs: 666
Run Growth: -11
Growth Rate: -1.65%
Updated:February 07 2024
huggingface.co

Total runs: 627
Run Growth: 388
Growth Rate: 61.88%
Updated:June 06 2025
huggingface.co

Total runs: 622
Run Growth: 438
Growth Rate: 70.42%
Updated:March 13 2026
huggingface.co

Total runs: 504
Run Growth: -831
Growth Rate: -164.88%
Updated:September 11 2026
huggingface.co

Total runs: 493
Run Growth: -143
Growth Rate: -29.01%
Updated:October 23 2024
huggingface.co

Total runs: 474
Run Growth: 181
Growth Rate: 38.19%
Updated:October 27 2023
huggingface.co

Total runs: 435
Run Growth: 87
Growth Rate: 20.00%
Updated:July 13 2026
huggingface.co

Total runs: 429
Run Growth: -259
Growth Rate: -60.37%
Updated:May 23 2025
huggingface.co

Total runs: 416
Run Growth: 37
Growth Rate: 8.89%
Updated:July 13 2026
huggingface.co

Total runs: 415
Run Growth: 162
Growth Rate: 39.04%
Updated:March 07 2024
huggingface.co

Total runs: 412
Run Growth: -248
Growth Rate: -60.19%
Updated:October 24 2024
huggingface.co

Total runs: 410
Run Growth: -51
Growth Rate: -12.44%
Updated:July 13 2026
huggingface.co

Total runs: 395
Run Growth: 31
Growth Rate: 7.85%
Updated:December 25 2025
huggingface.co

Total runs: 337
Run Growth: 64
Growth Rate: 18.99%
Updated:July 13 2026
huggingface.co

Total runs: 331
Run Growth: -10.0K
Growth Rate: -3025.98%
Updated:September 16 2026
huggingface.co

Total runs: 323
Run Growth: -167
Growth Rate: -51.70%
Updated:April 18 2023
huggingface.co

Total runs: 312
Run Growth: 85
Growth Rate: 27.24%
Updated:July 13 2026
huggingface.co

Total runs: 304
Run Growth: 15
Growth Rate: 4.93%
Updated:July 13 2026
huggingface.co

Total runs: 296
Run Growth: 94
Growth Rate: 31.76%
Updated:July 13 2026
huggingface.co

Total runs: 281
Run Growth: 25
Growth Rate: 8.90%
Updated:August 18 2026
huggingface.co

Total runs: 278
Run Growth: 80
Growth Rate: 28.78%
Updated:November 28 2023
huggingface.co

Total runs: 263
Run Growth: 73
Growth Rate: 27.76%
Updated:October 23 2024
huggingface.co

Total runs: 258
Run Growth: -182
Growth Rate: -70.54%
Updated:April 10 2026
huggingface.co

Total runs: 251
Run Growth: 63
Growth Rate: 25.10%
Updated:July 13 2026
huggingface.co

Total runs: 251
Run Growth: -40
Growth Rate: -15.94%
Updated:July 13 2026
huggingface.co

Total runs: 243
Run Growth: -35
Growth Rate: -14.40%
Updated:December 25 2025
huggingface.co

Total runs: 218
Run Growth: 7
Growth Rate: 3.21%
Updated:July 17 2026
huggingface.co

Total runs: 213
Run Growth: 18
Growth Rate: 8.45%
Updated:July 13 2026
huggingface.co

Total runs: 212
Run Growth: 41
Growth Rate: 19.34%
Updated:June 24 2024
huggingface.co

Total runs: 208
Run Growth: 46
Growth Rate: 22.12%
Updated:December 21 2023
huggingface.co

Total runs: 208
Run Growth: 39
Growth Rate: 18.75%
Updated:June 24 2024
huggingface.co

Total runs: 200
Run Growth: 34
Growth Rate: 17.00%
Updated:December 21 2023