The development cycle for an NLP model is critical. To be able to deliver results fast, the cycle has to be fast. It has to be cost efficient, too. Learn how Amenity uses AWS Fargate and Spot to compress this creativity cycle—reducing the time from idea to production in a cost-effective way.

By
Efi Gazarov
|
November 8, 2021

Achieving Fast NLP Model Development with AWS Fargate

Technology
Achieving Fast NLP Model Development with AWS Fargate

Unlock the Full Potential of Data Sources with Amenity NLP

Amenity is the industry leader in natural language processing (NLP), artificial intelligence (AI), and machine learning (ML) techniques for information extraction. The system is a sector-agnostic, language dependent solution for text analysis, with a focus on the financial industry.

Amenity’s overall architecture is an integrated sentiment analysis engine that performs a relevance analysis to determine sentiment and event scores of desired entities. The engine processes and translates unstructured data into structured sets. An important aspect of this translation starts with the full parsing it performs on all documents. Each word is analyzed and assigned information relating to its base canonical form.

Amenity employs many novel techniques and breakthrough technologies to push the envelope of NLP, ML, and AI in the field of text analysis and information extraction. This proprietary process enables users to not only parse with high accuracy, but also add context and metadata to each extraction, increasing the recall and precision of the model to unparalleled levels. The engine provides relevant insights and filters out noise, systematically doing the job of a domain expert with unmatched accuracy.

NLP Development Cycle: Idea to Production

Amenity’s developers will create an NLP model and upload it to the system. The model will then analyze millions of documents and examine the findings. This process repeats until the results fulfill the business requirements with high precision and recall.

Figure 1: NLP model development cycle

The development cycle for an NLP model is critical. To be able to deliver results fast, the cycle has to be fast. It has to be cost efficient, too.

Amenity uses AWS Fargate and Spot to compress this creativity cycle—reducing the time from idea to production in a cost-effective way.

Scaling from Hundreds to Hundreds of Millions of Documents

Analyzing a hundred documents is easy; analyzing hundreds of millions of documents is hard. The task requires a really big cluster of computing power. For example, we require 2000 vCPUs to analyze 200 million articles quickly.

The “on-demand” and “pay-as-you-go” properties and qualities of AWS (Amazon Web Services) help with cost efficiency. Yet, maintaining such a cluster is a complex task, even in the cloud. This is where AWS Fargate becomes such a game changer for Amenity. AWS Fargate removes the need to maintain the infrastructure and allows us to concentrate on our business requirements.

With very few changes, we have the ability to run our containerized NLP engine at scale.

There is no need to manage EC2 instances as with Amazon ECS on EC2. There is also no need to bid for Spot instances or use some third-party solution to do the bidding on your behalf. We just tell Fargate how much power (container instances) we want, and we have it at our disposal. AWS assumes responsibility for provisioning and managing the resources we need to meet our demand.

AWS Fargate: A Central Part of Amenity’s System

System Description

At the core of Amenity’s solution, we have the NLP engine, which is versioned, packed, and published to Amazon Elastic Container Registry (Amazon ECR) as a container image by the dev team.

We have hundreds of NLP models for each business requirement, which are bundled and uploaded to an S3 bucket by the NLP model creators.

Every aspect of our system is automated and accessible through a dedicated web interface.

AWS CloudFormation Stack for Each NLP Model

For every NLP model uploaded by the creators, Amenity automatically deploys a CloudFormation stack. The stack contains everything needed for an analysis job, including the Amazon ECS and AWS Fargate configurations. We “translate” an NLP model into everything needed for that model to process huge amounts of documents with AWS Fargate.

Autoscaling Rules

Autoscaling rules make sure that our service (NLP model) is scaled up or down depending on the amount of documents waiting to be processed.

We use the “step-scaling” type of rule in conjunction with a custom metric that tracks the amount of visible messages in a particular SQS queue.

It is essential for the sake of cost efficiency to fine-tune the scaling rules in order to find the right balance between the provisioned capacity and the current demand. Otherwise, we would be paying for idle resources.

Capacity Provider Strategy 

We use capacity providers to save money. We choose the FARGATE_SPOT provider as our primary capacity provider and use the FARGATE provider to initiate only one task. This is to ensure that at least one task will be started even if there are no FARGATE_SPOT resources currently available.

The Benefits of Running Containers at Scale

Two Major Reasons AWS Fargate Was Selected for Running Containers at Scale

The first reason for selecting AWS Fargate is the serverless and maintenance-free nature of the service. It allows us to abstract away the infrastructure and allows our developers to concentrate their efforts on delivering business requirements and value to our customers faster. With AWS Fargate the burden of maintenance is shifted to AWS. We only provide the configurations.

The second benefit is the cost reduction of FARGATE_SPOT. It requires minimal configuration changes to run our workloads on FARGATE_SPOT tasks, and we benefit from the reduced price. This is why AWS Fargate stands out when it comes to running containers at scale.

The resulting solution allows Amenity to continue solving a variety of high volume and precision-intensive use cases for the world’s largest banks, hedge funds, asset managers and insurance companies. Here are some examples of what’s possible with this type of architecture:

  • Uncover ESG disclosure at scale
  • Regulatory data extraction to analyze securities at risk
  • Highlight important issues from news feeds in real-time to screen for opportunities and risk
  • Quantitative modeling that transforms SEC filings and earnings call transcripts into datasets for general sentiment and key fundamental drivers
  • Transform all information available in earnings calls, SEC filings, and news reports into quantified metrics for credit risk
Check out Amenity’s ESG Spotlight and NLP analysis on other financial trends.

This communication does not represent investment advice. Transcript text provided by S&P Global Market Intelligence.

Copyright ©2021 Amenity Analytics.