Note: This README is available in English first, followed by the Polish version below.
LLMClient is an advanced, cross-platform AI client built with .NET MAUI that enables seamless interaction with leading language models (LLMs) like GPT and Gemini. The application is designed with security, performance, and flexibility in mind, offering local data storage with encryption and native text tokenization.
- Cross-Platform: Runs natively on Windows, Android, iOS, and macOS thanks to .NET MAUI.
- Multi-Model Support: Easy configuration and switching between models from OpenAI, Google (Gemini), and any OpenAI-compatible API providers.
- Local and Secure Data: All conversations are stored locally in an encrypted SQLite database (using SQLCipher), ensuring privacy.
- Efficient Tokenization: Uses a custom Rust library for fast and efficient tokenization, minimizing latency.
- Image Support: Ability to send multimodal queries (text + image) to models that support it (e.g., Gemini, GPT-4 Vision).
- AI Memory System: Intelligent memory system that automatically remembers user information and provides it in conversation context (30,000 character limit with automatic summarization).
- Automatic Memory Extraction: Advanced extraction of personal information from conversations using regular expressions and AI analysis.
- Semantic Search: Advanced search in conversation history using embedding vectors.
- Data Export: Easy export of conversations to JSON, Markdown, or TXT formats.
- Responsive Interface: Clean and modern user interface that adapts to different screen sizes.
- Framework: .NET 10 / .NET MAUI
- Languages: C#, XAML, Rust
- Architecture: MVVM (Model-View-ViewModel)
- AI & LLM:
- Microsoft.SemanticKernel
- OpenAI, Google Gemini, OpenAI-Compatible Models
- Database: SQLite with SQLCipher (encryption)
- Tokenization: Native Rust library with
tokenizers - Semantic Search: ONNX Runtime, Microsoft.ML.Tokenizers
- .NET 10 SDK
- Rust toolchain (for compiling the tokenizer library)
- Configured .NET MAUI environment (according to official documentation)
-
Clone the repository:
git clone https://github.com/DamianTarnowski/LLMClient.git cd LLMClient -
Build the Rust library:
cd TokenizerRust cargo build --releaseThis will place the
tokenizer_rust.dllfile (or equivalent for your system) in thetarget/releasefolder. The .NET MAUI project is configured to automatically copy this file during building. -
Open and run the .NET MAUI project:
- Open the
LLMClient.slnfile in Visual Studio 2022. - Select the target platform (e.g., Windows Machine, Android Emulator).
- Press F5 to build and run the application.
- Open the
- Launch the application.
- Go to the
Settingsscreen (gear icon). - Add a new model configuration by providing its name, provider (OpenAI, Gemini, etc.), API key, and model ID.
- Activate the model and start a new conversation!
LLMClient features an advanced memory system that automatically personalizes interactions with AI models:
-
Automatic Extraction: The system automatically extracts personal information from conversations (name, age, occupation, preferences, etc.) using:
- Regular expressions for basic information (name, age, location)
- AI analysis for more complex personal data
-
Context in Conversation: Each conversation receives full memory context (maximum 30,000 characters) in the system message, allowing models to provide personalized responses.
-
Intelligent Management: When memory exceeds the character limit:
- Most important and recent information remains in full form
- Older memories are automatically summarized by AI
- Maximum amount of useful information is preserved
-
Memory Management: An interface is available for viewing, editing, and categorizing saved memories.
- The app adapts to the language used by the user in each message.
- Language coverage depends on the selected model:
- Cloud models (OpenAI/Gemini/OpenAI‑compatible): broad multilingual support.
- Local model (Phi‑4‑mini‑instruct via ONNX): best in English/Polish; quality may drop in some languages.
- UI strings: English and Polish available (Polish resources included).
The system automatically recognizes and saves:
- Personal Data: Name, age, origin, occupation
- Preferences: Hobbies, interests, likes
- Life Facts: Family, education, experiences
- Conversation Context: Important topics and details from previous conversations
All memory data is:
- Stored locally in encrypted SQLite database
- Available only to the user on their device
- Not shared with external services
The project uses the MVVM pattern and is divided into the following layers:
LLMClient/: Main .NET MAUI project.Views/: XAML files defining the user interface.ViewModels/: Business logic and state for individual views.Models/: Data models (e.g.,Conversation,Message).Services/: Services responsible for key functionalities (e.g.,AiService,DatabaseService,EmbeddingService,MemoryContextService,MemoryExtractionService).
TokenizerRust/: Rust project containing tokenization logic, exposed as a native library.
- Local backend: ONNX Runtime GenAI (Phi‑4‑mini‑instruct) with streaming, unified chat template
- Safety layer:
SafeLocalModelWrapperwrapsILocalModelService, tracks failures, enforces cooldowns - Switchable engines:
RobustLocalModelService,LlamaSharpLocalModelServiceselectable viaEngineSettings - Diagnostics:
LocalModelDiagnosticServicewith periodic checks and persisted reports - Downloads:
NetworkAwareDownloadServicewith auto‑resume and connectivity awareness - UI flow:
MainPageViewModellistens toMessagingCenterevents (LocalModelLoaded/LocalModelUnloaded,ModelsChanged), locks cloud picker while local is active
See the project roadmap for planned enhancements: ROADMAP.md
LLMClient has comprehensive test coverage with 500+ automated tests covering all major functionality.
LLMClient.Tests/
├── Models/ (~163 unit tests)
│ ├── ModelsTests.cs - Conversation, Message, Memory, AiModel
│ ├── EdgeCaseTests.cs - Edge cases and boundary conditions
│ ├── RagTraceTests.cs - RAG tracing and timing
│ ├── ErrorReportTests.cs - Error reporting models
│ ├── EmbeddingModelTests.cs - Embedding model selection
│ ├── DocumentAnalysisTests.cs - Document analysis models
│ ├── EngineSettingsTests.cs - Engine configuration
│ └── ModelSettingsTests.cs - Model settings
├── Services/ (~41 tests)
│ ├── MockServiceTests.cs - Service mocks
│ └── ServiceInterfaceContractTests.cs - Interface contracts
└── Integration/ (~300 tests)
├── MemoryIntegrationTests.cs - Memory CRUD, search, context
├── EmbeddingIntegrationTests.cs - Embedding generation, similarity
├── RagIntegrationTests.cs - RAG document ingestion, retrieval
├── AdvancedRagTests.cs - Hybrid search, reranking
├── ConversationIntegrationTests.cs - Conversation and message handling
├── SearchIntegrationTests.cs - Message search, highlighting
├── LocalModelIntegrationTests.cs - Local model engine, streaming
├── RobustLocalModelTests.cs - Model state, download, memory
├── IngestionPipelineTests.cs - Document queue, processing
├── MemoryContextIntegrationTests.cs - Context generation, summarization
├── AiServiceIntegrationTests.cs - AI generation, summarization
├── EndToEndWorkflowTests.cs - Complete workflows
├── ErrorHandlingIntegrationTests.cs - Error scenarios, retry
├── CacheOptimizationTests.cs - Caching, batching, lazy loading
├── DocumentProcessingTests.cs - Chunking, analysis
├── LocalizationIntegrationTests.cs - Polish/English, formatting
├── SecurityIntegrationTests.cs - API keys, sanitization
├── ExportImportIntegrationTests.cs - Export, backup
├── OnboardingIntegrationTests.cs - First-run experience
├── ModelDownloadIntegrationTests.cs - Download progress, installation
├── ConcurrencyIntegrationTests.cs - Thread safety, rate limiting
├── PerformanceIntegrationTests.cs - Response time, throughput
└── OpenRouterIntegrationTests.cs - Real API integration tests
# Run all unit tests (excluding integration tests with real API)
dotnet test LLMClient.Tests --filter "Category!=Integration"
# Run all tests including integration tests
dotnet test LLMClient.Tests
# Run specific test category
dotnet test LLMClient.Tests --filter "FullyQualifiedName~Memory"| Area | Tests | Description |
|---|---|---|
| Models | 163 | Data models, enums, properties |
| Memory | 23 | Memory CRUD, search, context building |
| Embeddings | 20 | Generation, similarity, model selection |
| RAG | 28 | Document ingestion, retrieval, hybrid search |
| Conversations | 15 | CRUD, messages, pagination |
| Search | 12 | Highlighting, Polish chars, async |
| Local Models | 28 | State management, download, inference |
| AI Service | 20 | Generation, streaming, summarization |
| Error Handling | 15 | Network, database, retry logic |
| Performance | 13 | Response time, memory, throughput |
| Security | 17 | API keys, sanitization, validation |
| Localization | 12 | Polish/English, date/number formats |
| Export | 9 | JSON, Markdown, backup/restore |
Some tests require an OpenRouter API key stored at ~/.llmclient/openrouter_api_key.txt:
# Create the file with your API key
echo "sk-or-your-api-key" > ~/.llmclient/openrouter_api_key.txtThese tests verify real API behavior including streaming, system prompts, and error handling.
This project is licensed under the MIT license.
LLMClient to zaawansowany, wieloplatformowy klient AI, stworzony w .NET MAUI, który umożliwia płynną interakcję z wiodącymi modelami językowymi (LLM), takimi jak GPT i Gemini. Aplikacja została zaprojektowana z myślą o bezpieczeństwie, wydajności i elastyczności, oferując lokalne przechowywanie danych z szyfrowaniem oraz natywną tokenizację tekstu.
- Wieloplatformowość: Działa natywnie na systemach Windows, Android, iOS i macOS dzięki .NET MAUI.
- Obsługa Wielu Modeli: Łatwa konfiguracja i przełączanie się między modelami od OpenAI, Google (Gemini) oraz dowolnymi dostawcami kompatybilnymi z API OpenAI.
- Lokalne i Bezpieczne Dane: Wszystkie konwersacje są przechowywane lokalnie w zaszyfrowanej bazie danych SQLite (przy użyciu SQLCipher), co gwarantuje prywatność.
- Wydajna Tokenizacja: Wykorzystuje niestandardową bibliotekę napisaną w Rust do szybkiej i efektywnej tokenizacji, minimalizując opóźnienia.
- Obsługa Obrazów: Możliwość wysyłania zapytań multimodalnych (tekst + obraz) do modeli, które to wspierają (np. Gemini, GPT-4 Vision).
- System Pamięci AI: Inteligentny system pamięci, który automatycznie zapamiętuje informacje o użytkowniku i dostarcza je w kontekście konwersacji (limit 30,000 znaków z automatycznym streszczaniem).
- Automatyczna Ekstraktacja Pamięci: Zaawansowane wydobywanie informacji osobistych z konwersacji przy użyciu wyrażeń regularnych i analizy AI.
- Wyszukiwanie Semantyczne: Zaawansowane wyszukiwanie w historii konwersacji z wykorzystaniem wektorów osadzeń (embeddings).
- Eksport Danych: Łatwe eksportowanie konwersacji do formatów JSON, Markdown lub TXT.
- Responsywny Interfejs: Czysty i nowoczesny interfejs użytkownika, który dostosowuje się do różnych rozmiarów ekranu.
- Framework: .NET 10 / .NET MAUI
- Języki: C#, XAML, Rust
- Architektura: MVVM (Model-View-ViewModel)
- AI & LLM:
- Microsoft.SemanticKernel
- OpenAI, Google Gemini, Modele OpenAI-Compatible
- Baza Danych: SQLite z SQLCipher (szyfrowanie)
- Tokenizacja: Natywna biblioteka w Rust z
tokenizers - Wyszukiwanie Semantyczne: ONNX Runtime, Microsoft.ML.Tokenizers
- .NET 10 SDK
- Rust toolchain (do kompilacji biblioteki tokenizera)
- Skonfigurowane środowisko dla .NET MAUI (zgodnie z oficjalną dokumentacją)
-
Sklonuj repozytorium:
git clone https://github.com/DamianTarnowski/LLMClient.git cd LLMClient -
Zbuduj bibliotekę Rust:
cd TokenizerRust cargo build --releaseSpowoduje to umieszczenie pliku
tokenizer_rust.dll(lub odpowiednika dla Twojego systemu) w folderzetarget/release. Projekt .NET MAUI jest skonfigurowany, aby automatycznie kopiować ten plik podczas budowania. -
Otwórz i uruchom projekt .NET MAUI:
- Otwórz plik
LLMClient.slnw programie Visual Studio 2022. - Wybierz platformę docelową (np. Windows Machine, Android Emulator).
- Naciśnij F5, aby zbudować i uruchomić aplikację.
- Otwórz plik
- Uruchom aplikację.
- Przejdź do ekranu
Ustawienia(ikona koła zębatego). - Dodaj nową konfigurację modelu, podając jego nazwę, dostawcę (OpenAI, Gemini, etc.), klucz API oraz ID modelu.
- Aktywuj model i rozpocznij nową konwersację!
LLMClient posiada zaawansowany system pamięci, który automatycznie personalizuje interakcje z modelami AI:
-
Automatyczna Ekstraktacja: System automatycznie wydobywa informacje osobiste z konwersacji (imię, wiek, zawód, preferencje, itp.) przy użyciu:
- Wyrażeń regularnych dla podstawowych informacji (imię, wiek, lokalizacja)
- Analizy AI dla bardziej złożonych danych osobowych
-
Kontekst w Konwersacji: Każda konwersacja otrzymuje pełny kontekst pamięci (maksymalnie 30,000 znaków) w wiadomości systemowej, pozwalając modelom na spersonalizowane odpowiedzi.
-
Inteligentne Zarządzanie: Gdy pamięć przekroczy limit znaków:
- Najważniejsze i najnowsze informacje pozostają w pełnej formie
- Starsze wspomnienia są automatycznie streszczane przez AI
- Zachowana zostaje maksymalna ilość przydatnych informacji
-
Zarządzanie Pamięcią: Dostępny jest interfejs do przeglądania, edycji i kategoryzowania zapisanych wspomnień.
- Aplikacja dostosowuje język odpowiedzi do języka wiadomości użytkownika.
- Zakres języków zależy od wybranego modelu:
- Modele chmurowe (OpenAI/Gemini/OpenAI‑compatible): szeroka obsługa wielu języków.
- Model lokalny (Phi‑4‑mini‑instruct przez ONNX): najlepsza jakość EN/PL; jakość w innych językach może być niższa.
- UI: dostępne zasoby PL i EN (w zestawie są zasoby PL).
System automatycznie rozpoznaje i zapisuje:
- Dane osobowe: Imię, wiek, pochodzenie, zawód
- Preferencje: Hobby, zainteresowania, upodobania
- Fakty życiowe: Rodzina, wykształcenie, doświadczenia
- Kontekst rozmów: Ważne tematy i szczegóły z poprzednich konwersacji
Wszystkie dane pamięci są:
- Przechowywane lokalnie w zaszyfrowanej bazie SQLite
- Dostępne tylko dla użytkownika na jego urządzeniu
- Nieudostępniane zewnętrznym usługom
Projekt wykorzystuje wzorzec MVVM i jest podzielony na następujące warstwy:
LLMClient/: Główny projekt .NET MAUI.Views/: Pliki XAML definiujące interfejs użytkownika.ViewModels/: Logika biznesowa i stan dla poszczególnych widoków.Models/: Modele danych (np.Conversation,Message).Services/: Serwisy odpowiedzialne za kluczowe funkcjonalności (np.AiService,DatabaseService,EmbeddingService,MemoryContextService,MemoryExtractionService).
TokenizerRust/: Projekt Rust zawierający logikę tokenizacji, udostępnioną jako natywna biblioteka.
- Backend lokalny: ONNX Runtime GenAI (Phi‑4‑mini‑instruct) ze strumieniowaniem i ujednoliconym szablonem czatu
- Warstwa bezpieczeństwa:
SafeLocalModelWrapperopakowujeILocalModelService, śledzi błędy i wymusza cooldown - Przełączalne silniki:
RobustLocalModelService,LlamaSharpLocalModelServicewybierane przezEngineSettings - Diagnostyka:
LocalModelDiagnosticServicez okresowymi checkami i zapisem raportów - Pobieranie:
NetworkAwareDownloadServicez auto‑wznawianiem i świadomością łączności - Przepływ UI:
MainPageViewModelsubskrybuje zdarzeniaMessagingCenter(LocalModelLoaded/LocalModelUnloaded,ModelsChanged), blokuje wybór chmury gdy lokalny jest aktywny
Planowane ulepszenia znajdziesz tutaj: ROADMAP.md
LLMClient posiada kompleksowe pokrycie testami z ponad 500 automatycznymi testami obejmującymi wszystkie główne funkcjonalności.
LLMClient.Tests/
├── Models/ (~163 testy jednostkowe)
│ ├── ModelsTests.cs - Conversation, Message, Memory, AiModel
│ ├── EdgeCaseTests.cs - Przypadki brzegowe
│ ├── RagTraceTests.cs - Śledzenie RAG i timing
│ ├── ErrorReportTests.cs - Modele raportowania błędów
│ ├── EmbeddingModelTests.cs - Wybór modelu embeddingowego
│ ├── DocumentAnalysisTests.cs - Modele analizy dokumentów
│ ├── EngineSettingsTests.cs - Konfiguracja silnika
│ └── ModelSettingsTests.cs - Ustawienia modelu
├── Services/ (~41 testów)
│ ├── MockServiceTests.cs - Mocki serwisów
│ └── ServiceInterfaceContractTests.cs - Kontrakty interfejsów
└── Integration/ (~300 testów)
├── MemoryIntegrationTests.cs - Pamięć CRUD, wyszukiwanie
├── EmbeddingIntegrationTests.cs - Generowanie embeddingów
├── RagIntegrationTests.cs - Ingestion dokumentów RAG
├── AdvancedRagTests.cs - Hybrid search, reranking
├── ConversationIntegrationTests.cs - Obsługa konwersacji
├── SearchIntegrationTests.cs - Wyszukiwanie, highlighting
├── LocalModelIntegrationTests.cs - Silnik modeli lokalnych
├── RobustLocalModelTests.cs - Stan modelu, pobieranie
├── IngestionPipelineTests.cs - Kolejka dokumentów
├── MemoryContextIntegrationTests.cs - Generowanie kontekstu
├── AiServiceIntegrationTests.cs - Generowanie AI
├── EndToEndWorkflowTests.cs - Kompletne workflow
├── ErrorHandlingIntegrationTests.cs - Obsługa błędów
├── CacheOptimizationTests.cs - Cache, batching
├── DocumentProcessingTests.cs - Chunking, analiza
├── LocalizationIntegrationTests.cs - PL/EN, formatowanie
├── SecurityIntegrationTests.cs - API keys, sanityzacja
├── ExportImportIntegrationTests.cs - Eksport, backup
├── OnboardingIntegrationTests.cs - Pierwsze uruchomienie
├── ModelDownloadIntegrationTests.cs - Pobieranie modeli
├── ConcurrencyIntegrationTests.cs - Bezpieczeństwo wątków
├── PerformanceIntegrationTests.cs - Wydajność
└── OpenRouterIntegrationTests.cs - Testy z prawdziwym API
# Uruchom testy jednostkowe (bez testów API)
dotnet test LLMClient.Tests --filter "Category!=Integration"
# Uruchom wszystkie testy
dotnet test LLMClient.Tests
# Uruchom konkretną kategorię
dotnet test LLMClient.Tests --filter "FullyQualifiedName~Memory"| Obszar | Testy | Opis |
|---|---|---|
| Modele | 163 | Modele danych, enumy, właściwości |
| Pamięć | 23 | CRUD, wyszukiwanie, budowanie kontekstu |
| Embeddingi | 20 | Generowanie, podobieństwo, wybór modelu |
| RAG | 28 | Ingestion, retrieval, hybrid search |
| Konwersacje | 15 | CRUD, wiadomości, paginacja |
| Wyszukiwanie | 12 | Highlighting, polskie znaki |
| Modele lokalne | 28 | Zarządzanie stanem, pobieranie |
| AI Service | 20 | Generowanie, streaming |
| Błędy | 15 | Sieć, baza danych, retry |
| Wydajność | 13 | Czas odpowiedzi, pamięć |
| Bezpieczeństwo | 17 | API keys, sanityzacja |
| Lokalizacja | 12 | PL/EN, formaty dat/liczb |
| Eksport | 9 | JSON, Markdown, backup |
Niektóre testy wymagają klucza API OpenRouter w ~/.llmclient/openrouter_api_key.txt:
# Utwórz plik z kluczem API
echo "sk-or-your-api-key" > ~/.llmclient/openrouter_api_key.txtTen projekt jest udostępniany na licencji MIT.
LLMClient offers two embedding models for semantic search and RAG (Retrieval-Augmented Generation):
| Model | Quality | Speed | Size | Min RAM | Best For |
|---|---|---|---|---|---|
| E5-Large Multilingual | 🎯 95% | 60% | ~2.2GB | 8GB | Desktop, high-quality search |
| Gemma 300M | 🚀 75% | 90% | ~1.2GB | 4GB | Mobile, resource-constrained devices |
The app automatically selects the best model based on device RAM:
- ≥8GB RAM → E5-Large (higher quality for Polish/multilingual)
- <8GB RAM → Gemma 300M (faster, lighter)
Users can override this in Settings → Embedding Model.
Tests performed on Polish language pairs comparing semantic similarity scores:
| Pair | E5-Large | Gemma 300M | Δ |
|---|---|---|---|
| "Lubię programować" ↔ "Uwielbiam kodować" | 0.936 | 0.840 | +11% |
| "Kot śpi" ↔ "Kotek drzemie" | 0.944 | 0.614 | +54% |
| "Auto jedzie" ↔ "Samochód pędzi" | 0.952 | 0.682 | +40% |
| Average | 0.944 | 0.712 | +33% |
| Pair | E5-Large | Gemma 300M | Δ |
|---|---|---|---|
| "Lubię programować" ↔ "Pierogi są pyszne" | 0.829 | 0.441 | -47% |
| "Kot śpi" ↔ "Samolot leci" | 0.833 | 0.440 | -47% |
| "Auto jedzie" ↔ "Książka leży" | 0.788 | 0.393 | -50% |
| Average | 0.817 | 0.425 | -48% |
| Pair | E5-Large | Gemma 300M |
|---|---|---|
| PL: "Lubię programować" ↔ EN: "I like programming" | 0.966 | 0.701 |
| PL: "Kot jest zwierzęciem" ↔ EN: "A cat is an animal" | 0.920 | 0.794 |
| Average | 0.943 | 0.748 |
-
E5-Large excels at Polish semantic similarity - 33% higher scores for similar sentences, making it ideal for precise semantic search in Polish documents.
-
Gemma better discriminates unrelated content - 48% lower scores for different sentences means fewer false positives in search results.
-
E5-Large superior for cross-lingual - Critical for applications mixing Polish and English content.
-
Trade-off: E5-Large requires 2x more RAM but provides significantly better quality for Polish language semantic search. For mobile devices with <8GB RAM, Gemma offers acceptable quality with much better performance.
Both models use native Rust tokenizers for optimal performance:
- E5-Large: HuggingFace tokenizers (BPE)
- Gemma: Kitoken with SentencePiece fallback (Unigram)
- Local ONNX Runtime GenAI (Phi‑4‑mini‑instruct) with streaming, unified chat template, and safety controls
- Editable system prompt stored in DB; if empty, no system message is injected
- Optional memory injection (cloud models only) controlled by a toggle in Settings
- Memory extraction disabled while a local model is active (reduces noise and hallucinations)
- Adaptive language: the assistant answers in the same language as the user
- Automatic conversation creation when none is active (Android/mobile friendly)
- Cloud model picker automatically locks while a local model is loaded; unlocks after unload
- Spinner overlay both for downloading and for loading the local model into RAM
How to use the local model
- Settings → Local model → Download (if needed)
- Load model → overlay spinner shows during load
- Local model becomes active; cloud picker is disabled
- Unload to return to cloud models
LLMClient oferuje dwa modele embeddingowe do wyszukiwania semantycznego i RAG:
| Model | Jakość | Szybkość | Rozmiar | Min RAM | Najlepszy dla |
|---|---|---|---|---|---|
| E5-Large Multilingual | 🎯 95% | 60% | ~2.2GB | 8GB | Desktop, wysokiej jakości wyszukiwanie |
| Gemma 300M | 🚀 75% | 90% | ~1.2GB | 4GB | Mobile, urządzenia z ograniczeniami |
Aplikacja automatycznie wybiera najlepszy model na podstawie RAM urządzenia:
- ≥8GB RAM → E5-Large (wyższa jakość dla polskiego)
- <8GB RAM → Gemma 300M (szybszy, lżejszy)
Użytkownik może to zmienić w Ustawieniach → Model Embeddingowy.
Testy przeprowadzone na polskich parach zdań porównujące wyniki podobieństwa semantycznego:
| Para | E5-Large | Gemma 300M | Δ |
|---|---|---|---|
| "Lubię programować" ↔ "Uwielbiam kodować" | 0.936 | 0.840 | +11% |
| "Kot śpi" ↔ "Kotek drzemie" | 0.944 | 0.614 | +54% |
| "Auto jedzie" ↔ "Samochód pędzi" | 0.952 | 0.682 | +40% |
| Średnia | 0.944 | 0.712 | +33% |
| Para | E5-Large | Gemma 300M | Δ |
|---|---|---|---|
| "Lubię programować" ↔ "Pierogi są pyszne" | 0.829 | 0.441 | -47% |
| "Kot śpi" ↔ "Samolot leci" | 0.833 | 0.440 | -47% |
| "Auto jedzie" ↔ "Książka leży" | 0.788 | 0.393 | -50% |
| Średnia | 0.817 | 0.425 | -48% |
| Para | E5-Large | Gemma 300M |
|---|---|---|
| PL: "Lubię programować" ↔ EN: "I like programming" | 0.966 | 0.701 |
| PL: "Kot jest zwierzęciem" ↔ EN: "A cat is an animal" | 0.920 | 0.794 |
| Średnia | 0.943 | 0.748 |
-
E5-Large doskonały dla polskiego podobieństwa semantycznego - 33% wyższe wyniki dla podobnych zdań, idealny do precyzyjnego wyszukiwania semantycznego w polskich dokumentach.
-
Gemma lepiej rozróżnia niepowiązane treści - 48% niższe wyniki dla różnych zdań oznacza mniej fałszywych trafień w wynikach wyszukiwania.
-
E5-Large przewyższa w cross-lingual - Krytyczne dla aplikacji mieszających polskie i angielskie treści.
-
Kompromis: E5-Large wymaga 2x więcej RAM, ale zapewnia znacznie lepszą jakość dla polskiego wyszukiwania semantycznego. Dla urządzeń mobilnych z <8GB RAM, Gemma oferuje akceptowalną jakość przy znacznie lepszej wydajności.
Oba modele używają natywnych tokenizerów Rust dla optymalnej wydajności:
- E5-Large: HuggingFace tokenizers (BPE)
- Gemma: Kitoken z fallbackiem SentencePiece (Unigram)
- Lokalny ONNX Runtime GenAI (Phi‑4‑mini‑instruct) ze strumieniowaniem, ujednoliconym szablonem czatu i kontrolą bezpieczeństwa
- Edytowalny system prompt zapisywany w bazie; jeśli pusty, nie wstrzykujemy system message
- Opcjonalne dołączanie pamięci (tylko dla modeli chmurowych) sterowane przełącznikiem w Ustawieniach
- Ekstrakcja pamięci wyłączona, gdy aktywny jest model lokalny (mniej szumu/halucynacji)
- Adaptacyjny język: asystent odpowiada w tym samym języku, w którym pisze użytkownik
- Automatyczne tworzenie konwersacji, gdy nie ma aktywnej (wygodne na Androidzie)
- Blokada wyboru modeli chmurowych, gdy lokalny model jest załadowany; odblokowanie po rozładowaniu
- Overlay ze spinnerem zarówno podczas pobierania, jak i ładowania modelu lokalnego do RAM
Jak korzystać z modelu lokalnego
- Ustawienia → Model lokalny → Pobierz (jeśli potrzeba)
- Załaduj model → w trakcie ładowania widoczny overlay ze spinnerem
- Model lokalny staje się aktywny; wybór modeli chmurowych jest zablokowany
- Rozładuj, aby wrócić do modeli chmurowych