[2024] Exploring LLM Capabilities Using Snowflake Cortex

Large Language Models in Snowflake Cortex are hosted and fully managed by Snowflake and you don’t have to do any prior setup. Now you have model hosted nearer to where your data resides, it gives you the performance, scalability, and governance you look for your Enterprise.

Snowflake Cortex gives you instant access to industry-leading large language models (LLMs) trained by researchers at companies like Mistral, Meta, and Google.

Executive Summary:

  1. Available Capabilities
  2. Understanding Cost
  3. Restrictions

Available Capabilities

Snowflake Cortex features are provided as SQL functions and are also available in Python. The available functions are summarized below.

CORTEX.COMPLETE():

Given a prompt, the instruction-following COMPLETE function generates a response using your choice of language model. In the simplest use case, the prompt is a single string. You may also provide a conversation including multiple prompts and responses for interactive chat-style usage, and in this form of the function you can also specify hyperparameter options to customize the style and size of the output.

For Full Guide, check out below article:

CORTEX.EXTRACT_ANSWER():

The function extracts an answer to a given question from a text document. The document may be a plain-English document or a string representation of a semi-structured (JSON) data object.

For Full Guide, check out below article:

CORTEX.SENTIMENT():

This function returns a sentiment score for the given English-language input text.

For Full Guide, check out below article:

CORTEX.SUMMARIZE():

This function returns a summary of the given English text.

For Full Guide, check out below article:

CORTEX.TRANSLATE():

This function translates the given input text from one supported language to another.

For Full Guide, check out below article:

Understanding Cost

Snowflake Cortex LLM functions incur compute cost based on the number of tokens processed. The table below shows the cost in credits per 1 million tokens for each function.

A token is the smallest unit of text processed by Snowflake Cortex LLM functions, approximately equal to four characters of text.

  • For functions that generate new text in the response (COMPLETE, SUMMARIZE, and TRANSLATE), both input and output tokens are counted.
  • For functions that only extract information from the input (EXTRACT_ANSWER and SENTIMENT), only input tokens are counted.
  • For EXTRACT_ANSWER, the number of billable tokens is the sum of the number of tokens in the from_text and question fields.

Restrictions

Models used by Snowflake Cortex have limitations on size as described in the table below. Sizes are given in tokens. Tokens generally correspond to words, but not all tokens are words, so the number of words corresponding to a limit is slightly less than the number of tokens. Inputs that exceed the limit result in an error.

About Me:

Hi there! I am Divyansh Saxena

I am an experienced Cloud Data Engineer with a proven track record of success in Snowflake Data Cloud technology. Highly skilled in designing, implementing, and maintaining data pipelines, ETL workflows, and data warehousing solutions. Possessing advanced knowledge of Snowflake’s features and functionality, I am a Snowflake Data Superhero & Snowflake Snowpro Core SME. With a major career in Snowflake Data Cloud, I have a deep understanding of cloud-native data architecture and can leverage it to deliver high-performing, scalable, and secure data solutions.

Follow me on Medium for regular updates on Snowflake Best Practices and other trending topics:

Also, I am open to connecting all data enthusiasts across the globe on LinkedIn:

https://www.linkedin.com/in/divyanshsaxena/

--

--