Unleashing the Power of LLM with Snowflake CORTEX

Nabarun Chakraborti
8 min readMar 26, 2024

Snowflake Cortex, now available in private preview, stands as Snowflake’s latest innovation, delivering intelligent data analysis and AI application creation directly within the Snowflake platform. With Snowflake Cortex, users of any proficiency level can leverage industry-leading AI models, LLMs, and vector search functionalities, alongside complete LLM-powered experiences. These advancements democratize the utilization of generative AI, empowering all Snowflake users to unlock dynamic insights from their enterprise data securely.

Available Serverless Functions in CORTEX

  1. COMPLETE()

For a given prompt, the function returns a text completion response using cutting-edge, open-source LLMs like — llama2–70b-chat, mixtral-8x7b, gemma-7b, mistral-7b etc.

Syntax: SNOWFLAKE.CORTEX.COMPLETE(<model>, <prompt_or_history> [ , <options> ] )

Below example, I’ve used llama2–70b-chat model, and wanted to know 5 best selling nonfiction books.

SELECT SNOWFLAKE.CORTEX.COMPLETE(
'llama2-70b-chat',
[
{
'role': 'user',
'content': 'Suggest 5 best selling nonfiction books with author name no additional details are required'
}
],
{'temperature': 0.8,'max_tokens': 1000 }
);

Output:

2. SUMMARIZE()

This function will summarize the long input text.

Syntax: SNOWFLAKE.CORTEX.SUMMARIZE(text)

Below example I’ve copied Nokia Press Release article and generate the summary.

select SNOWFLAKE.CORTEX.SUMMARIZE($$
Nokia enhances optical network automation capabilities to help network operators reduce CAPEX and OPEX, increase revenues

New enhancements to better streamline operations, speed up introduction of new capacity and reduce risks due to network failures.
Optical network automation critical for network operators to meet rapidly shifting customer expectations for bandwidth, latency, reliability and more.
21 March 2024
Espoo, Finland - Nokia today announced enhancements to its WaveSuite optical network automation platform aimed at meeting urgent customer needs for increased bandwidth, reliability and imperceptible latency. Nokia’s enhanced WaveSuite platform provides exceptional insight into and control of customer networks with a growing roster of applications targeting specific use cases to help them optimize their network and operations, scale network capacity and monetize network assets.

In the face of increased network complexity and constrained resources, network operators are increasingly reliant on automation to make more efficient use of networking expertise and reduce human error associated with tedious manual processes, improve service turn-up times, shrink operational cost reductions and drive revenue growth.

Today’s enhancements to WaveSuite streamline network operations to cut labor time and the inherent human errors, accelerate the introduction of new capacity to reduce time-to-revenue, and to help eliminate risks associated with network failures that impact end-customer service level agreements (SLAs).

Key among the new WaveSuite enhancements is support within the Service Enablement application for network operators to better integrate BSS (business support systems) billing with optical network functions. Network operators will be able to fulfill optical service requests to wholesale partners and their end subscribers, and provide them with individualized, real-time KPI assurance metrics. It enables them to offer differentiated services, such as latency-aware layer one services and spectrum-as-a-service, creating new revenue opportunities in a formerly untapped market.

Nokia’s enhanced WaveSuite portfolio also incorporates machine learning into the Health and Analytics application to use network intelligence to support optical fiber sensing, which will help network operators detect disturbances to the fiber optic cable within their networks that may produce outages. Unlike other approaches that require additional hardware, the innovative WaveSuite solution takes advantage of polarization data provided by the coherent digital signal processor at the heart of Nokia Photonic Service Engines, such as PSE-6s. It allows network operators to proactively identify, prepare for and respond to events in the network that may affect network performance before they occur, decreasing down time and promoting better adherence to service level agreements with customers.

Finally, WaveSuite’s new features combine network planning with network provisioning, significantly reducing the effort required to scale network capacity by 33%. This enables automated flow-through provisioning by synchronizing between existing physical networks and planned network designs, eliminates errors in the transition between planning and provisioning, and significantly reduces the time and human resources network operators need to dedicate to scaling their optical networks. This enhancement was analyzed in a Jan 2024 Analysys Mason report where the research firm quantified the benefits of optical network automation.

Justin van der Lande, Research Director, Analysys Mason, said: “Our recent research collaboration with Nokia revealed operators could achieve up to 81% cost savings after deploying optical network automation for their network and service lifecycle management. Nokia’s new capabilities have the potential to go even further to improving the OPEX and revenue-enhancing gains we uncovered during our research.”

Ravi Parmasad, Optical Network Automation Leader at Nokia, said: "We continue to work with leading service providers to help them transform their optical networks with automation. Nokia's WaveSuite platform enables our customers to leverage data-driven insights and intelligent actions to optimize their network performance, reduce operational costs and accelerate service delivery. With WaveSuite, we are bringing the benefits of automation to the optical domain and empowering our customers to build more agile and resilient networks for the future.
$$
) AS Press_Release_Summary;

Output:

Nokia announces enhancements to its WaveSuite optical network automation platform, including integration of business support systems
with optical network functions, machine learning for fiber optic cable disturbance detection, and combined network planning and provisioning to reduce scaling network capacity effort by 33%. These enhancements aim to streamline operations, accelerate new capacity introduction,
and reduce risks associated with network failures, helping network operators meet increasing customer expectations for bandwidth,
reliability, and low latency. The new features have the potential to achieve significant cost savings and revenue growth for operators.

3. EXTRACT_ANSWER()

We can use this function to ask any question to our table content or documents.

Syntax: SNOWFLAKE.CORTEX.EXTRACT_ANSWER(source_document, question)

Below example I’ve used the same Nokia Press Release article and ask “How does Nokia enhance WaveSuite portfolio?”

SELECT
SNOWFLAKE.CORTEX.EXTRACT_ANSWER(
$$
Nokia enhances optical network automation capabilities to help network operators reduce CAPEX and OPEX, increase revenues

New enhancements to better streamline operations, speed up introduction of new capacity and reduce risks due to network failures.
Optical network automation critical for network operators to meet rapidly shifting customer expectations for bandwidth, latency, reliability and more.
21 March 2024
Espoo, Finland - Nokia today announced enhancements to its WaveSuite optical network automation platform aimed at meeting urgent customer needs for increased bandwidth, reliability and imperceptible latency. Nokia’s enhanced WaveSuite platform provides exceptional insight into and control of customer networks with a growing roster of applications targeting specific use cases to help them optimize their network and operations, scale network capacity and monetize network assets.

In the face of increased network complexity and constrained resources, network operators are increasingly reliant on automation to make more efficient use of networking expertise and reduce human error associated with tedious manual processes, improve service turn-up times, shrink operational cost reductions and drive revenue growth.

Today’s enhancements to WaveSuite streamline network operations to cut labor time and the inherent human errors, accelerate the introduction of new capacity to reduce time-to-revenue, and to help eliminate risks associated with network failures that impact end-customer service level agreements (SLAs).

Key among the new WaveSuite enhancements is support within the Service Enablement application for network operators to better integrate BSS (business support systems) billing with optical network functions. Network operators will be able to fulfill optical service requests to wholesale partners and their end subscribers, and provide them with individualized, real-time KPI assurance metrics. It enables them to offer differentiated services, such as latency-aware layer one services and spectrum-as-a-service, creating new revenue opportunities in a formerly untapped market.

Nokia’s enhanced WaveSuite portfolio also incorporates machine learning into the Health and Analytics application to use network intelligence to support optical fiber sensing, which will help network operators detect disturbances to the fiber optic cable within their networks that may produce outages. Unlike other approaches that require additional hardware, the innovative WaveSuite solution takes advantage of polarization data provided by the coherent digital signal processor at the heart of Nokia Photonic Service Engines, such as PSE-6s. It allows network operators to proactively identify, prepare for and respond to events in the network that may affect network performance before they occur, decreasing down time and promoting better adherence to service level agreements with customers.

Finally, WaveSuite’s new features combine network planning with network provisioning, significantly reducing the effort required to scale network capacity by 33%. This enables automated flow-through provisioning by synchronizing between existing physical networks and planned network designs, eliminates errors in the transition between planning and provisioning, and significantly reduces the time and human resources network operators need to dedicate to scaling their optical networks. This enhancement was analyzed in a Jan 2024 Analysys Mason report where the research firm quantified the benefits of optical network automation.

Justin van der Lande, Research Director, Analysys Mason, said: “Our recent research collaboration with Nokia revealed operators could achieve up to 81% cost savings after deploying optical network automation for their network and service lifecycle management. Nokia’s new capabilities have the potential to go even further to improving the OPEX and revenue-enhancing gains we uncovered during our research.”

Ravi Parmasad, Optical Network Automation Leader at Nokia, said: "We continue to work with leading service providers to help them transform their optical networks with automation. Nokia's WaveSuite platform enables our customers to leverage data-driven insights and intelligent actions to optimize their network performance, reduce operational costs and accelerate service delivery. With WaveSuite, we are bringing the benefits of automation to the optical domain and empowering our customers to build more agile and resilient networks for the future.
$$,

'How does Nokia enhance WaveSuite portfolio?'
);

Output:

incorporates machine learning into the health and analytics application to use network intelligence to support optical fiber sensing

4. SENTIMENT()

It helps to detect sentiment of text across tables or documents. Represented by A floating-point number from -1 to 1. This range indicates the degree of negative or positive sentiment in the text.

Syntax: SNOWFLAKE.CORTEX.SENTIMENT(text)

5. TRANSLATE()

It helps to translate input text from one language to other.

Syntax: SNOWFLAKE.CORTEX.TRANSLATE(text, source_language, target_language)

English — en, French — fr, German — de, Italian — it, spanish — es
swedish — sv, japanese — ja

CORTEX LLM Functions Availablity:

COST:

The compute cost is calculated based on the number of tokens processed.

In Snowflake Cortex, a token represents the smallest text unit processed by LLM functions, roughly equivalent to four characters.

Depends on the Function type the cost may include both Input and Output tokens.

COMPLETE, SUMMARIZE, and TRANSLATE : Generate new texts hence both input and output tokens are included in the token count.

EXTRACT_ANSWER and SENTIMENT: Only extract information, hence only input tokens are counted.

EXTRACT_ANSWER: Number of from_text tokens + number of question fields token.

In conclusion, Snowflake CORTEX’s genAI capability represents a pioneering leap in data analytics, offering unprecedented access to advanced AI models within the Snowflake ecosystem. With genAI, organizations can unlock transformative insights, driving innovation and informed decision-making in today’s data-driven landscape.

Happy Learning !!!

Sign up to discover human stories that deepen your understanding of the world.

Nabarun Chakraborti
Nabarun Chakraborti

Written by Nabarun Chakraborti

Big Data Solution Architect and pySpark Developer

No responses yet

Write a response