# Scalable Resource Provisioning Framework for Fog Computing Using LLM-Guided Q-Learning Approach
## 3 System Model  
The system model inputs the set of requests coming from various IoT devices that are capable of being executed among the fog nodes in the fog tier.  
\[IoT(REQ)=\left\{\begin{array}{ll}\text{{Re}q_{1},\text{{Re}q_{2},\text{{Re}q_ {3},\text{{Re}q_{4}}}},\ldots,\text{{Re}q_{n}}}\end{array}\right\}\]  
Every request is composed of varying resource requirements in terms of Deadline (Ddl), Computational power (Cp), Memory (Mem), Storage (St), and Bandwidth (Bw).  
\[\text{{Re}q_{i}}=\left\{\begin{array}{ll}Ddl(\text{{Re}q_{i}}),Cp(\text{{ Re}q_{i}}),Mem(\text{{Re}q_{i}}),St(\text{{Re}q_{i}}),Bw(\text{{Re}q_{i}}) \end{array}\right\}\]  
The set of fog nodes is distributed across the fog tier.  
\[FN=\left\{\begin{array}{ll}Fn_{1},Fn_{2},Fn_{3},Fn_{4},\ldots,Fn_{n}\end{array}\right\}\]  
The following end Objective Functions (OFs) are set for the proposed LLM-guided Q-learning (LLM_QL) framework.  
OF1: Processing Delay (PD(LLM_QL)): This is the time required to service the requests sent by the IoT devices over the fog layer.  
\[PD(LLM\_QL)=Minimize\left(\sum\
olimits_{i\in I}\frac{1}{PR(\text{{Re}q_{i}}) }\times S(\text{{Re}q_{i}})\right) \tag{1}\]  
where \(PR(\text{{Re}q_{i}})\) stands for requests processing rate across fog nodes (million instructions per second), \(S(\text{{Re}q_{i}})\) represents the size of the requests (million instructions), and \(i\) represents the index term to traverse through the number of requests. The objective of the LLM_QL is to minimize the processing delay involved in servicing the requests.  
OF2: Energy Consumption (EC(LLM_QL)): This is the amount of energy required for input request pre-processing, computation, and transmission over the fog layer.  
\[EC(LLM\_QL)=Minimize\left(\sum\
olimits_{i\in I}PC(\text{{Re}q_{i}})*\frac{ WL(\text{{Re}q_{i}})}{CP(fn_{i})}\right) \tag{2}\]  
where \(PC(\text{{Re}q_{i}})\) represents the power required to process the input requests, \(WL(\text{{Re}q_{i}})\) is the total workload allocated, which is measured in terms of Floating Point Operations Per Second (FLOPS), \(CP(fn_{i})\) is the computational capacity of the fog node in Operations Per Second (OPS), and i represents the index term to traverse through the number of requests.  
OF3: Load (LD(LLM_QL)): This is the measure of a large quantity of work put on fog nodes for execution.  
\[LD(LLM\_QL)=Balance\left(\sum\
olimits_{i\in I}\frac{Mean(\,N(fn_{j}))*N( \text{{Re}q_{j}})}{N(fn_{i})*CC(fn_{j})}\right) \tag{3}\]where \(Mean(N(fn_{i}))\) represents the mean number of fog nodes that process the requests from IoT devices for their successful execution, \(N(Req_{i})\) is the number of requests from IoT devices which are up and running, \(N(fn_{i})\) is the total number of fog nodes, \(CC(fn_{i})\) is the computational capacity of the fog node measured in terms of Million Instructions Per Second (MIPS), and \(i\) represents the index term to traverse through the number of fog nodes.  
OF4: Service Level Agreement Violation (SLAV(LLM_QL)): This is the measure of violation that occurs when the agreed standards of service are not provided by the fog service provider.  
\[SLAV(LLM\_QL)=Minimize\begin{cases} SLAV=Yes,&if\ PT(Req_{i},\Delta T)>0\\ SLAV=No,&if\ PT(Req_{i},\Delta T)\leq 0\end{cases} \tag{4}\]  
The SLAV has happened when the \(PT(Req_{i},\Delta T)\) value exceeds zero, and similarly the SLAV has not happened when \(PT(Req_{i},\Delta T)\) becomes lesser than or equal to zero.