Legal E5 Embedding Base

Description

This model is a legal version of the E5 base model fine-tuned on Edgar and legal question-answering datasets. Reference: Wang, Liang, et al. “Text embeddings by weakly-supervised contrastive pre-training.” arXiv preprint arXiv:2212.03533 (2022).

Predicted Entities

Copy S3 URI

How to use

document_assembler = (
    nlp.DocumentAssembler().setInputCol("text").setOutputCol("document")
)

E5_embedding = (
    nlp.E5Embeddings.pretrained(
        "legembedding_e5_base", "en", "legal/models"
    )
    .setInputCols(["document"])
    .setOutputCol("E5")
)
pipeline = nlp.Pipeline(stages=[document_assembler, E5_embedding])

data = spark.createDataFrame([[' What is the rate of shipment for crude oil from the Lincoln Parish Plant to the Mount Olive Plant and from the Mount Olive Plant to the DCP Black Lake in Ada, LA?']]).toDF("text")


result = pipeline.fit(data).transform(data)
result. Select("E5.result").show()

Results

+----------------------------------------------------------------------------------------------------+
|                                                                                          embeddings|
+----------------------------------------------------------------------------------------------------+
|[-1.0422493, 0.008562431, -0.31533027, -0.39874774, 0.27517456, 0.6205345, -0.34923095, 0.2872358...|
+----------------------------------------------------------------------------------------------------+

Model Information

Model Name: legembedding_e5_base
Compatibility: Legal NLP 1.0.0+
License: Licensed
Edition: Official
Input Labels: [document]
Output Labels: [E5]
Language: en
Size: 393.9 MB

References

We used in-house annotated data.