Legal Contract NLI

Description

This is a text-to-text generation model (encode-decoder architecture) that has undergone fine-tuning on contract for Natural Language Inference on in-house curated dataset, aiming to streamline and expedite the contract review process. The objective of this task is to provide a system with a set of hypotheses, like “Some obligations of Agreement may survive termination,” along with a contract, and task it with classifying whether each hypothesis is entailed, contradicted, or not mentioned (neutral) by the contract.

Predicted Entities

Contradiction, Entailment, Neutral

Copy S3 URI

How to use

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

flant5 = legal.TextGenerator.pretrained('leggen_contract_nli','en','legal/models')\
    .setInputCols(["document"])\
    .setMaxNewTokens(256)\
    .setStopAtEos(True)\
    .setOutputCol("generated")

pipeline = nlp.Pipeline(stages=[document_assembler, flant5])

data = spark.createDataFrame([
   [1, '''mnli hypothesis:
Receiving Party shall not use any Confidential Information for any purpose other than the purposes stated in Agreement.
premise:
(a) furnish only that portion of the Proprietary Information which in its reasonable opinion, based upon advice of counsel, it is legally compelled to disclose, and (b) at the other Party's cost, cooperate with the efforts of the Party to obtain order or other reliable assurance that confidential treat will he accorded to such portion of the Proprietary Information as may be disclosed.
''']]).toDF('id', 'text')

results = pipeline.fit(data).transform(data)

results.select("generated.result").show(truncate=False)

Results

+---------+
|result   |
+---------+
|[Neutral]|
+---------+

Model Information

Model Name: leggen_contract_nli
Compatibility: Legal NLP 1.0.0+
License: Licensed
Edition: Official
Language: en
Size: 1.6 GB