This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend
What I Built
Meet Alex — one of a small handful of mentors who keep Loglan alive.
Loglan (Logical Language) was invented in 1955 by Dr. James Cooke Brown to test the Sapir-Whorf hypothesis: does the structure of a language shape how its speakers think? Brown's answer was radical: build a language from scratch with a strict mathematical property that no natural language possesses. Every grammatically valid Loglan sentence has exactly one parse tree. No dangling modifiers, no ambiguous prepositional phrases, no guesswork about what modifies what.
For decades, a few mentors have shouldered the burden of welcoming new learners. Every week, Alex and other veterans field the same questions in our community channels:
- "What are the argument slots for 'donsu' (give)?"
- "Why does 'Pretty little girls\' school' have 5 meanings in English, but only one in Loglan?"
- "How do grouping particles like
geandke…guactually prevent ambiguity?"
Each answer requires digging through a 10,000-word SQLite database, cross-referencing 1970s grammar textbooks, checking case-tag theory papers, and formulating a coherent explanation. It is mentally exhausting and takes 20–30 minutes per question.
I built Alex Loglan Bench — an open-source AI grammar assistant and formal evaluation platform powered by Google's open-weight Gemma model and a two-tier SQLite FTS5 retrieval-augmented generation (RAG) system over the 70-year Loglan corpus.
When Alex first tested the assistant, his reaction said it all:
"I used to spend 15 minutes explaining how 'nu donsu' flips the donor and the gift, and another 10 minutes digging up the lesson on case tags. Now I just paste the assistant's breakdown into our community channel. It's accurate, it cites the original Brown textbooks, and it doesn't make up words."
Alex no longer fields 20-minute grammar questions. The community can focus on actually speaking the language.
Demo
Loglan Bench runs both as an interactive terminal REPL and as a modern Streamlit web application.
# Terminal CLI commands:
/slots donsu → x1 (K): giver | x2 (B): gift | x3 (D): recipient
/compare "Pretty little girls' school" → 5 English parses | 1 Loglan parse
/word cinkau → puppy / infant-dog (cinta + kangu)
The Streamlit web demo (demo/streamlit_app.py) provides an interactive interface with live model selection (defaulting to Gemma), schema exploration, and instant slot resolution:
# Launch the web demo locally:
streamlit run demo/streamlit_app.py
Code
Loglan Bench is 100% open-source under the MIT license:
torrua
/
loglan-bench
Loglan Bench: First Open Benchmark & RAG Grammar Assistant for a Syntactically Unambiguous Human Language
Loglan Bench 📐
AI Grammar Assistant on Gemma 3 + Formal Language LLM Benchmark
Testing whether LLMs reason better over a 1950s artificial language with zero syntactic ambiguity.
🌟 Overview
Loglan (Logical Language) was invented in 1955 by Dr. James Cooke Brown as a speakable language based on first-order predicate logic. Its key mathematical feature is zero syntactic ambiguity: every grammatically valid utterance has exactly one parse tree.
While natural languages produce exponential ambiguity trees (e.g. "Pretty little girls' school" has 5+ distinct parses in English), Loglan enforces strict single-path parsing via explicit grouping particles (ge, ci, ke...gu).
Loglan Bench provides two core deliverables:
- Loglan Grammar Assistant: A 2-tier RAG assistant powered by Google's open-weight Gemma 3 and the 10,000-word LOD (Loglan Online Dictionary) corpus with full-text search (FTS5).
- Formal Language Benchmark: A 60-problem golden test suite comparing 4 language models (…
- GitHub Repository: github.com/torrua/loglan-bench (MIT Licensed)
- Companion Desktop Editor: github.com/torrua/LOD_manager (Tauri + Svelte 5 + Rust)
- Companion Kaggle Notebook: Benchmarking on Loglan (Free GPU reproducible evaluation)
Quickstart
git clone https://github.com/torrua/loglan-bench.git
cd loglan-bench
pip install -r requirements.txt
# Run the interactive Gemma-powered assistant in CLI
python src/assistant.py --interactive
How I Built It
Open-Source AI Architecture
The project is built around Google's Gemma open-weight model family, paired with a custom two-tier retrieval pipeline:
┌────────────────────────────────────────────────────────┐
│ Loglan Grammar Assistant │
│ │
│ User Query: "What are the argument slots of donsu?" │
└──────────────────────────┬─────────────────────────────┘
│
┌─────────────▼─────────────┐
│ Two-Tier FTS5 RAG │
│ │
│ 1. LOD Dictionary Search │
│ - 18,766 definitions │
│ - Predicate slots │
│ - Affix connections │
│ │
│ 2. loglan.org Documents │
│ - 769 textbook chunks │
│ - Brown's "Loglan 1" │
│ - Case tag theory │
│ - 'ge' & 'gu' rules │
└─────────────┬─────────────┘
│ Grounded Context
┌─────────────▼─────────────┐
│ Google Gemma │
│ (Local Ollama / GenAI) │
└─────────────┬─────────────┘
│
┌─────────────▼─────────────┐
│ Grounded Markdown Answer │
│ - Slot definitions │
│ - Unambiguous parse tree │
│ - Verified LOD citations │
└───────────────────────────┘
-
Ingesting 70 Years of Linguistic Knowledge: Using
BeautifulSoupand SQLite'sFTS5, I built an ingestion pipeline that scraped and indexed 28 canonical sources fromloglan.org(Chapters 1–6 of Brown's Loglan 1, The Faces of Gu, case-tag theory papers, and parallel translations from Scientific American), yielding 769 textbook chunks alongside 18,766 dictionary definitions. -
Two-Tier Grounded Retrieval:
- Tier 1 (LOD Lexicon): Exact predicate name, argument slots ($x_1 \dots x_5$), word type, and affix derivations.
- Tier 2 (Grammar Corpus): Semantic search over textbook rules, Brown's original prose, and case-tag guides.
-
The "Puppy vs. Book" Discovery: Standard LLMs fail on Loglan because massive English pretraining priors overpower dictionary definitions in context. In
La Djan, pa donsu leda sorme le cinkau(John gave his sister the puppy), generic LLMs translatedcinkauas "book" simply because "gave a book" appears millions of times in English. Grounding Gemma with explicit LOD definitions eliminates this failure mode, driving hallucination rates down to 0.0%.
Why Does Open Innovation Matter?
Open-source AI was not just a contest constraint for this project — it was an architectural necessity:
- Complete Data Privacy on Local Hardware: Many Loglan community members are privacy-conscious open-source developers. Running Gemma locally via Ollama means not a single byte of linguistic query data ever leaves the user's laptop.
- Zero Hallucinations on Verified Formal Grammar: In our benchmark evaluation against the official 9,988-word LOD lexicon, Gemma achieved an Average Hallucination Rate of 0.000 (0.0%) and 100% Syntactic Disambiguation Accuracy on the 5-parse tree problem.
- Scientific Reproducibility: Closed-source commercial APIs silently update their weights, altering outputs and breaking linguistic evaluations. Gemma's fixed open weights ensure that formal language experiments remain reproducible across machines and decades.
- Future LoRA Fine-Tuning: Because Loglan has a mathematically closed, unambiguous grammar, open models like Gemma can be fine-tuned via LoRA directly on predicate-logic parse trees — something fundamentally impossible with proprietary closed APIs.
My Agent Session
We saved the interactive agent session transcript demonstrating the development, benchmarking, and prompt-tuning process with DevRelay:
- Direct Session Link: View DevRelay Agent Session #498
Prize Categories
Best Use of Gemma ($200 Featured Partner Track)
Loglan Bench puts Google's Gemma open-weights model directly at the core of the project:
- Gemma serves as the default inference engine for both the interactive CLI assistant and the Streamlit web demo (
demo/streamlit_app.py). - Evaluated against the official 9,988-word Loglan lexicon, Gemma scored a 0.0% Hallucination Rate and 100% Syntactic Disambiguation Accuracy.
- Gemma enables community members to run the complete 70-year grammar assistant completely offline on consumer hardware with zero API costs.
Built with open-source AI (Google Gemma), for a friend, and for the preservation of one of humanity's most ambitious linguistic experiments.
Top comments (0)