Beinex Opens its Corporate Office in the Kingdom of Saudi Arabia
In the last few years, the KSA market has witnessed a definitive shift to self-service consumption tools anchored in data democratization. The transition is of paramount importance for products that can scale at an enterprise level, AI-ML products, and those that can address data governance and quality management issues.
The shift is also significant for enterprise transformation catalysts that take an ecosystem approach with proven expertise in developing and executing comprehensive and unified data strategies, data engineering and data governance paradigms.
Thus the time is ripe for an innovation-led, experience-driven enterprise like Beinex to spearhead Digital and Analytics Transformations in KSA.
[sc name="quote" quote="“Beinex is pleased to formalize its presence in the KSA market by opening an Office in Riyadh. We, as an enterprise, are 100% aligned with Vision 2030 as put forth by the KSA and see tremendous value getting unlocked as the vision is realized. We look forward to expanding our footprint in the domains of Artificial Intelligence, Sustainability, Digital Transformation, Analytics and allied areas. The Kingdom envisions itself to be at the forefront of data and artificial intelligence-based economies, and Beinex is committed to playing its part in supporting and fulfilling this vision,”" author="Indumon Das, Founder and Managing Director of Beinex,marking the occasion of the office’s opening, noted."][/sc]
Middle East Banking AI & Analytics Summit
Beinex is super excited to be a part of the 6th Middle East Banking AI & Analytics Summit on May 10, 2023. With the motto, "Accelerating Innovation in Banking with AI and Analytics Strategies", the summit aims to revolutionise the financial and banking space in KSA using AI. We are ready to witness and participate in panel discussions, fireside chats, keynote presentations, roundtable discussions, and conversational Q&A sessions with thought leaders on exploiting the Power of AI and Analytics for a futuristic banking ecosystem.
Middle East Enterprise AI & Analytics Summit
Also, we are enthusiastic to participate in the Middle East Enterprise Al and Analytics Summit on May 11, 2023. Its vision is to curate a world-class platform for tech leaders in the region to connect, communicate and collaborate under the theme "Accelerating Innovation in Enterprises with Applied Al and Analytics Strategies". Beinex is looking forward to connecting with thought leaders and high-level decision-makers in Al, and Data Analytics at #MEEAI 2023 to participate in discussions and to be a part of the transformation journey.The Power of Beinex
Beinex drives a cohesive, unified digital ecosystem to help customers address their needs, assess products and operations, understand market requirements and evaluate overall business performance.
It is a multinational firm exploring the endless possibilities of data for Cloud, Analytics, Artificial Intelligence, Machine Learning, and Automation. In effect, Beinex architects, guides, leads, and implements solutions in Analytics, AI, and ML for the spheres of Digital Transformation, GRC, and Risk & Audit Transformation.
Partnerships make Beinex stronger. The company has solid partnerships with some of the leading technology firms, research labs, and universities around the globe. Businesses can leverage the power of the Beinex partner ecosystem to maximize the value of their end-to-end analytics journey.
Beinex Digital, a part of Beinex Holdings, is a digital transformation entity with a comprehensive suite of independent products focused on addressing specific business gaps, use cases, and needs. It incorporates a spectrum of solutions in the domains of Employee Health, Safety and Environment, Enterprise Product Management and Enterprise Performance Management.
Beinex is also the product champion for Aurex – Augmented Risk and Audit Analytics – a unique single-platform solution for Integrated Risk Management, Governance, Audit, Compliance, BCM, and Analytics functions. It is the first-of-its-kind product that streamlines risk and audit verticals for enterprises worldwide and is a Unified Digital Assurance Ecosystem.
Present in three continents, Beinex enables its clients to analyze data, mitigate risks, identify opportunities and automate processes.
Beinex Office Address (KSA):
Beinex Advanced Information Technology3141, Anas Bin Malik,
8292 Al Malqa Dist
P. O. Box 13521,
Riyadh, Kingdom of Saudi Arabia
Email: Info@beinex.com
Related Articles
Enterprises today don’t suffer from a lack of data; instead, they’re overwhelmed by it. The real challenge before organizations is turning that data into well-timed decisions. This is where AI decision-making comes in. Enterprises are increasingly relying on AI-driven decision intelligence to guide strategy, enhance operations, and achieve better business outcomes. Let’s see how it drastically changes how modern businesses operate.
According to McKinsey & Company, 88% of organizations now use AI in at least one business function, up from 78% a year ago. This shift shows that AI is moving from experimentation to a central role in decision-making. Gartner predicts that by 2028, at least 15% of daily business decisions will be made autonomously, and 33% of enterprise applications will include agentic AI.

What could be the Cloud computing trends to look forward to in 2023? Let’s have a look
- Utilising Edge Computing
- AI and ML Services
- Disaster Recovery
- Multi and Hybrid Cloud Solution
- Cloud Security and Resilience
- Cloud Gaming
- Kubernetes and Docker
- Serverless Computing
- Blockchain
- Metaverse
- IoT
Let’s deep-dive:
1. Utilising Edge Computing
In the world of cloud computing, edge computing is one of the most popular trends. Here, data is evaluated geographically nearer to its source and stored and processed at the network's edge. As modern internet technologies emerged, the internet speed has helped in reducing latency, technologies such as 5G is used more frequently, and processing can be done swiftly. Greater privacy, quicker data transmission, security, and improved efficiency are just a few of the primary advantages of edge computing. Edge computing is expected to be at the core of every cloud strategy in 2023, making it the most important development in this area.
2. AI and ML Services
Two technologies that are closely related to cloud computing are artificial intelligence and machine learning. Due to the volume of data processed for the machine to learn patterns, this area demands faster processing and abundant storage requirements for training algorithms and data collection respectively. Due to the availability of virtually infinite computational capability, on-cloud AI and ML services are more cost-effective on the cloud. Cloud computing is used for handling enormous amounts of data to raise productivity at tech firms. Increased self-learning and automation capabilities, improved data security, and more individualised cloud experiences are the main trends that are most likely to arise in this fiel
3. Disaster Recovery
The ability to have a DR site in a geographically remote area helps to quickly restore vital services in the event of a natural or man-made disaster. It describes the process of employing cloud-based resources to recover from a disaster in the event such as power outages, data loss, or device failure/problems.
4. Multi and Hybrid Cloud Solution
Many businesses have embraced a multi-cloud and hybrid IT approach that mixes legacy platforms, on-premises, dedicated private clouds, and several public clouds. They provide a mix of public and private clouds tailored to the requirements of particular firms where several business drivers matter for instance like those of insurance, banks, etc. Multi-cloud and hybrid cloud solutions will thus be among the most popular cloud computing trends in 2023 and the years to come.
5. Cloud Security and Resilience
When companies shift to the cloud, there are still several security vulnerabilities. Investment in cyber security and building resilience against everything from data theft to the consequences of a pandemic to global trade will become more crucial and major variables in the coming years. The use of managed "security-as-a-service" providers, AI, and predictive technologies will increase in 2023 as a result of this trend to identify risks before they result in problems. Studies say that leading vendors of cloud computing invest over a billion dollars every year to protect their customers’ data.
6. Cloud Gaming
Cloud gaming platforms operate similarly to remote desktops and video-on-demand services; games are stored and executed remotely on a provider's dedicated hardware and streamed as video to a player's device via client software. It can be advantageous as it eliminates the need to purchase expensive computer hardware or install games directly onto a local game system. Cloud gaming can be made available on a wide range of computing devices, including mobile devices such as smartphones and tablets, digital media players, or proprietary thin client-like devices. Microsoft, Sony, Nvidia, and Amazon all offer video game services. But video game streaming requires more data and is only doable with fast internet. With the launch of 5G in 2023, the cloud gaming sector will grow significantly.
7. Kubernetes and Docker
The main trend is the growing use of container orchestration tools like Kubernetes and Docker. Large-scale deployments that are extremely scalable and effective are made possible by this technology. These are expandable, open-source platforms that manage services and workloads from a central location while running applications from a single source. Both platforms offer high scalability and efficiency. Over the following several years, Kubernetes and Docker will continue to play a significant role in cloud computing trends as they are developing quickly.
8. Serverless Computing
Because of the advent of the sharing economy, serverless computing entered the computing sector. Instead of being deployed on physical servers in this case, compute resources are offered as a service. This indicates that instead of needing to maintain its servers, the company only pays for the resources it uses. Additionally, serverless cloud solutions are growing in popularity because of how simple they are to use and how rapidly one can design, deploy, and expand a cloud solution. Overall, this technology is a trend that is just starting and is becoming more and more popular.
9. Blockchain
Blockchain, which users continue to follow more and more, is a connected list of blocks containing records. Blocks of data are stored using cryptography. It has outstanding decentralisation, security, and transparency. In conjunction with the cloud, it is currently utilised more frequently. It can securely and affordably process enormous volumes of data and regulate documents. For many industrial applications, the new technology is beginning to hold out a great deal of promise.
10. Metaverse
The days are not long for the Metaverse and cloud computing to become inextricably linked to each other. The metaverse will compel businesses to migrate to cloud infrastructures to host their virtual worlds. Massive amounts of workloads will be migrated, paving the path for even more innovations to model their virtual worlds. Considering the difficulties of building a metaverse without highly available and scalable premises and hosting grounds, the adoption of cloud computing will be inevitable. As more layers of complexity will be added to the metaverse as it matures, the need for a strong foundation to support the whole thing and to deliver a flawless user experience with no backend issues will arise. Consequently, cloud providers engaged in the metaverse will create metaverse-compatible solutions to assist businesses in quickly establishing their virtual space.
11. IoT
In the realm of cloud computing, IoT is a well-known trend. Connectivity between computers, servers, and networks is maintained by this technology. It performs the role of a middleman, guarantees effective communication, and helps gather data from distant devices. Due to the enormous data produced by IoT devices, it requires many terabytes of storage. Since the cloud, the storage of data has become cheaper. In recent years storing and processing machine-generated data has become relatively easier. In the coming years, businesses would be able to efficiently analyse data from IoT devices and make informed decisions.
Summing Up
Even though cloud computing has been present for more than a decade, its popularity has skyrocketed in recent years. Given this growth trajectory, cloud computing is on track to become the most discussed technology in 2023. Recent studies show that by 2028, the cloud computing market is anticipated to be worth more than $1 trillion. Being the game changer, its impact will grow along with the adoption in the coming years too.
Beinex Offerings
Beinex is all about transforming the way organizations work with data to bring out the best in Business, Technology and People. Our association with Snowflake, a leading cloud-first data warehouse service, is a partnership that we leverage to support the data analytics solutions that we offer our clients.

How can You Use Alteryx and Tableau for Advanced Analytics
1. Data Preparation with Alteryx
Alteryx provides powerful data preparation capabilities, including data cleaning, data integration, and data transformation. You can make use of it for:
- Importing data from various sources such as databases, spreadsheets, or APIs.
- Creating data preparation workflows, connecting different tools to cleanse, filter, aggregate, and manipulate your data. Use Alteryx's visual workflow interface.
- Deriving additional insights from your data to leverage Alteryx's advanced analytics tools like predictive modelling, time series analysis, or clustering.
2. Advanced Analytics with Alteryx
Alteryx offers a list of advanced analytics tools, such as predictive analytics, spatial analytics, and text analytics, that can be utilised for:
- Building machine learning models and performing regression analysis or classification tasks.
- Analysing geographic patterns, performing spatial clustering, or conducting network analysis.
- Performing sentiment analysis or topic modelling and extracting insights from unstructured text data by using Alteryx's text mining tools
3. Data Visualization and Reporting with Tableau
Once your data is prepared and enriched in Alteryx, you can connect Tableau to the output data and create interactive visualisations, and perform the following:
- Use Tableau's drag-and-drop interface to create charts, graphs, dashboards, and reports to visualise your data.
- Leverage Tableau's advanced visualisation features like calculated fields, table calculations, or trend lines to enhance your analysis.
- Combine multiple data sources, including the output from Alteryx, to create comprehensive dashboards that provide a holistic view of your data and insights.
4. Integrating Alteryx and Tableau
When it comes to pushing data from Alteryx to Tableau, there are indeed a couple of approaches you can consider ensuring a smooth integration between the Alteryx and Tableau platforms. Alteryx allows you to export the prepared and enriched data as a Tableau Data Extract (.tde) or Tableau Hyper Extract (. hyper) file. You can make use of it for the following functions:
Publishing Data Source Directly to Tableau Server:
Writing Data in Tableau’s hyper Format:
To integrate Alteryx with Tableau, you can:
Beinex partnership with Tableau & Alteryx
As the premium partner of Alteryx and Tableau, Beinex offers a unique advantage in leveraging the combined power of these two tools for your business. Our experts can help you unlock the full potential of your data through sophisticated data preparation, advanced analytics, and compelling visualisations that provide deeper insights into your business operations.
With our expertise, you can effectively make data-driven decisions and communicate complex analytics. Whether you need help with implementation, training, or ongoing support, Beinex is your go-to partner for all your data analysis needs. Get in touch with us today and see how we can help you transform your business with the combined power of Alteryx and Tableau.

Digital Twin Services in the UAE
The UAE digital twin market generated USD 558.3 million in revenue in 2024 and is projected to grow to USD 3.48 billion by 2030, at a CAGR of 34%. Within the broader GCC region, the digital twin market achieved USD 1.52 billion in 2024, with the UAE positioned as the lead market.
Digital twin services have widely brought transformative changes in both government and private structures. Imagine testing modifications to a production line, monitoring energy usage across an entire facility, or simulating traffic patterns in a smart environment, all without impacting real-world operations. That’s the transformative power of digital twins, and Beinex is helping organizations harness it to drive smarter, data-backed decisions.
In the UAE, where innovation meets ambition, the digital twin services are rapidly gaining traction across key sectors:
- • Healthcare providers are using digital twins for patient-specific simulations, improving diagnostics and treatment planning.
- • Manufacturing & industrial operations, including oil & gas, petrochemicals, are employing digital twins for asset performance monitoring, failure prediction, and process optimization.
- • Automotive and transport industries are the largest and fastest-growing adopters of digital twin solutions, leveraging them for innovation, sustainability, and operational excellence.
Whether it's a high-tech manufacturing facility in Abu Dhabi or a cutting-edge urban development in Dubai, Beinex Digital Twin Solutions is empowering organizations to make smarter, faster, and more informed decisions, with fewer surprises along the way.
What is a Digital Twin?
A digital twin is a virtual replica of a physical asset, system, or process powered by real-time data and enhanced with artificial intelligence. It mirrors real-world behavior, performance, and status, enabling businesses to monitor, simulate, and optimize their operations. Whether it’s a jet engine, a wind turbine, or an entire smart city infrastructure, digital twins provide an insightful, data-driven window into how physical objects function in the real world.
Studies by Deloitte indicate that the global digital twin market size is projected to increase from nearly US$13 billion in 2023 to US$259 billion by 2032. Undoubtedly, in the coming years, we can anticipate a surge in the number of businesses adopting digital twin technology as part of their business strategy.
How Digital Twin Solutions are Transforming Businesses in the UAE
Digital Twin technology and its solutions allow businesses to track the performance of assets, detect potential faults, and make smarter decisions about maintenance and lifecycle management. Digital Twin Solutions in the UAE are rapidly growing, especially in sectors like construction, urban planning, and public services. Here's how Digital Twin Solutions are reshaping various industries in the UAE.
Energy Sector (Oil & Gas)
The energy industry is using digital twin technology in optimizing resource distribution, enhancing demand forecasting, and improving asset monitoring. This technology ensures a more resilient and efficient infrastructure as the UAE continues its transition to sustainable energy.
Healthcare Sector
Digital twins are used in the medical industry to simulate organs, personalize patient care, and streamline clinical procedures. It opens the door for precision medicine and more sophisticated patient care in the rapidly expanding healthcare industry in the United Arab Emirates.
Engineering Sector
In the engineering field, digital twins are used to simulate and analyze intricate machinery and infrastructure. It supports engineers to test scenarios, identify errors, and refine system designs before construction. In industries like infrastructure, aviation, and defence, it guarantees safer and more efficient development.
Automobile Manufacturing Industry
The UAE automotive industry is using digital twins to improve vehicle design, testing, and maintenance. Virtual prototypes save production costs, increase safety, and accelerate innovation. As a result, the UAE has begun making significant investments in electric vehicles and innovative mobility technologies.
Aviation Industry
Digital twins can be beneficial for modelling aircraft parts, tracking performance, and forecasting maintenance requirements in the UAE's booming aviation industry. It prolongs the aircraft's lifespan, improves performance, and safety.
Construction and Infrastructure Industry
Real-time models of buildings, bridges, and other infrastructure are produced using digital twin technology. In the thriving UAE construction industry, it enables contractors and developers to monitor developments, reduce errors, and create more intelligent, sustainable urban designs.
Manufacturing Sector
In the UAE, manufacturers are using digital twins to simulate production processes, monitor machinery, and manage supply networks. As the competitive global market demands more flexible operations, improved quality control, and reduced downtime, digital twins can provide significant support.
Real Estate and Property Development
UAE real estate developers are using digital twins to view buildings before construction, remotely manage homes, and simulate energy consumption. For today's tech-savvy purchasers and investors, these solutions facilitate more informed decision-making in design, leasing, and facility management.
Top 8 Benefits of the Digital Twin
Let’s discuss the top eight benefits of digital twins, but these are only the tip of the iceberg; the others are up and coming:
1. Enhance User Experience
Data is essential to comprehend the past, know the present, and anticipate the future. The foundation of any effective user experience program is effective data management. Digital twins use IoT to collect real-time data from the physical environment. The information gathered is continually analyzed, examined, and learned to provide valuable insights. With real-time analytics, businesses may successfully implement user-centric programs.
2. High-quality and Innovative Products
A competitive advantage that separates the leader from the followers is innovation. Physical asset innovation necessitates significant R&D expenditures. Design, testing, and operation require specialized knowledge due to the high cost of failures. These creative roadblocks can be solved with the help of digital twins. Enterprises can work with the user community to create high-quality offerings in a simulated environment that combines real-time information.
3. Enhance Business Processes
For consumers, broken processes and bureaucracy would be at the top of their list of annoyances. The orchestration, knowledge management, and technological architecture are fragmented and siloed due to the complexity of modern business operations. The numerous systems and processes are brought together under one roof using digital twins, which act as a meta-layer. Digital twins are essential for knowledge management, training, and process optimization in the complicated future. Additionally, simulations and visualizations support better process management and human learning.
4. Operative Flexibility
Operational agility will affect an organization's top and bottom lines in a highly competitive marketplace. Black-box algorithms, the enormous amounts of information gathered, and the need for quicker judgments all work against human operators. Digital twins allow a range of diagnostic and prognostic capabilities by utilizing enormous amounts of data, technology, and scenarios. The human operators can re-enter the process and find strategies for being competitive and flexible.
5. Information Security
Information security is a challenge that comes with all the data. Open source, collaborative learning, and knowledge sharing have never had a more compelling argument. We can't advance if data breaches are happening more frequently. Trusted stakeholders could collaborate on a platform provided by digital twins to share information and gain from it. Digital twins can also act as a layer of concealment to protect the confidentiality of the data.
6. Upgraded Research & Development
Utilising digital twins produces a wealth of data regarding expected performance results, facilitating more efficient product research and creation. The best thing is that before beginning production, businesses can use this data to gain insights that will help them make the necessary product improvements.
7. Greater Effectiveness
Digital twins can aid in monitoring and mirroring production systems even after a new product has entered production to reach and maintain peak efficiency throughout the manufacturing process.
8. Product Life Cycle
Digital twins can also assist producers in determining how to handle products that have reached the end of their useful lives and require final processing, such as recycling or other actions. They can decide which product materials can be gathered by utilising digital twins.
Beinex Digital Twin Solutions & Consulting Services
The steadily growing digital twins’ market is evidence that, although being widely used in many different industries, this technology is still far from attaining its full potential. The entire business lifecycle is undergoing a transformation due to digital twin solutions, encompassing product creation and design, marketing, sales, and post-purchase support.
For businesses seeking to advance their digital transformation agendas, digital twins are now more than just a tool; they are a strategic enabler. In the UAE, Beinex's digital twin consulting services are having a significant impact. Beinex is here to help you achieve the full potential of your digital twin journey. Connect with us to know more: https://beinex.com/digital-twin/
What is an SLM?
A Small Language Model (SLM) is tailored to excel in simpler tasks, offering boosted accessibility and user-friendliness for organizations operating with limited resources. Besides, they can be readily fine-tuned to align with specific requirements. Small language models are particularly well-suited for organizations aiming to develop applications capable of operating local devices instead of relying on cloud infrastructure. They are especially beneficial for tasks that do not necessitate extensive reasoning or immediate responses.
Reasons to use SLMs
Given the growing popularity and applicability of SLMs across various domains, particularly in areas like sustainability and the volume of data required for training, there are multiple reasons for employing them.
What is Phi-3?
Microsoft has a suite of small language models (SLMs) known as 'Phi,' demonstrating outstanding performance across various benchmarks. Microsoft's recent release is Phi-3, a series of open AI models. The Phi-3 models represent a prototype of capability and cost-effectiveness among small language models (SLMs), exceeding models of equivalent and larger sizes across the spectrum of coding, language, reasoning, and mathematical standards. This launch broadens the array of high-calibre models accessible to customers, providing them with more practical options as they craft and construct generative AI applications.
Phi-3-mini, a 3.8B language model, is accessible through Microsoft Azure AI Studio, Hugging Face, and Ollama. It is offered in two context-length variations—4K and 128K tokens. Notably, it is the first model within its category to support a context window of up to 128K tokens with minimal impact on quality. Furthermore, it is instruction-tuned, implying that it has been trained to comprehend and adhere to diverse instructions, mirroring natural human communication patterns. This ensures that the model is readily deployable straight out of the box. Phi-3-mini is available on Azure AI to leverage the deploy-eval-finetune toolchain, and it is also accessible on Ollama for developers to execute locally on their laptops.
Features of Phi-3
Phi-3 models exhibit distinctive superiority over language models of comparable and larger dimensions on key benchmarks, showcasing the following features:
Snowflake meets Phi-3: Advantages
The key pain point about LLMs is the computing required to host and run them. Setting up a dozen GPUs to run models can be expensive and complex. There's where Snowflake steps up. Snowflake's compute pool option enables users to easily and quickly set up and manage compute clusters. Phi-3 comes into the picture because of its cost-effective GPU utilization.
Can you imagine a situation where your language model only requires less than 3GB of GPU memory for inference? Well, now it's possible, all thanks to Phi-3. It's a state-of-the-art SLM that produces excellent results over GP3.5 and Mistral 8x7B, which are much bigger models. This opens the door for more cost-effective solutions to be brought up in the AI space. Add Snowflake for hosting; you have an excellent setup to host, test, and build AI applications. Read below how Beinex managed to run Phi-3 on Day 0 in Snowflake.
Figure 1: DocAI running on Phi-3
Implementing Phi-3 on Snowflake: What Beinex Did and How Beinex Did it?
Beinex has seamlessly integrated Phi-3 into Snowflake to help enterprises unlock their data's full potential through advanced language processing capabilities and enhance decision-making with deeper insights. The integration facilitates Snowflake users to:
Here's a detailed guide on implementing Phi-3 on Snowflake:
Step 1: Create Necessary Objects
-- Run by ACCOUNTADMIN to allow connecting to Hugging Face to download the model
-- Stage to store LLM models
CREATE STAGE <stagename> IF NOT EXISTS models
DIRECTORY = (ENABLE = TRUE)
ENCRYPTION = (TYPE='SNOWFLAKE_SSE');
-- Stage to store YAML specs
CREATE STAGE <stagename> IF NOT EXISTS specs
DIRECTORY = (ENABLE = TRUE)
ENCRYPTION = (TYPE='SNOWFLAKE_SSE');
-- Image repository
CREATE OR REPLACE IMAGE REPOSITORY images;
-- Compute pool to run containers
CREATE COMPUTE POOL GPU_NV_S
MIN_NODES = 1
MAX_NODES = 1
INSTANCE_FAMILY = GPU_NV_S;
Step 2: Docker Image Code - ollama
FROM ollama/ollama
RUN $(ollama serve > output.log 2>&1 &) && sleep 10 && ollama pull phi3 && pkill ollama && rm output.log
ENTRYPOINT ["ollama"]
CMD ["serve"]
Step 3: Tag and Push the Docker Image
docker tag ollama <SNOW_ORG-SNOW_ACCOUNT>.registry.snowflakecomputing.com/db/schema/image respository /ollama
docker push <SNOW_ORG-SNOW_ACCOUNT>.registry.snowflakecomputing.com db/schema/image repository /ollama
Step 4: Docker Image - UDF
FROM python:3.11
WORKDIR /app
ADD ./requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
ADD ./ /app
EXPOSE 5000
ENV FLASK_APP=app
CMD ["flask", "run", "--host=0.0.0.0"]
App.py content is given below :
from flask import Flask, request, Response, jsonify
import logging
import re
import os
from openai import OpenAI
client = OpenAI(
base_url='http://ollama:11434/v1',
api_key="EMPTY",
)
model = "phi3"
app = Flask(__name__)
app.logger.setLevel(logging.ERROR)
def extract_json_from_string(s):
logging.info(f"Extracting JSON from string: {s}")
# Use a regular expression to find a JSON-like string
matches = re.findall(r"\{[^{}]*\}", s)
if matches:
# Return the first match (assuming there's only one JSON object embedded)
return matches[0]
# Return the original string if no JSON object is found
return s
@app.route("/", methods=["POST"])
def udf():
try:
request_data: dict = request.get_json(force=True) # type: ignore
return_data = []
for index, col1 in request_data["data"]:
completion = client.chat.completions.create(
model=model,
messages=[
{
"role": "system",
"content": "You are a bot to help extract data and should give professional responses",
},
{"role": "user", "content": col1},
],
)
return_data.append(
[index, extract_json_from_string(completion.choices[0].message.content)]
)
return jsonify({"data": return_data})
except Exception as e:
app.logger.exception(e)
return jsonify(str(e)), 500
Step 6: YAML File
spec:
containers:
- name: ollama
image: <SNOW_ORG-SNOW_ACCOUNT>.registry.snowflakecomputing.com/ db/schema/image respository /Phi3
resources:
requests:
nvidia.com/gpu: 1
limits:
nvidia.com/gpu: 1
env:
NUM_GPU: 1
MAX_GPU_MEMORY: 24Gib
volumeMounts:
- name: llm-workspace
mountPath: /<stage name>
- name: udf
image: <SNOW_ORG-SNOW_ACCOUNT>.registry.snowflakecomputing.com/ db/schema/image respository /ollama_udf
endpoints:
- name: chat
port: 5000
public: false
- name: llm
port: 11434
public: false
volumes:
- name: llm-workspace
source: "@<llm stage_name>"
Step 7: Upload YAML File and Create Service
Upload the YAML file to the created stage, where the stage name in the YAML file should match the stage created in Step 2.
-- Create service
create service phi3
IN COMPUTE POOL <name of compute pool created>
FROM @dash_stage
SPECIFICATION_FILE = '<name of yaml file uploaded>';
Step 8: Create Service Function
Create a service function on the service (after it starts).
create or replace function phi3chat(prompt text)
returns text
service= phi3
endpoint=chat;
Check Service Status
Use the following command to check the status of the service:
SELECT
v.value:containerName::varchar container_name,
v.value:status::varchar status,
v.value:message::varchar message
FROM (
SELECT parse_json(system$get_service_status('<service name>'))
) t,
LATERAL FLATTEN(input => t.$1) v;
Benefits of Running Phi-3 on Snowflake
1. Cost-Effectiveness and Efficiency:
2. Compatibility with Smaller GPUs:
3. Exceptional Performance:
4. Faster Response Times:
SLM vs LLM
The choice between small and large language models hinges on organizational needs, task complexity, and resource availability.
LLMs excel in applications requiring the orchestration of intricate tasks, encompassing advanced reasoning, data analysis, and contextual comprehension.
On the other hand, SLMs present viable options for regulated industries and sectors facing scenarios necessitating top-tier results while maintaining data within their premises.
Both large and small language models possess distinct strengths and applications. While large language models thrive in managing complex workflows, small language models deliver impressive performance despite their compact size.
While some customers may exclusively require small models, others may favour larger models, with many seeking to integrate both types in various configurations. Ultimately, the optimal selection depends on the unique context and objectives of the organization. Besides transitioning from large to small models, the trend is evolving towards a diversified portfolio of models. This means that instead of relying on a single model, customers can choose from various models with different sizes, capabilities, and resource requirements. This empowers customers to decide the best model for their scenario, balancing performance and resource constraints.