Skip to content Skip to footer

Imperva enhances the production of SQL from natural language through the use of Amazon Bedrock.

Imperva, a cybersecurity firm, in a collaboration with Ori Nakar, have found a solution to improve user experience by translating natural language inputs into SQL queries, thanks to a large language model (LLM) and Amazon’s artificial intelligence service, Amazon Bedrock. This model and service are designed to help users sift through data more intuitively and conveniently.

Imperva uses its Cloud WAF to protect thousands of websites from cyber threats, blocking billions of security events every day. The firm compiles this data, offering insights and counters to users from various departments. To navigate this vast expanse of data, Imperva uses an application that accesses data from a data lake, retrieving it via SQL using Amazon Athena.

However, they faced a problem in making this data more accessible to users, as querying data through applications wasn’t as efficient as using SQL on a known schema. The company eventually introduced a more flexible system, replacing multiple search fields with a single free text field. This is intended to provide an experience similar to using SQL, generating complex yet understandable natural language queries.

An LLM using the language used by Imperva’s internal users was developed — alongside query examples — to facilitate this. LLMs can construct SQL queries based on natural language inputs, but their responses aren’t always deterministic, and ensuring their accuracy can be a challenge.

To solve this problem, Imperva adopted a data science approach, developing a model and fine-tuning it through experimentation. This involved using a static set of records and running predictions on the test set records to track the accuracy of the model’s responses. They developed their application by adding new questions and updating different datasets.

Using Amazon Bedrock, they were able to experiment with multiple models to improve accuracy and find the best fit. They also used smaller models for better performance and cost-effectiveness. This allowed them to test multiple models quickly, and finally integrate and deploy generative AI capabilities into their application.

This approach can also be applied to other applications, not just for SQL queries, such as API access or building JSON data. Amazon Bedrock was particularly beneficial because of its serverless nature, eliminating the need for infrastructure management.

Finally, Imperva offered a GitHub workshop for others interested in experimenting with natural-language-to-SQL, which builds on this technique to solve the problem.

The conclusion reveals that using a data science approach together with Amazon Bedrock, experimenting with multiple models, and integrating generative AI into applications could greatly benefit businesses and developers trying to improve user experiences and data accessibility.

Leave a comment

0.0/5