--- language: - fr license: cc-by-sa-4.0 library_name: gguf pipeline_tag: text-generation tags: - futo-keyboard - keyboard - autocorrect - next-word-prediction - sailfish-os datasets: - HuggingFaceFW/fineweb-2 - wikimedia/wikipedia - Helsinki-NLP/opus-100 --- # French KeyboardLM for FUTO Keyboard (v2) A small French language model (about 33 million parameters) for the transformer features of FUTO Keyboard: next-word prediction, typo correction, and ranking of swipe candidates. FUTO only ships an English model; this is an independent community model, not an official FUTO product. File: `fr_keyboard-0.2.0.gguf` (37 MB, Q6_K). ## How it was made - **Architecture**: Llama, 8 layers, 512 dimensions, 8 heads, feed-forward 1536, RoPE, context 256 tokens, tied input and output embeddings. Same layout and metadata conventions as FUTO's English model (`keyboardlm.features`: `base_v1 inverted_space xbu_char_autocorrect_v1 xc0_swipe_typing_v1 char_embed_mixing_v1`). - **Tokenizer**: SentencePiece BPE, 16,000 pieces, suffix spaces, byte fallback, with FUTO's control tokens (``, ``, ``, ``, `` to ``). Embedded in the GGUF. - **Training text** (deduplicated, split into sentences of 3 words or more): French FineWeb-2 (about 5.5 billion characters), French Wikipedia (about 1.5 billion), and the French side of OPUS-100 (short everyday sentences, weighted four times). - **Typing simulation**: a third of the words in most sentences are presented as typed letters followed by the intended word. About half are typed exactly, a quarter are unfinished (first letters only), a quarter carry realistic AZERTY typos. Accents are folded before letters become `` tokens, so `ete` is learned as `été` and `coeur` as `cœur`. - **Training**: 3 billion tokens, one NVIDIA L4, about 7 hours. Final validation perplexity 28.6 on held-out plain sentences. - **Quantization**: Q6_K, produced with the llama.cpp revision bundled in FUTO Keyboard so that the keyboard's own loader reads it. ## Evaluation Measured with FUTO Keyboard's own prediction engine (built from FUTO's C++ sources), on the same 246 held-out sentences for both versions: | | v1 | v2 (this model) | |---|---|---| | Next word, first suggestion | 22 % | 21 % | | Next word, in top 3 | 35 % | 32 % | | Typo corrected, first suggestion | 71 % | 67 % | | Typo corrected, in top 3 | 86 % | 81 % | | Correctly typed word kept first | 89 % | 91 % | | Only the first letter typed, word in top 3 | 38 % | 62 % | Version 2 trades a little typo correction for much better behaviour on unfinished words, which is what swipe ranking needs (`Je travaille` + `p` gives `pour, par, pas`). Examples: ``` Je suis + contnt -> content, contente, contents On se voit + demian -> demain, Demain, dimanche Bon + anniversire -> anniversaire, Anniversaire, anniversaires à tout à + lheure -> l'heure, lheure, l’heure On se retrouve à quelle (next) -> heure, vitesse, date ``` ## Known limitations - Words written without accents are common in web text, so the model may echo `ete` or `deja` just before `été` and `déjà`. The Sailfish integration below drops such echoes when the typed spelling is not a dictionary word. - Dates and years from Wikipedia and the web are over-represented: `La réunion est reportée à` gives `la, 20, 20h30`. - Trained for AZERTY typos; it works with other layouts but corrections are tuned for AZERTY neighbours. ## Use **Sailfish OS** (FUTO Keyboard port by HtheB): needs a helper change that selects the model by language; proposed upstream. Until then the model is installed by hand as `~/.local/share/futo-keyboard-sailfish/content/prediction/fr_keyboard.gguf`. **Android** (official FUTO Keyboard): not tested. Other community models are imported through Settings, then Predictive Text, then Transformer Models, after enabling the developer option that allows transformer models on non-QWERTY layouts. ## Licence and credits The weights are released under CC BY-SA 4.0, because part of the training text is Wikipedia (CC BY-SA). Training text credits: FineWeb-2 (ODC-By 1.0, Hugging Face), Wikipedia contributors (CC BY-SA), OPUS-100 (Helsinki-NLP; licence of the underlying corpora varies). The typing simulation adapts `TrainingDataGenerator.kt` from FUTO Keyboard (FUTO Source First License 1.1). The overall method follows the community models [barddoo/futo-keyboard-ptbr](https://huggingface.co/barddoo/futo-keyboard-ptbr) and [stamchry/greek-keyboard-lm](https://huggingface.co/stamchry/greek-keyboard-lm). FUTO is a trademark of FUTO Holdings, Inc.; this project is not affiliated with FUTO. Built by Boris Solodki with the help of Claude (Anthropic).