Context length is fixed
128K refers to Llama 3.1's ability to take up to 128,000 tokens in a single forward pass. This limit is fixed during training.
Inference on local hardware
When running inference locally (assuming your question isn't about hardware for training), your hardware significantly influences the speed of the model's performance but doesn't affect the fixed context length. There are optimization techniques, such as offloading model layers between RAM and VRAM and using quantization to reduce floating-point precision (which may impact response quality).
But why "128"?
According to the to the paper:
We increase the supported context length in increments, pre-training until the model has successfully adapted to the increased context length. We assess successful adaptation by measuring whether (1) model performance on short-context evaluations has recovered completely and (2) the model perfectly solves "needle in a haystack" tasks up to that length. In Llama 3 405B pre-training, we increased context length gradually in six stages, starting from the original 8K context window and ending in the final 128K context window. This long-context pre-training stage was performed using approximately 800B training tokens.
The "needle in a haystack" test involves hiding a key fact within a large amount of information. The model is then asked a question that requires that specific fact to answer correctly. This tests the model's ability to recover that small fact in a such a large context, it would catch if it's answering solely on pre-existing knowledge within it's weights for instance (and not using the context effectively).
It appears that the "128k" was chosen based on the quality of the response instead of on hardware specifications.
P.S.: It's a bit odd to me that they tried "six stages" from 8K and 128K instead of five (8K, 16K, 32K, 64K, 128K).