File size: 2,629 Bytes
e204153
 
017140f
 
 
 
 
 
e204153
cce21f1
70a76e4
cce21f1
 
f52f4a7
cce21f1
 
 
f52f4a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0852a55
 
 
 
e4f5e06
 
f52f4a7
 
 
 
 
 
 
 
 
 
 
 
 
70a76e4
cce21f1
 
c3bbd31
70a76e4
 
0852a55
70a76e4
 
017140f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
app_file: demo.py
license: mit
title: AI Text Steganography
sdk: gradio
colorFrom: red
colorTo: yellow
pinned: true
---
# AI Text Steganography
## Description
- This is the baseline implementation of AI Text Steganography for our final project in Software Designing and Applied Information Security courses in HCMUS-VNU.
- Our project focuses on hiding data inside a text sequence generated by LLMs (e.g. GPT-2).
- We took inspiration from [Kirchenbauer et al.](https://arxiv.org/abs/2301.10226).
## Members
- Tran Nam Khanh
- Phan Le Dac Phu
## Installation
1. Clone this repository:
```Bash
git clone https://github.com/trnKhanh/ai-text-steganography.git
cd ai-text-steganography
```
2. (Optional) Create new conda environment:
```Bash
conda create -n ai-text-steganography python=3.10
conda activate ai-text-steganography
```
3. Install requirements:
```Bash
pip install -r requirements.txt
```
## Usage
- Gradio demo:
```Bash
python demo.py
```
- RestAPI:
```Bash
python api.py
```
- See help message of the Command Line Interface by:
```Bash
python main.py -h
```
- To run analysis, see the help message by:
```Bash
python analysis.py -h
```
## Documentation
- To access the documentation for the RestAPI, launch the RestAPI and go to <http://localhost:6969/docs>
## Configuration
- `config.ini` is the config file of the project. We use the modified syntax of the `configparser` package. Every key-value pair follows the syntax: `key = type:value`. Currently, `type` can only be `int`, `float` or `str`.
- Details on config:
	- `server`: parameters for the RestAPI:
	- `models.names`: names of LLMs allowed. Note that this follows the name defined on [Hugging Face](https://huggingface.co/models).
	- `models.params`: parameters used to load LLMs.
	- `encrypt.default`: default parameters for encryption algorithm.
	- `decrypt.default`: default parameters for decryption algorithm.
## Notes on implementation
- Because of the limited resources, we load multiple models on the same machine (implementation is in `model_factory.py`):
	- Each model is first loaded to the `load_device` (e.g. cpu).
	- If there is a request to use a specific model, it is loaded to the `run_device` (e.g. gpu) for inference. 
- Therefore, only one model can be used for inference at a time. As a result, we could optimize the limited resources we have to allow users to choose different LLMs, but it forces the API to be synchronous instead.
## TODO lists
- [x] Baseline code.
- [x] CLI.
- [x] Hashing schemes.
- [x] Rest API.
- [x] Basic Demo.
- [x] Statistical  experiments.
- [ ] Attack strategies
    - [ ] White-box
    - [ ] Black-box