LEGAL-BERT

Use Costs

001-01

001-01-BERT-CCM@EuroTraining.com

LEGAL-BERT Use Costs

TABLE OF CONTENTS

1. Training and Fine-Tuning Costs

1.    AWS EC2

a.     Compute Costs

                                                                                                    i.     Instance Type

                                                                                                  ii.     Hourly Cost

                                                                                                iii.     Training Time

b.    Storage Costs

                                                                                                    i.     S3 Storage

                                                                                                  ii.     Example Cost

c.     Data Transfer Costs

                                                                                                    i.     Inbound Data

                                                                                                  ii.     Outbound Data

2.    Google Compute Engine (GCE)

a.     Compute Costs

                                                                                                    i.     Instance Type

                                                                                                  ii.     Hourly Cost

                                                                                                iii.     Training Time

b.    Storage Costs

                                                                                                    i.     Google Cloud Storage

                                                                                                  ii.     Example Cost

c.     Data Transfer Costs

                                                                                                    i.     Inbound Data

                                                                                                  ii.     Outbound Data

3.    Azure Virtual Machines (VMs)

a.     Compute Costs

                                                                                                    i.     Instance Type

                                                                                                  ii.     Hourly Cost

b.    Training Time

c.     Storage Costs

                                                                                                    i.     Azure Blob Storage

                                                                                                  ii.     Example Cost

d.    Data Transfer Costs

                                                                                                    i.     Inbound Data

                                                                                                  ii.     Outbound Data

2. Deployment and Inference Costs

1.    AWS EC2

a.     Inference Costs

b.    Instance Type

                                                                                                    i.     Hourly Cost

                                                                                                  ii.     Example Cost

c.     Elastic Inference

2.    Google Compute Engine (GCE)

a.     Inference Costs

                                                                                                    i.     Instance Type

                                                                                                  ii.     Hourly Cost

                                                                                                iii.     Example Cost

3.    AutoML or AI Platform

4.    Azure Virtual Machines (VMs)

5.    Inference Costs

a.     Instance Type

b.    Hourly Cost

c.     Example Cost

6.    Azure ML Service

3. Storage and Data Management Costs

1.    AWS S3

a.    Standard Storage

b.    Infrequent Access Storage

c.     Example Cost

2.    Google Cloud Storage

a.     Standard Storage

b.    Nearline Storage

c.     Example Cost

3.    Azure Blob Storage

a.     Standard Storage

b.    Cool Storage

c.     Example Cost

4. Support and Management Costs

AWS

1.    Support Plans

2.    Managed Services

Google Cloud

1.    Support Plans

2.    Managed AI Services

Azure

1.    Support Plans

2.    Managed AI Services

5. Cost Optimization Strategies

1.    Use Spot or Preemptible Instances

2.    Scale Inference on Demand

3.    Optimize Storage Costs

4.    Reserved Instances or Savings Plans

 

LEGAL-BERT

Use Costs

 

LEGAL-BERT Use Costs

·      The costs associated with using Legal-BERT, a specialized version of the BERT model fine-tuned for legal texts, can vary depending on how you choose to deploy and use the model. The costs are typically related to the computational resources required to train, fine-tune, and deploy the model, as well as storage and data transfer costs. Here's a breakdown of the potential costs associated with using Legal-BERT across different cloud platforms such as AWS, Google Cloud, and Azure.

·      The cost of using Legal-BERT can vary widely based on how you deploy and manage the model across AWS EC2, Google Compute Engine, or Azure Virtual Machines. The overall costs will depend on your specific requirements, such as the size of your dataset, the computational resources needed for training and inference, and the storage and support services you choose.

·      AWS EC2 offers a wide range of instance types and cost-saving options, making it a flexible choice for different stages of the Legal-BERT lifecycle. It’s particularly strong in terms of the variety of tools and services available for managing AI models.  https://aws.amazon.com/ec2/pricing/

·      Google Compute Engine (GCE) is a strong contender for AI workloads, with competitive pricing on GPU instances and seamless integration with Google’s AI and ML tools. It’s particularly well-suited if you are already using Google’s ecosystem for data analytics or other AI applications. https://cloud.google.com/compute/all-pricing

·      Azure Virtual Machines (VMs) provide excellent integration with Microsoft’s enterprise ecosystem and strong support for hybrid cloud deployments. Azure’s pricing is competitive, particularly for long-term projects where you can take advantage of reserved instances or hybrid benefits. https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/

·      Careful planning and optimization can help manage costs effectively while leveraging the full power of Legal-BERT for legal AI applications.

 

 

1. Training and Fine-Tuning Costs

·      Training and fine-tuning Legal-BERT can be resource-intensive, particularly if you are working with large datasets or require high computational power.

AWS EC2

Compute Costs

Instance Type

·      You would typically use GPU-optimized instances like p3.2xlarge or p3.8xlarge for training Legal-BERT.

Hourly Cost

·      A p3.2xlarge instance (1 NVIDIA Tesla V100 GPU) costs around $3.06 per hour, while a p3.8xlarge (4 NVIDIA Tesla V100 GPUs) costs about $12.24 per hour.

Training Time

·      Depending on the size of your dataset, training could take from a few hours to several days. For example, 24 hours of training on a p3.2xlarge instance could cost approximately $73.44.

Storage Costs

 

S3 Storage

·      Storing training datasets and model checkpoints in S3 will incur additional costs. Standard S3 storage costs about $0.023 per GB per month.

Example Cost

·      Storing 1 TB of data in S3 would cost approximately $23 per month.

Data Transfer Costs

 

Inbound Data

·      Generally free.

Outbound Data

·      $0.09 per GB for data transferred out to the internet.

 

 

Google Compute Engine (GCE)

Compute Costs

Instance Type

·      You would typically use GPU instances like n1-standard-8 with an NVIDIA Tesla V100 or P100 GPU.

Hourly Cost

·      A n1-standard-8 instance with a Tesla V100 GPU costs approximately $2.48 per hour.

Training Time

·      Similar to AWS, training could take from a few hours to several days. 24 hours of training on a n1-standard-8 instance would cost approximately $59.52.

Storage Costs

Google Cloud Storage

·      Storing datasets and model checkpoints in Google Cloud Storage costs around $0.026 per GB per month for standard storage.

Example Cost

·      Storing 1 TB of data would cost approximately $26 per month.

Data Transfer Costs

Inbound Data

·      Free within the same region.

Outbound Data

·      $0.12 per GB for data transferred out to the internet.

 

 

Azure Virtual Machines (VMs)

Compute Costs

Instance Type

·      You might use GPU instances like NC6 (1 NVIDIA Tesla K80 GPU) or NC12 (2 NVIDIA Tesla K80 GPUs).

Hourly Cost

·      An NC6 instance costs about $0.90 per hour.

Training Time

·      Depending on the dataset size and model complexity, 24 hours of training on an NC6 instance would cost approximately $21.60.

Storage Costs

Azure Blob Storage

·      Standard storage costs about $0.0184 per GB per month.

Example Cost

·      Storing 1 TB of data would cost approximately $18.40 per month.

Data Transfer Costs

Inbound Data

·      Generally free within the same region.

Outbound Data

·      $0.087 per GB for data transferred out to the internet.

 

 

2. Deployment and Inference Costs

·      After training or fine-tuning Legal-BERT, you will need to deploy the model for inference, which involves serving predictions in real-time or batch processing.

 

AWS EC2

Inference Costs

Instance Type

·      For inference, you might use a smaller GPU instance like g4dn.xlarge or a CPU instance like m5.large.

Hourly Cost

·      A g4dn.xlarge (1 NVIDIA T4 GPU) costs about $0.526 per hour, while an m5.large instance costs about $0.096 per hour.

Example Cost

·      Running inference on a g4dn.xlarge instance for 24 hours would cost approximately $12.62.

Elastic Inference

·      You can attach Elastic Inference to your EC2 instances to reduce inference costs by scaling GPU usage according to demand.

 

 

Google Compute Engine (GCE)

Inference Costs

Instance Type

·      You can use an n1-standard-4 instance with a Tesla T4 GPU for inference.

Hourly Cost

·      An n1-standard-4 instance with a Tesla T4 GPU costs approximately $1.25 per hour.

Example Cost

·      Running inference on this instance for 24 hours would cost approximately $30.

AutoML or AI Platform

·      You might also deploy Legal-BERT using Google’s AI Platform, which abstracts some of the infrastructure management. Costs depend on the resources allocated.

 

 

Azure Virtual Machines (VMs)

Inference Costs

Instance Type

·      You might use an NC4as T4 v3 instance (1 NVIDIA Tesla T4 GPU) or a standard CPU instance like D2s_v3 for inference.

Hourly Cost

·      An NC4as T4 v3 instance costs around $0.92 per hour.

Example Cost

·      Running inference on this instance for 24 hours would cost approximately $22.08.

Azure ML Service

·      Deploying via Azure Machine Learning service can help manage the deployment, scaling, and monitoring of your model. Costs vary based on the resources consumed.

 

 

3. Storage and Data Management Costs

·      Throughout the lifecycle of Legal-BERT, from training to deployment, you will incur storage costs for datasets, model checkpoints, logs, and other artifacts.

AWS S3

Standard Storage

·      $0.023 per GB per month.

Infrequent Access Storage

·      $0.0125 per GB per month, useful for less frequently accessed data.

Example Cost

·      Storing 500 GB of model data in standard S3 storage would cost $11.50 per month.

Google Cloud Storage

Standard Storage

·      $0.026 per GB per month.

Nearline Storage

·      $0.010 per GB per month for data accessed less frequently.

Example Cost

·      Storing 500 GB of model data would cost $13 per month.

Azure Blob Storage

·       

Standard Storage

·      $0.0184 per GB per month.

Cool Storage

·      $0.01 per GB per month for infrequently accessed data.

Example Cost

·      Storing 500 GB of model data in standard storage would cost $9.20 per month.

 

 

4. Support and Management Costs

·      Managing and maintaining Legal-BERT may involve additional costs, especially if you opt for premium support or managed services.

AWS

Support Plans

·      AWS offers various support plans, ranging from Basic (free) to Enterprise, which could cost up to $15,000 per month depending on usage.

Managed Services

·      AWS offers managed services like Amazon SageMaker, which can handle much of the infrastructure, but at a higher cost compared to self-managed EC2 instances.

Google Cloud

Support Plans

·      Google Cloud’s support plans range from Basic (free) to Premium, which costs 3% of your monthly Google Cloud usage with a minimum of $12,500 per month.

Managed AI Services

·      Google Cloud AI Platform provides managed services for model training and deployment, which can simplify operations but may be more expensive than self-hosting.

Azure

Support Plans

·      Azure offers support plans ranging from Developer ($29/month) to Professional Direct ($1,000/month) and Premier, which offers the most comprehensive support.

Managed AI Services

·      Azure’s Machine Learning service offers managed deployment and monitoring, which can reduce operational overhead but add to the overall cost.

 

 

5. Cost Optimization Strategies

·      To manage and optimize costs when using Legal-BERT, consider the following strategies

 

 

Use Spot or Preemptible Instances

·      Both AWS and Google Cloud offer these discounted instances, which are ideal for non-time-sensitive workloads like model training.

Scale Inference on Demand

·      Use auto-scaling to adjust the number of instances based on demand, reducing costs during low-usage periods.

Optimize Storage Costs

·      Move less frequently accessed data to cheaper storage tiers, such as Infrequent Access (AWS), Nearline (Google Cloud), or Cool Storage (Azure).

Reserved Instances or Savings Plans

·      Commit to a specific level of usage over time to benefit from significant cost savings, especially for long-term projects.

 

 

 

 

Construction Contract Management Artificial Intelligence (AI) Services

AI Knowledge Management Systems Limited

@Euro Training Limited

www.eurotraining.com

CCM@EuroTraining.com

Whatsapp  +15512411304

 

 

LEGAL-BERT: The Muppets straight out of Law School

Ilias ChalkidisManos FergadiotisProdromos MalakasiotisNikolaos AletrasIon Androutsopoulos

BERT has achieved impressive performance in several NLP tasks. However, there has been limited investigation on its adaptation guidelines in specialised domains. Here we focus on the legal domain, where we explore several approaches for applying BERT models to downstream legal tasks, evaluating on multiple datasets. Our findings indicate that the previous guidelines for pre-training and fine-tuning, often blindly followed, do not always generalize well in the legal domain. Thus we propose a systematic investigation of the available strategies when applying BERT in specialised domains. These are: (a) use the original BERT out of the box, (b) adapt BERT by additional pre-training on domain-specific corpora, and (c) pre-train BERT from scratch on domain-specific corpora. We also propose a broader hyper-parameter search space when fine-tuning for downstream tasks and we release LEGAL-BERT, a family of BERT models intended to assist legal NLP research, computational law, and legal technology applications.

Comments:

5 pages, short paper in Findings of EMNLP 2020

Subjects:

Computation and Language (cs.CL)

Cite as:

arXiv:2010.02559 [cs.CL]

 

(or arXiv:2010.02559v1 [cs.CL] for this version)

 

https://doi.org/10.48550/arXiv.2010.02559

Focus to learn more

Submission history

From: Ilias Chalkidis [view email]
[v1] Tue, 6 Oct 2020 09:06:07 UTC (249 KB)