The ability to complete sentences and guess words is an essential component of NLP. Virtual assistants and advanced technology that dictate text to humans both gain from them. Because of their ambiguity, reliance on long-term events, and lack of information, humans are currently unable to complete these jobs. Common systems use RNNs and transformer topologies; however, these models may struggle to understand and identify uncommon words. Such limitations may hinder their productivity and make it more difficult for them to put their knowledge into practice. To overcome these challenges, this work employs federated learning for word guessing and N-gram modelling. To identify linguistic trends that manifest in many locations, the federated N-grams approach makes use of a large number of computers. Both bias and missing data can be reduced in this way. The Penn Treebank and AS WIKI-text are two of the basic datasets that we use to train and evaluate our model. Using optimisation techniques, we can understand the situation, handle unusual words, and account for bias in our guesses. The results of this study show that Fed-based learning has the potential to revolutionise language modelling by removing control mechanisms from AI while simultaneously protecting users' personal information. With the use of the N-grams method, predictions regarding the next word could be more precise and contextually aware.