<!-- ![](https://hackmd.io/_uploads/HyL91FPfa.png) -->
<!-- .slide: data-background="https://hackmd.io/_uploads/HyL91FPfa.png"-->
---
<!-- .slide: data-transition="zoom" -->
### About me
https://rewanthtammana.com/
Rewanth Tammana is a security ninja, open-source contributor, independent consultant & SME at Uptycs. Previously, Senior Security Architect at Emirates NBD. Passionate about DevSecOps, Application, and Container Security. Added 17,000+ lines of code to Nmap. Holds industry certifications like CKS, CKA, etc.
---
<!-- .slide: data-transition="zoom" -->
### About me
https://twitter.com/rewanthtammana
Speaker & trainer at international security conferences worldwide including Black Hat, Defcon, Hack In The Box (Dubai and Amsterdam), CRESTCon UK, PHDays, Nullcon, Bsides, CISO Platform, null chapters and multiple others.
---
<!-- .slide: data-transition="zoom" -->
### About me
https://linkedin.com/in/rewanthtammana
One of the MVP researchers on Bugcrowd (2018) and identified vulnerabilities in several organizations. Published an IEEE research paper on an offensive attack in Machine Learning and Security. Also, part of the renowned Google Summer of Code program.
---
<!-- .slide: data-transition="zoom" -->
### Importance of Data Security in AI
* AI models require vast amounts of data <!-- .element: class="fragment" -->
* Risks of data breaches and misuse <!-- .element: class="fragment" -->
* The need for a paradigm shift: Local AI execution <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### Why
![](https://hackmd.io/_uploads/rJmEIEEfa.png =800x500)
[Reference - codeandhack.com](https://codeandhack.com/samsung-corporate-data-leaked-due-to-chatgpt/)
---
<!-- .slide: data-transition="zoom" -->
### Why
![](https://hackmd.io/_uploads/HJ-qvV4Ma.png =800x500)
[Reference - theverge.com](https://www.theverge.com/2023/5/19/23729619/apple-bans-chatgpt-openai-fears-data-leak)
---
<!-- .slide: data-transition="zoom" -->
### Why
![](https://hackmd.io/_uploads/r1Jf_4Ez6.png =800x500)
[Reference - axios.com](https://www.axios.com/2023/03/10/chatgpt-ai-cybersecurity-secrets)
---
<!-- .slide: data-transition="zoom" -->
### Why
![](https://hackmd.io/_uploads/SkGj9N4f6.png =800x500)
[Reference - reuters](https://www.reuters.com/technology/space/us-space-force-pauses-use-ai-tools-like-chatgpt-over-data-security-risks-2023-10-11/)
---
<!-- .slide: data-transition="zoom" -->
### Why
![](https://hackmd.io/_uploads/SyWDj4NGp.png)
[Reference - washingtonpost.com](https://www.washingtonpost.com/technology/2023/07/13/ftc-openai-chatgpt-sam-altman-lina-khan/)
---
<!-- .slide: data-transition="zoom" -->
### Why
![](https://hackmd.io/_uploads/SkwtiNNM6.png)
[Reference - tenable.com](https://www.tenable.com/blog/cybersecurity-snapshot-chatgpt-use-can-lead-to-data-privacy-violations)
---
<!-- .slide: data-transition="zoom" -->
### How to prevent
* Data Anonymization <!-- .element: class="fragment" -->
* Limit Data Access <!-- .element: class="fragment" -->
* Local Execution <!-- .element: class="fragment" -->
* Training and Awareness <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### How to prevent
* <span style="color:red">Data Anonymization</span> <!-- .element: class="fragment" -->
* <span style="color:red">Limit Data Access</span> <!-- .element: class="fragment" -->
* <span style="color:green">Local Execution</span> <!-- .element: class="fragment" -->
* <span style="color:red">Training and Awareness</span> <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### What is Local AI Model Execution?
* Running AI models directly on user devices <!-- .element: class="fragment" -->
* No data sent to external servers <!-- .element: class="fragment" -->
#### Benefits <!-- .element: class="fragment" -->
* Enhanced privacy <!-- .element: class="fragment" -->
* Reduced latency <!-- .element: class="fragment" -->
* Offline capabilities <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### Introducing Hugging Face
* Repository of pre-trained models <!-- .element: class="fragment" -->
* Facilitates local AI execution <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### Hugging face models count
![](https://hackmd.io/_uploads/SkBD5XIfp.png)
---
<!-- .slide: data-transition="zoom" -->
### Stable Diffusion research paper
![](https://hackmd.io/_uploads/SyIiItPMp.png)
---
<!-- .slide: data-transition="zoom" -->
### Hugging face filter options
![](https://hackmd.io/_uploads/Hk3Shm8f6.png)
---
<!-- .slide: data-transition="zoom" -->
### Pre-compiled models
![](https://hackmd.io/_uploads/BJ8FwYDG6.png)
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Setting up Hugging Face
* Installing the Hugging Face library <!-- .element: class="fragment" -->
* Loading pre-compiled models <!-- .element: class="fragment" -->
* Demo - Quick setup and model loading <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Text Generation
* Using Hugging Face for generating text
Demo - Create a short story using a pre-trained model
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Text Generation
```python {.fragment}
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
model_name = "distilgpt2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
story_generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
prompt = "On a sunny day in Paris,"
result = story_generator(prompt, max_length=300, do_sample=True, top_k=50, top_p=0.95, num_return_sequences=1)
print(result[0]['generated_text'])
```
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Text Generation
![](https://hackmd.io/_uploads/HJTyyH8fT.png)
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Creating Pictures from Text
The power of advanced models in Hugging Face.
Demo - Generating an image from a text description.
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Creating Pictures from Text
```python
from diffusers import DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
pipeline = pipeline.to("mps") # cpu, cuda, mkldnn, opengl, opencl, ideep, hip, ve, fpga, ort, xla, lazy, vulkan, mps, meta, hpu, mtia, privateuseone
# Recommended if you have 8/16 GB RAM
pipeline.enable_attention_slicing()
prompt = "a photo of an astronaut riding a horse on mars"
_ = pipeline(prompt,num_inference_steps=1)
images = pipeline(prompt).images
for index, image in enumerate(images):
image.save("image{0}.jpg".format(index))
```
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Creating Pictures from Text
![](https://hackmd.io/_uploads/SJRxbHIG6.png)
---
<!-- .slide: data-transition="zoom" -->
### Creating Pictures from Text
#### Stable Diffusion Web UI
![](https://hackmd.io/_uploads/rJlrtKPMp.png)
https://github.com/AUTOMATIC1111/stable-diffusion-webui
---
<!-- .slide: data-transition="zoom" -->
### Spin up Web UI
![](https://hackmd.io/_uploads/S1igYYPMp.png =800x600)
---
<!-- .slide: data-transition="zoom" -->
### Spin up Web UI
![](https://hackmd.io/_uploads/rJgbZKKDGa.png)
---
<!-- .slide: data-transition="zoom" -->
### Creating Picture from Text
![](https://hackmd.io/_uploads/rJL-FKPMp.png)
---
<!-- .slide: data-transition="zoom" -->
### Reverse engineer a picture
Look at picture from your ML model POV
![](https://hackmd.io/_uploads/SJobtYPMp.png)
---
<!-- .slide: data-transition="zoom" -->
### Change a feature of ML interpretation
![](https://hackmd.io/_uploads/rJzztYPGa.png)
---
<!-- .slide: data-transition="zoom" -->
### Change a feature of ML interpretation
![](https://hackmd.io/_uploads/BJizFtDGa.png)
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Code Writing with AI
* AI's capability to assist in coding
Demo - Writing a simple Python function with the help of Hugging Face.
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Code Writing with AI
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "bigcode/santacoder"
device = "cuda" # for GPU usage or "cpu" for CPU usage
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True).to(device)
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
```
---
<!-- .slide: data-transition="zoom" -->
### Hands-on: Code Writing with AI
![](https://hackmd.io/_uploads/r1Jp9BUf6.png)
---
<!-- .slide: data-transition="zoom" -->
### Train for your scope of work
* Dataset
* Model
---
<!-- .slide: data-transition="zoom" -->
### Datasets
* The accuracy of the models depends on the dataset
* It's important to have fine tuned dataset
---
<!-- .slide: data-transition="zoom" -->
### Datasets
#### Hugging Face
![](https://hackmd.io/_uploads/B1gjpr8Ma.png)
---
<!-- .slide: data-transition="zoom" -->
### Datasets
#### Kaggle
![](https://hackmd.io/_uploads/ryiPRHLMa.png)
---
<!-- .slide: data-transition="zoom" -->
### Datasets
* Downloading random files can be dangerous
* System compromise <!-- .element: class="fragment" -->
* Malwares <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### Datasets
#### BE CAREFUL!!
![](https://hackmd.io/_uploads/SyxBkLIza.png)
---
<!-- .slide: data-transition="zoom" -->
### Zip file security attacks
---
<!-- .slide: data-transition="zoom" -->
### Case Study 1
![](https://hackmd.io/_uploads/HyB9mYPMT.png =800x500)
[Reference - helpnetsecurity.com](https://www.helpnetsecurity.com/2023/10/16/darkgate-malware-skype/)
---
<!-- .slide: data-transition="zoom" -->
![](https://hackmd.io/_uploads/BJi3mYDz6.png =800x500)
[Reference - helpnetsecurity.com](https://www.helpnetsecurity.com/2023/10/16/darkgate-malware-skype/)
---
<!-- .slide: data-transition="zoom" -->
### Case Study 2
![](https://hackmd.io/_uploads/Syq9VFDz6.png =800x500)
[Reference - kroll.com](https://www.kroll.com/en/insights/publications/cyber/deep-dive-gootloader-malware-infection-chain)
---
<!-- .slide: data-transition="zoom" -->
### Case Study 2
![](https://hackmd.io/_uploads/Bk824KwGa.png =800x500)
[Reference - kroll.com](https://www.kroll.com/en/insights/publications/cyber/deep-dive-gootloader-malware-infection-chain)
---
<!-- .slide: data-transition="zoom" -->
### Case Study 2
![](https://hackmd.io/_uploads/Hkqp4FPG6.png)
[Reference - kroll.com](https://www.kroll.com/en/insights/publications/cyber/deep-dive-gootloader-malware-infection-chain)
---
<!-- .slide: data-transition="zoom" -->
### Case Study 3
![](https://hackmd.io/_uploads/rJWABKwfT.png =800x500)
[Reference - unit42](https://unit42.paloaltonetworks.com/nodestealer-2-targets-facebook-business/)
---
<!-- .slide: data-transition="zoom" -->
### Case Study 3
![](https://hackmd.io/_uploads/SJT1UYDGT.png =800x500)
[Reference - unit42](https://unit42.paloaltonetworks.com/nodestealer-2-targets-facebook-business/)
---
<!-- .slide: data-transition="zoom" -->
### BE CAREFUL!!
![](https://hackmd.io/_uploads/SyxBkLIza.png)
---
<!-- .slide: data-transition="zoom" -->
### Advantages of Local AI Execution
* Enhanced data security <!-- .element: class="fragment" -->
* Reduced dependency on internet connectivity <!-- .element: class="fragment" -->
* Faster response times <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### The Future of Safe AI
* The rise of edge computing in AI <!-- .element: class="fragment" -->
* More tools and platforms supporting local AI execution <!-- .element: class="fragment" -->
* The potential for more personalized and responsive AI applications <!-- .element: class="fragment" -->
---
<!-- .slide: data-transition="zoom" -->
### Recap
* Data privacy conerns & leaks <!-- .element: class="fragment" -->
* Importance of data security <!-- .element: class="fragment" -->
* How to prevent<!-- .element: class="fragment" -->
* Local AI Model Execution <!-- .element: class="fragment" -->
* Hugging Face <!-- .element: class="fragment" -->
* Hands On: Text generation, Pictures from Text, Stable Diffusion, Code Writing with AI <!-- .element: class="fragment" -->
* Datasets <!-- .element: class="fragment" -->
* Specialized data training for custom use case <!-- .element: class="fragment" -->
* Zip file security attacks <!-- .element: class="fragment" -->
* Case Studies <!-- .element: class="fragment" -->
---
### Thank You!
Write to me on:
Google: [Rewanth Tammana](https://www.google.com/search?q=rewanth+tammana&sca_esv=575386901&sxsrf=AM9HkKmnGZBGWzwOS8jWMPYp_YgzN4l8og%3A1697865818064&source=hp&ei=WmAzZbizAeHk1e8Pt5ygiA4&iflsig=AO6bgOgAAAAAZTNuas_v-XYaB2vpwWaiYRGIPtXHOTZW&ved=0ahUKEwi4yNaHs4aCAxVhcvUHHTcOCOEQ4dUDCAo&uact=5&oq=rewanth+tammana&gs_lp=Egdnd3Mtd2l6Ig9yZXdhbnRoIHRhbW1hbmEyBhAAGBYYHkjxC1AAWOsKcAB4AJABAJgB3gGgAagSqgEGMC4xMy4xuAEDyAEA-AEBwgIHECMYigUYJ8ICCBAAGIoFGJECwgIREC4YgAQYsQMYgwEYxwEY0QPCAgsQABiABBixAxiDAcICCxAuGIAEGLEDGIMBwgILEC4YigUYsQMYgwHCAg4QABiKBRixAxiDARiRAsICCBAAGIAEGLEDwgILEAAYigUYsQMYgwHCAggQLhixAxiABMICCxAuGIAEGMcBGNEDwgIFEAAYgATCAgUQLhiABMICCxAuGIAEGMcBGK8BwgIHEAAYgAQYCsICDRAuGIAEGLEDGIMBGArCAgoQLhixAxiABBgKwgINEAAYgAQYsQMYgwEYCsICBxAuGIAEGArCAgcQABgNGIAEwgIHEC4YDRiABMICCRAAGA0YgAQYCsICCRAuGA0YgAQYCsICBhAAGB4YDcICCBAAGAUYHhgNwgIIEAAYCBgeGA3CAgoQABgIGB4YDRgK&sclient=gws-wiz)
Website: [rewanthtammana.com](https://rewanthtammana.com/)
Twitter: [@rewanthtammana](https://twitter.com/rewanthtammana)
LinkedIn: [/in/rewanthtammana](https://www.linkedin.com/in/rewanthtammana/)
{"title":"Securing Data with Local AI Mo","description":"The rise of AI in our digital world.The challenge: Balancing AI capabilities with data privacy.The solution: Local AI model execution.","contributors":"[{\"id\":\"c83db8ee-5e83-4b4d-ab67-7ab40f2ab65a\",\"add\":33747,\"del\":19808}]"}