# SecureLLM: A Unified Framework for Privacy-Focused Large Language Models
## 4 Discussion of the Implementation  
### Cryptographic Choices  
AES-GCM can be used for gradient encryption due to its balance between speed and security. We selected AES-GCM because it is a widely recognized industry standard that benefits from hardware acceleration on many modern GPUs/CPUs, allowing for a high throughput with a relatively low overhead, which is particularly critical in large-scale LLM training. ECC-based (e.g., Curve25519) key exchange protocols might be implemented to distribute symmetric keys among multiple training nodes or clients. Curve25519, with its compact key sizes and efficient computations, is especially conducive to frequent key rotations and ephemeral key usage in high-throughput pipelines. While other ECC or classical algorithms (e.g., RSA) could also be employed, we specifically chose Curve25519 to balance speed, security, and the flexibility required in modern LLM ecosystems. This approach enables regular key rotations and prevents long-term key exposure. If stronger protection is needed for computations over encrypted data, partial or leveled homomorphic encryption schemes could be explored, though they typically introduce a higher computational overhead. In high-stakes settings where minimizing security risks may be more important than computational efficiency--such as critical infrastructure or sensitive government applications--these more resource-intensive approaches could be justified by stricter regulatory demands or the need for advanced compliance. We specifically selected AES-GCM for symmetric encryption due to its well-established combination of a high performance and robust security. AES-GCM benefits from hardware acceleration support on modern GPUs and CPUs, enabling fast encryption and decryption suitable for real-time operations even in large-scale LLM deployments. In comparison with alternatives such as ChaCha20-Poly1305, AES-GCM has a comparable security generally with a superior efficiency on the typically used platforms. The selection of Curve25519 for asymmetric cryptographic operations and for exchanges depended primarily on its efficiency in the generation and agreement schemes for keys and on its comparatively short key length. Curve25519 typically outperforms traditional algorithms like RSA in terms of its speed and memory overhead, making it a practical choice for scenarios requiring frequent ephemeral key exchanges. The symmetric-asymmetric hybrid approach exploits the best features of both realms of cryptography: symmetric encryption (AES-GCM) efficiently safeguards bulk data transfer with near-zero latency, and asymmetric cryptography (Curve25519) efficiently and securely safeguards symmetric session key exchanges. The hybrid approach attains the all-crucial balance between latency and security by providing robust data protection at the cost of not imposing asymmetric encryption on all of the data. Moreover, while emerging post-quantum cryptographic algorithms--such as CRYSTALS-Kyber for key exchange or CRYSTALS-Dilithium for digital signatures--offer compelling future-proofing against quantum adversaries, their current computational costs and larger key sizes pose challenges for real-time encryption in large-scale distributed LLM training. Nonetheless, our modular design of the cryptographic layer ensures that future integration with such post-quantum contenders is feasible, meaning SecureLLM deployments can migrate seamlessly as the quantum-resistant best practices become more feasible and efficient. A further layer of sophistication may be introduced by adopting ephemeral key strategies, wherein key pairs are generated for each training round and discarded after use [46]. This reduces the attack surface since compromised long-term keys would not automatically grant access to future gradient updates or model states. In practical terms, ephemeral key rotation can be realized through established protocols (e.g., ECDH using Curve25519) while maintaining a separate certificate authority to confirm the validity of participants and manage revocations.