johnlam90 commited on
Commit
157c810
·
verified ·
1 Parent(s): df5996e

Upload ENI Specialist - Second-stage fine-tuned Phi-3 Mini for AWS Multi-ENI Controller expertise

Browse files
README.md ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model: johnlam90/phi3-mini-4k-instruct-alpaca-lora
4
+ tags:
5
+ - phi3
6
+ - lora
7
+ - aws
8
+ - eni
9
+ - multi-eni-controller
10
+ - 5g
11
+ - networking
12
+ - specialist
13
+ - second-stage-finetuning
14
+ datasets:
15
+ - johnlam90/johnlam-eni-instructions
16
+ language:
17
+ - en
18
+ pipeline_tag: text-generation
19
+ ---
20
+
21
+ # Phi-3 Mini ENI Specialist - AWS Multi-ENI Controller Expert
22
+
23
+ This model is a **second-stage fine-tuned** version of [johnlam90/phi3-mini-4k-instruct-alpaca-lora](https://huggingface.co/johnlam90/phi3-mini-4k-instruct-alpaca-lora) specialized for AWS Multi-ENI Controller knowledge using a custom dataset of 3 expert-level instructions.
24
+
25
+ ## Model Architecture
26
+
27
+ ```
28
+ microsoft/Phi-3-mini-4k-instruct (Base Model)
29
+
30
+ johnlam90/phi3-mini-4k-instruct-alpaca-lora (Stage 1: General Instruction Following)
31
+
32
+ johnlam90/phi3-mini-eni-specialist (Stage 2: AWS Multi-ENI Controller Specialist)
33
+ ```
34
+
35
+ ## Model Details
36
+
37
+ - **Base Model**: microsoft/Phi-3-mini-4k-instruct
38
+ - **Stage 1**: Fine-tuned on tatsu-lab/alpaca (52,002 samples)
39
+ - **Stage 2**: Specialized on johnlam90/johnlam-eni-instructions (3 expert samples)
40
+ - **Fine-tuning Method**: LoRA (Low-Rank Adaptation) - Second Stage
41
+ - **Training Duration**: 5.6 seconds
42
+ - **Final Training Loss**: 1.0032
43
+ - **Average Training Loss**: 0.9823
44
+
45
+ ## Specialization Areas
46
+
47
+ This model is an expert in:
48
+
49
+ - **AWS Multi-ENI Controller**: Dynamic ENI provisioning and management
50
+ - **5G UPF Deployment**: User Plane Function deployment strategies
51
+ - **Network Technologies**: SR-IOV vs DPDK comparisons
52
+ - **Kubernetes Networking**: ENI management in containerized environments
53
+ - **Telco CNF**: Cloud Native Functions for telecommunications
54
+
55
+ ## Training Configuration (Stage 2)
56
+
57
+ - **LoRA Rank**: 8
58
+ - **LoRA Alpha**: 16
59
+ - **LoRA Dropout**: 0.05
60
+ - **Target Modules**: qkv_proj, o_proj, gate_proj, up_proj, down_proj
61
+ - **Learning Rate**: 5e-6
62
+ - **Batch Size**: 1 (with gradient accumulation steps: 4)
63
+ - **Epochs**: 10 (6.67 effective epochs)
64
+ - **Precision**: bfloat16
65
+ - **Gradient Checkpointing**: Enabled
66
+
67
+ ## Usage
68
+
69
+ ```python
70
+ import torch
71
+ from transformers import AutoTokenizer, AutoModelForCausalLM
72
+ from peft import PeftModel
73
+
74
+ # Load tokenizer
75
+ tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct", trust_remote_code=True)
76
+
77
+ # Load base model
78
+ base_model = AutoModelForCausalLM.from_pretrained(
79
+ "microsoft/Phi-3-mini-4k-instruct",
80
+ torch_dtype=torch.bfloat16,
81
+ device_map="auto",
82
+ trust_remote_code=True
83
+ )
84
+
85
+ # Load Stage 1 LoRA (Alpaca)
86
+ model = PeftModel.from_pretrained(base_model, "johnlam90/phi3-mini-4k-instruct-alpaca-lora")
87
+
88
+ # Load Stage 2 LoRA (ENI Specialist)
89
+ model = PeftModel.from_pretrained(model, "johnlam90/phi3-mini-eni-specialist", adapter_name="eni_specialist")
90
+ model.eval()
91
+
92
+ # Ask ENI-specific questions
93
+ prompt = "How does the AWS Multi-ENI Controller manage dynamic ENI provisioning?"
94
+ formatted_prompt = f'''### Instruction:
95
+ {prompt}
96
+
97
+ ### Response:
98
+ '''
99
+
100
+ # Generate expert response
101
+ inputs = tokenizer(formatted_prompt, return_tensors="pt")
102
+ with torch.no_grad():
103
+ outputs = model.generate(
104
+ **inputs,
105
+ max_new_tokens=200,
106
+ do_sample=False,
107
+ eos_token_id=tokenizer.eos_token_id,
108
+ pad_token_id=tokenizer.eos_token_id
109
+ )
110
+
111
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
112
+ print(response.split("### Response:")[1].strip())
113
+ ```
114
+
115
+ ## Example Outputs
116
+
117
+ ### Question: "How does the AWS Multi-ENI Controller manage dynamic ENI provisioning?"
118
+
119
+ **ENI Specialist Response:**
120
+ > The AWS Multi-ENI Controller manages dynamic ENI provisioning by automatically creating and deleting ENIs as needed. It also manages the lifecycle of ENIs, including their creation, deletion, and termination. The controller also provides a centralized management interface for monitoring and managing ENIs.
121
+
122
+ ### Question: "What steps should be taken to deploy a 5G UPF using the AWS Multi-ENI Controller?"
123
+
124
+ **ENI Specialist Response:**
125
+ > The steps to deploy a 5G UPF using the AWS Multi-ENI Controller are:
126
+ > 1. Create a VPC with a public subnet and a private subnet.
127
+ > 2. Create a NAT Gateway in the public subnet.
128
+ > 3. Create an Elastic Network Interface (ENI) in the private subnet.
129
+ > 4. Create a 5G UPF in the private subnet.
130
+ > 5. Configure the 5G UPF to use the ENI.
131
+ > 6. Configure the 5G UPF to use the NAT Gateway.
132
+ > 7. Configure the 5G UPF to use the VPC.
133
+ > 8. Configure the 5G UPF to use the AWS Multi-ENI Controller.
134
+
135
+ ## Performance
136
+
137
+ The model demonstrates excellent specialization with:
138
+ - ✅ Expert-level knowledge of AWS Multi-ENI Controller
139
+ - ✅ Detailed technical explanations
140
+ - ✅ Step-by-step deployment guidance
141
+ - ✅ Clear differentiation of networking technologies
142
+ - ✅ Consistent instruction following
143
+
144
+ ## Training Methodology
145
+
146
+ This model showcases **second-stage fine-tuning**, where:
147
+ 1. A general instruction-following model is first created
148
+ 2. Domain-specific knowledge is then layered on top
149
+ 3. Small, high-quality datasets can create powerful specialists
150
+ 4. Multiple LoRA adapters can be stacked for cumulative learning
151
+
152
+ ## Use Cases
153
+
154
+ Perfect for:
155
+ - AWS networking consultations
156
+ - 5G infrastructure planning
157
+ - Kubernetes networking guidance
158
+ - Telco CNF deployment assistance
159
+ - Multi-ENI architecture design
160
+
161
+ ## License
162
+
163
+ This model is released under the MIT license, following the base model's licensing terms.
164
+
165
+ ## Citation
166
+
167
+ If you use this model, please cite:
168
+
169
+ ```bibtex
170
+ @misc{phi3-mini-eni-specialist,
171
+ title={Phi-3 Mini ENI Specialist: AWS Multi-ENI Controller Expert},
172
+ author={johnlam90},
173
+ year={2025},
174
+ publisher={Hugging Face},
175
+ url={https://huggingface.co/johnlam90/phi3-mini-eni-specialist}
176
+ }
177
+ ```
adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "microsoft/Phi-3-mini-4k-instruct",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layers_pattern": null,
10
+ "layers_to_transform": null,
11
+ "loftq_config": {},
12
+ "lora_alpha": 32,
13
+ "lora_dropout": 0.05,
14
+ "megatron_config": null,
15
+ "megatron_core": "megatron.core",
16
+ "modules_to_save": null,
17
+ "peft_type": "LORA",
18
+ "r": 16,
19
+ "rank_pattern": {},
20
+ "revision": null,
21
+ "target_modules": [
22
+ "o_proj",
23
+ "up_proj",
24
+ "down_proj",
25
+ "gate_proj",
26
+ "qkv_proj"
27
+ ],
28
+ "task_type": "CAUSAL_LM"
29
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea3f76d945bec1054f11f7f7ac773d332d1a4cda0aab893e9c02fa3df7558470
3
+ size 30437856
eni_specialist/adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": null,
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layers_pattern": null,
10
+ "layers_to_transform": null,
11
+ "loftq_config": {},
12
+ "lora_alpha": 16,
13
+ "lora_dropout": 0.05,
14
+ "megatron_config": null,
15
+ "megatron_core": "megatron.core",
16
+ "modules_to_save": null,
17
+ "peft_type": "LORA",
18
+ "r": 8,
19
+ "rank_pattern": {},
20
+ "revision": null,
21
+ "target_modules": [
22
+ "o_proj",
23
+ "up_proj",
24
+ "down_proj",
25
+ "gate_proj",
26
+ "qkv_proj"
27
+ ],
28
+ "task_type": "CAUSAL_LM"
29
+ }
eni_specialist/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2384d6cb28b832d7306c32295945e356b4b7b1767c5d39ef6a4e4e8f9746471
3
+ size 15233176
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2e0e673c112ba79e8ca306c30e863c15d0dd6c6f229c1fd4ac6cf40ad77f785
3
+ size 4792