Skip to main navigation Skip to search Skip to main content

On-Device AI for Context-Aware Text Expansion
: Semantic Retrieval and Text Transformation Using Local Machine Learning Models

  • Tobias Link

    Student thesis: Master's Thesis

    Abstract

    Text expansion tools, which replace short abbreviations with predefined text, increas
    ingly add AI-powered features through cloud-based language models. For a tool that
    monitors the user’s keyboard input system-wide, transmitting that text to a remote ser
    vice raises serious privacy, regulatory, availability, and cost concerns. This thesis inves
    tigates whether locally executed Small Language Models and embedding-based retrieval
    can replicate the quality of these cloud features entirely on the user’s device.
    A prototype developed in collaboration with the text expansion vendor Ergonis
    Software realizes two capabilities: context-aware snippet retrieval using all-MiniLM-L6
    v2 sentence embeddings, and generative text transformation using quantized Qwen2.5
    and Phi-3.5 models executed on the CPU through llama.cpp. The system was evaluated
    along three axes—retrieval accuracy, generation quality, and latency—across six on
    device configurations and against GPT-4o as a cloud reference. Generation quality was
    assessed with an LLM-as-a-Judge procedure that was validated against human ratings.
    Retrieval placed the correct snippet within the top five results for every query at
    a median latency of about eleven milliseconds. The strongest on-device configuration
    trailed GPT-4o by roughly four percent on task adherence and matched or exceeded
    it on a third of the transformation actions, while keeping all data on the device. Local
    capability was found to follow the depth of reasoning a task requires rather than its
    surface category, with cross-lingual generation into a weakly supported language as the
    clearest limit. The results show that on-device processing is a viable and, for the privacy
    sensitive text expansion use case, preferable foundation for AI-powered features, with
    cloud inference reserved for a narrow set of tasks where it retains a clear advantage.
    Date of Award2026
    Original languageEnglish (American)
    Awarding Institution
    • FH OÖ
    SupervisorUlrich Bodenhofer (Supervisor)

    Studyprogram

    • Software Engineering

    Cite this

    '