Abstract:
This paper proposes a method for adaptive control of sliding window parameters in large language models (LLMs) based on Mamdani fuzzy inference with defuzzification using the high-speed area ratio method (MAR-II). The input variables are the type-token ratio (TTR) and the average BPE token length (ATL), interpreted as measurable correlates of the cognitive load of a text fragment. A nine-rule fuzzy controller generates the sliding window stride and context length (max_length). MAR-II is compared with the center of gravity (CoG) method across a 25×25 grid of input space points (RMSE: 99.9 tokens for stride, 147.4 tokens for max_length). It is demonstrated that MAR-II ensures the additivity of the fuzzy model and eliminates the systematic errors of CoG, achieving a single-inference computation time of approximately 35 ns on a Xilinx Spartan 3E FPGA.