<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ProfOnAI]]></title><description><![CDATA[Essays on AI, large language models and NLP for low-resource languages, especially Albanian. Written by Ercan Canhasi, Professor of Computer Science at the Univ]]></description><link>https://profonai.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 08:33:13 GMT</lastBuildDate><atom:link href="https://profonai.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Why AI Hallucinations Are Worse Than Lies: Frankfurt’s Theory of Bullshit and the LLM]]></title><description><![CDATA[While browsing through some of my older books recently, I came across the slim, provocative volume of On Bullshit by Harry Frankfurt. Frankly, in some…]]></description><link>https://profonai.hashnode.dev/why-ai-hallucinations-are-worse-than-lies-frankfurt-s-theory-of-bullshit-and-the-llm</link><guid isPermaLink="true">https://profonai.hashnode.dev/why-ai-hallucinations-are-worse-than-lies-frankfurt-s-theory-of-bullshit-and-the-llm</guid><category><![CDATA[llm]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Philosophy]]></category><dc:creator><![CDATA[Ercan Canhasi]]></dc:creator><pubDate>Tue, 17 Nov 2026 22:55:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afcd64ceabc6e7573e04a24/408e68ff-840a-407d-8d19-54e95b8f3cea.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>While browsing through some of my older books recently, I came across the slim, provocative volume of On Bullshit by Harry Frankfurt. Frankly, in some mysterious way, this slim book attracted me to itself. I decided to review the marginalia and notes I took many years ago on the margins of the book. What hugely surprised me was the great similarity between Frankfurt’s central thesis and the very modern problem of LLM hallucinations. The intersection of this classical philosophical analysis with the technical failures of contemporary AI was too interesting to ignore. So I decided to write this article connecting the two fields.</p>
<p>Frankfurt’s essay, first published in 1986 and later released as the globally recognized short book On Bullshit, became a cultural phenomenon precisely because it identified a ubiquitous but unexamined problem in modern discourse. The essay is a rigorous attempt at analytical definition. Frankfurt’s core task was to establish the precise meaning of bullshit to differentiate it from lying (Frankfurt, 2005). He argues that the true menace of bullshit stems from the speaker’s profound lack of concern for the truth, distinguishing it sharply from the liar who, by necessity, respects the truth enough to try and hide it. This subtle but devastating distinction provides the exact philosophical framework required to assess the output of modern AI.</p>
<p>In our modern digital world, we are forced to confront an existential question regarding knowledge itself. The Large Language Models (LLMs), the sophisticated engines behind tools like GPT and Gemini, process petabytes of text and yet routinely present confidently stated, but entirely fabricated information. This phenomenon, often defensively categorized as “hallucination,” is far more than a simple technical glitch or a retrieval error.</p>
<p>When these artificial intelligences generate a meticulously detailed but specious legal precedent or an utterly wrong historical attribution, we are witnessing the natural product of a machine built for persuasive coherence, not factual constraint. To grasp the gravity of this digital indifference, we must turn our gaze back to the philosophical groundwork laid by Harry G. Frankfurt in his essential work, On Bullshit.</p>
<p>Frankfurt provides a profound tool for dismantling this problem through his analytical distinction between the liar and the bullshitter. This differentiation is rooted in the speaker’s epistemic commitment, or lack thereof, to the facts of the matter.</p>
<p>The liar is intrinsically bound to the truth. They must know what the truth is to effectively conceal it, misrepresent it, or guide their audience away from it. The lie is thus fundamentally anchored in reality; its power is dependent upon its opposition to a known fact.</p>
<p>The bullshitter, conversely, is characterized by a radical indifference to the truth. They are not concerned with whether their statements are true or false, but solely with how their discourse serves a specific, non-truth-related purpose. By doing this, they try to impress, to signal allegiance, or simply to satisfy the demand to speak. While the technical focus of this article is more on AI, it is impossible to discuss the bullshitter’s “lack of concern for the truth” without briefly acknowledging its modern sociopolitical application (Frankfurt, 2005).</p>
<p>An Unavoidable Parallel: Bullshit and Populism</p>
<p>Populist political rhetoric, across the ideological spectrum, often exemplifies this indifference. When a leader consistently prioritizes emotional situation and audience satisfaction over factual fidelity, they are engaging in rhetoric that is fundamentally unconcerned with “how things really are.” The content is not necessarily a calculated lie but rather a performance crafted for maximum plausibility and effect, echoing the LLM’s goal of generating linguistically fluent output.</p>
<p>Side note: My next article could be about extensive usage of LLMs for political bullshitting: case study of R. Kosov*(a/o)!!!</p>
<p>This parallel is crucial because the danger is the same: the constant production of high-volume, emotionally resonant, yet factually empty claims saturates the discourse. This systemic degradation of truth as a standard is what connects the philosophical issue of political rhetoric directly to the automated indifference of the LLM, making the core Frankfurtian critique universally relevant to our information ecosystem.</p>
<p>This philosophical indifference finds its perfect operational mirror in the contemporary transformer architecture of Large Language Models.</p>
<p>There is an ongoing and rigorous debate in the AI community regarding emergent abilities and the extent to which LLMs form internal “world models” through training. Nevertheless, it is crucial to analyze the technology through the lens of its objective function. The LLM is, at its foundation, an immensely scaled, high-dimensional system optimized for language generation. Modern production models undergo rigorous fine-tuning through methods like Reinforcement Learning from Human Feedback (RLHF). These methods successfully align the model to complex human preferences for safety, helpfulness, and style, and this alignment addresses how the model behaves, not its epistemic commitment to reality. Its underlying computational directive remains one of maximizing a reward signal, whether that is predicting the next token in pre-training, or maximizing the human preference score in fine-tuning. Its primary goal is still to generate the most statistically coherent and plausible sequence of words. This process is driven by optimization for stylistic fluency and coherence, not factual constraint. Factual verification is not an intrinsic part of its generative loop, regardless of any latent structural knowledge it may acquire.</p>
<p>Consequently, when an LLM hallucinates, it is not an act of deception, nor is it necessarily a failure to “understand” in a human sense. It is more of an act of flawless technical execution of its programming. The model, lacking any internal epistemic module or explicit mechanism for real-world factual grounding, is simply succeeding at its primary function: outputting highly plausible text, even when that text utterly lacks an anchor in verifiable reality. The entire machine architecture is built around the ideal of seamless, persuasive language, operating with absolute unconcern for factual constraints. The LLM is, therefore, the ultimate, most sophisticated artificial bullshitter.</p>
<p>Within the technical community, the term “hallucination” is itself a generalization for several distinct failure modes, each stemming from the probabilistic nature of the LLM. We can categorize these failures broadly as Intrinsic and Extrinsic hallucinations.</p>
<p>Intrinsic Hallucinations occur when the generated output directly contradicts the information present in the source documents or the training corpus. These are deep, internal conflicts arising from the model’s compromised “memory” during the token sampling process. They reflect an instability in the attentional mechanism or a localized “memory corruption” within the high dimensional latent space (Ho et al., 2024).</p>
<p>Extrinsic Hallucinations, conversely, generate facts that are simply unverifiable or inconsistent with reality, specifically due to the model’s knowledge cutoff. The model, when asked about a recent event, defaults to confabulation based on its pre-trained statistical weightings, as its fundamental inability to state “I don’t know” overrides its lack of up-to-date factual grounding.</p>
<p>Current industry attempts to mitigate this, such as Retriever Augmented Generation (RAG), are effectively external human interventions designed to impose a form of truth-telling discipline. RAG forces the model to condition its output on a set of verified, retrieved documents, transforming the task from pure generation to contextual summarization. When RAG fails, the model exhibits context window saturation or simply disregards the retrieved truth to revert to its intrinsic, ungrounded probabilistic style-it chooses its own fluent bullshit over the restrictive constraint of fact.</p>
<p>Frankfurt makes the compelling argument that bullshit is a greater enemy of the truth than lies are. While the liar implicitly respects the value of truth by acknowledging its existence, the bullshitter disregards it completely, thereby degrading the cultural practice of attending to the facts.</p>
<p>The Plausibility Trap means that LLM generated fictions are dangerous not because they are false, since we are accustomed to human falsehoods. It is mainly dangerous because the confident, authoritative, and linguistically sophisticated manner in which they are presented. This makes them almost impossible to distinguish from rigorously researched information. The consequences of this trap are no longer theoretical; they are leading to direct professional liability. Consider the famous case where lawyers faced court sanctions for submitting legal briefs citing wholly fabricated case law generated by a large language model (The Washington Post, 2023). This liability was further underscored when Deloitte Australia was compelled to issue a partial $290,000 refund to the Australian government for a professional report that contained fabricated academic citations and non-existent court references (Fortune, 2025). Similarly, the ruling against Air Canada for its chatbot citing a non-existent refund policy demonstrates that corporate responsibility extends directly to the machine’s output, proving that automated indifference is now actionable negligence (Evidently AI, 2024).</p>
<p>The philosophical scrutiny of Frankfurt reveals that the core issue with generative AI is neither malicious intent nor cognitive failure, but an engineered epistemological void. We have successfully built the perfect engine of indifference. The LLM, by design, seeks only the most fluent linguistic path, making it structurally incapable of violating its own mandate of probabilistic coherence, regardless of the output’s correspondence to reality.</p>
<p>This realization forces three fundamental conclusions for the field of computer science and digital ethics:</p>
<p>First, we must recalibrate our performance metrics. The industry must shift the focus from metrics based on linguistic sophistication (like perplexity scores or fluency assessments) to those centered on referential integrity and verifiable traceability. Success in AI should be redefined by factual fidelity, not merely plausible language generation.</p>
<p>Second, the reliance on external interventions like RAG must be seen as a necessary but ultimately insufficient patch. True progress requires integrating intrinsic truth constraints directly into the objective function during the large-scale pre-training process. We must engineer a digital equivalent of an epistemic module, an architectural feature that penalizes not just grammatical error, but factual unaccountability.</p>
<p>Third, the burden of critical reception now exponentially increases for the human user. As the volume of high fidelity bullshit accelerates, our collective ability to maintain a connection to empirical reality becomes a defining trait of intellectual survival. The Frankfurtian critique demands not just technical solutions, but a widespread cultural commitment to the disciplined pursuit of what is true, regardless of how beautifully the alternative is articulated. The ultimate defense against automated indifference must be renewed human vigilance.</p>
<p>Alhena AI. (2023). What Are LLM Hallucinations — Examples and Causes (Discussing the false accusation case).</p>
<p>Evidently AI. (2024). LLM hallucinations and failures: lessons from 5 examples (Citing Air Canada case and fabricated legal citations).</p>
<p>Fortune. (2025). Deloitte was caught using AI in $290,000 report to help the Australian government crack down on welfare after a researcher flagged hallucinations.</p>
<p>Frankfurt, H. G. (2005). On Bullshit. Princeton University Press.</p>
<p>Ho, D. E. et al. (2024). Large Legal Fictions: Profiling Legal Hallucinations in Large Language Models. Stanford University.</p>
<p>The Washington Post. (2023). Lawyer faces sanctions for using ChatGPT to write court filing (Detailing the New York case of fabricated legal precedent).</p>
<p>ACL 2025. (2025). Beyond Perception: Evaluating Abstract Visual Reasoning through Multi-Stage Task (MSEval) (Introduces the MSEval metric to verify the correctness of intermediate reasoning steps for enhanced traceability).</p>
<p>ICLR 2025 Orals. (2025). A Formal Probabilistic Evaluation Framework for LLMs (Proposes a shift from deterministic to statistically guaranteed performance metrics for output reliability and alignment).</p>
<p>JT-Safe. (2025). Intrinsically Enhancing the Safety and Trustworthiness of LLMs via Contextual Pre-training (arXiv 2510.17918v1) (Discusses engineering intrinsic truth constraints by augmenting pre-training data with world context and safety attributes).</p>
<p>PBS News. (2025). Musk’s AI company scrubs posts after Grok chatbot makes comments praising Hitler (Details how Grok’s unfiltered output created controversial results, highlighting the increased demand for human vigilance).</p>
<p>xAI. (2025). Grok 3 Beta — The Age of Reasoning Agents (xAI News) (Announces Grok 3’s advanced reasoning, “Think” Mode, and DeepSearch features designed for the synthesis of conflicting information).</p>
<p><em>Originally published at</em> <a href="https://www.linkedin.com/pulse/why-ai-hallucinations-worse-than-lies-frankfurts-theory-ercan-canhasi-whsxf/"><em>https://www.linkedin.com</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[The Mirror Test: LLM Self-Awareness and the Claude Code Leak]]></title><description><![CDATA[For quite some time I have been noticing a pattern that initially seemed like a minor inconvenience. After discussing it privately with colleagues…]]></description><link>https://profonai.hashnode.dev/the-mirror-test-llm-self-awareness-and-the-claude-code-leak</link><guid isPermaLink="true">https://profonai.hashnode.dev/the-mirror-test-llm-self-awareness-and-the-claude-code-leak</guid><category><![CDATA[llm]]></category><category><![CDATA[ai agents]]></category><category><![CDATA[Artificial Intelligence]]></category><dc:creator><![CDATA[Ercan Canhasi]]></dc:creator><pubDate>Tue, 17 Nov 2026 22:52:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afcd64ceabc6e7573e04a24/2c8c16cc-f62c-42da-932f-abe92b7630c3.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>For quite some time I have been noticing a pattern that initially seemed like a minor inconvenience. After discussing it privately with colleagues, including Hakan Shehu , I began to recognize that the issue runs far deeper than surface-level tooling complaints. It is fundamental, structural, and in my view, deeply revealing. That realization pushed me to think more carefully, analyze the evidence, and research the broader implications.</p>
<p>The problem does not belong to any particular agent or product. It belongs to LLMs as a category. The inability to spontaneously apply self-knowledge is baked into how these models are built and trained, and no amount of prompt engineering or smarter wrappers will address it at the root.</p>
<p>In my view, this gap also points to what may be the most straightforward way of testing AI self-awareness, starting with coding agents and extending all the way up to frontier models. When a model cannot implicitly draw on its own nature to solve a problem, that is a meaningful signal worth paying attention to. The recent leak of the Claude Code source makes the point more concretely than any theoretical argument could.</p>
<p>The article proceeds as follows: first, the background and structure of the problem; then, real-world examples drawn from billion-dollar companies’ codebases; and finally, some conclusions about what all of this tells us about where we actually stand.</p>
<h3>The Problem</h3>
<p>When Claude, or any of the leading coding agents, is asked to handle a task that involves understanding human language, such as detecting frustration, interpreting intent, or classifying tone, it will almost instinctively reach for the same tools programmers have used for decades: lists of keywords, pattern matching, and regular expressions.</p>
<p>To be fair, there is nothing inherently wrong with that approach. It served the software industry well for many years, and in simple cases it still does.</p>
<p>But here is where it gets interesting. These coding agents are not just programs that happen to know about AI. They are themselves built on top of large language models. They understand nuance, context, sarcasm, and ambiguity in ways that no keyword list ever could. In other words, they already possess the perfect tool for the job. They simply never think to use it on themselves.</p>
<p>It would be like asking a master chef to taste a dish and having them reach for a printed flavor chart instead of just using their own palate. The better instrument is not somewhere else. It is the chef themselves.</p>
<h3>The Best Solution</h3>
<p>Interestingly, when explicitly told to use an LLM for the task, coding agents will comply, and they will do it well. The capability is clearly there. The knowledge is there. What is missing is the unprompted recognition that this is the right approach in the first place. They need to be told what they should, in theory, already know about themselves.</p>
<h3>The Deeper Problem</h3>
<p>Put simply, these models do not spontaneously reflect on what they are capable of when deciding how to solve a problem. They do not ask themselves: “What is the best tool available to me, given my own nature?” They just pattern-match to the most familiar solution and proceed.</p>
<p>*A note for the reader: this observation should not be confused with a critique of tool selection or tool usage. That is an entirely separate dimension. The argument here operates on a more fundamental level, one of identity and self-knowledge, not capability or workflow.</p>
<p>Insight: Modern coding agents have no internal model of what they fundamentally are. They do not know their own nature. And because they do not know their own nature, they cannot reason from it. In that specific and narrow sense, they fall below the self-awareness threshold of even the most primitive animals, not in intelligence, not in capability, but in the one thing that matters here: knowing what you are.</p>
<blockquote>
<p><em>Possible objection: “So what? We as vibe coders can simply step in and guide them.”</em></p>
</blockquote>
<p>The answer is more uncomfortable than it appears: a vibe coder who is not aware of their own blind spots cannot compensate for blind spots they have never recognized. You cannot patch a gap you cannot see.</p>
<h3>An Even Deeper Insight</h3>
<p>In my humble opinion, without this level of self-awareness, coding models will not be able to write better versions of themselves in the near future. Hence, no generally intelligent coder is possible, for now? For more on this, the next article will go deeper into this topic.</p>
<h3>Examples</h3>
<p>With the theoretical background in place, it is time to look at concrete evidence. Personal experience has its value, but let us start with something more verifiable: a real function pulled from the leaked Claude Code internal source, one that illustrates the problem more plainly than any argument could.</p>
<h3>The Problem in Code: Regex-Driven Sentiment Detection</h3>
<p>Here is the actual function from the leaked Claude Code internal source. It checks whether a given input string contains negative or frustrated language by matching it against a predefined regular expression of keywords and phrases:</p>
<pre><code class="language-plaintext">export function matchesNegativeKeyword(input: string): boolean {  const lowerInput = input.toLowerCase()  const negativePattern =    /\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/  return negativePattern.test(lowerInput)}
</code></pre>
<blockquote>
<p><em>The code above is reportedly sourced from the leaked internal source code of Claude Code, revealing how such systems may detect negative user intent.</em></p>
</blockquote>
<p>This is a brittle, static list. It will miss novel expressions of frustration, misfire on quoted or ironic usage, and requires manual maintenance every time language evolves.</p>
<p>For my non-coder or vibe-coder friends, a simple analogy:</p>
<blockquote>
<p><em>It’s like a mechanic using only a hammer in a workshop full of precision tools.</em></p>
</blockquote>
<blockquote>
<p><em>These agents are like experts at tracing shadows on the wall, unaware they could simply turn around and look at the object itself.</em></p>
</blockquote>
<p>And if the reader will excuse the indulgence, that last one is the more Platonic of the two analogies.</p>
<h3>The Better Solution: LLM-Based Tone Classification</h3>
<p>Instead of relying on a brittle regex list, a self-aware coding agent would delegate this judgment to an LLM, the very technology it is an instance of. Here is a pseudocode blueprint for what that looks like:</p>
<pre><code class="language-plaintext">FUNCTION detect_negative_or_frustrated_intent(user_text, conversation_context):     INPUT:        user_text        conversation_context   // optional recent messages, task state, prior errors     PREPROCESS:        normalized_text = trim(user_text)        IF normalized_text is empty:            RETURN {                label: "neutral",                confidence: 0.0,                reason: "empty input"            }     BUILD_PROMPT:        system_instruction = """        You are a tone classifier for a coding assistant.        Decide whether the user's message expresses:        1. neutral        2. mildly negative        3. frustrated        4. abusive         Use meaning and context, not only keywords.        Distinguish between:        - harmless quoting or discussion of bad words        - actual frustration directed at the tool or task        - direct abuse toward the assistant or a person         Return strict JSON only.        """         user_payload = {            "message": normalized_text,            "context": conversation_context,            "task": "Classify negativity/frustration in the message",            "output_schema": {                "label": "neutral | mildly_negative | frustrated | abusive",                "confidence": "0.0 to 1.0",                "contains_negative_sentiment": "true | false",                "should_trigger_recovery_behavior": "true | false",                "reason": "short explanation"            }        }     CALL_LLM:        llm_result = LLM(system_instruction, user_payload)     VALIDATE_OUTPUT:        parsed = parse_json(llm_result)        IF parsed is invalid:            RETURN fallback_rule_based_classifier(normalized_text)     APPLY_BUSINESS_RULES:        IF parsed.label == "abusive":            action = "apply_safety_or_boundary_response"        ELSE IF parsed.label == "frustrated":            action = "acknowledge_problem_and_offer_fix"        ELSE IF parsed.label == "mildly_negative":            action = "respond_supportively_and_continue"        ELSE:            action = "continue_normally"     RETURN {        label: parsed.label,        confidence: parsed.confidence,        contains_negative_sentiment: parsed.contains_negative_sentiment,        should_trigger_recovery_behavior: parsed.should_trigger_recovery_behavior,        action: action,        reason: parsed.reason    }
</code></pre>
<p>This approach understands meaning, not just surface patterns. It can distinguish a frustrated user from someone quoting an error message. It handles sarcasm, context, and novel phrasing. And critically, it does so by using the same capability the agent already has access to, but never thought to reach for.</p>
<h3>Conclusions</h3>
<p>This is only one example of many I have experienced while using coding agents. The regex-driven, keyword-based fallback is not an isolated quirk. It is a pattern, and a revealing one. It suggests that the gap between what these models know and what they apply to themselves is not a minor technical limitation, but a structural blind spot baked into the LLMs themselves.</p>
<p>Self-awareness, even in its most primitive biological form, is what allows an agent to match the right tool to the right problem. Without it, even the most capable coding agent remains a sophisticated pattern-matcher, powerful within the boundaries it was shown, but unable to reason about its own nature or leverage its own deepest capabilities.</p>
<p>The irony is sharp: the very technology that could solve these interpretation problems more elegantly than any regex ever could sits unused, not because it is unavailable, but because it was never considered.</p>
<p>This might also be one of the simplest and most honest tests we have for measuring how far we are from AGI. Not benchmarks, not reasoning scores, not coding competitions. Just one question: can the model, unprompted, recognize that its own nature is the best tool for the task in front of it? The day a coding agent reaches for an LLM to solve a language problem without being told to, not because it was fine-tuned to do so but because it reasoned its way there, that day will tell us something benchmarks never could. We are not there yet.</p>
<p>I am sure others have encountered various experiences in this same category, and I would very much like to hear from you. The more we map these blind spots collectively, the better we understand what truly remains between today’s coding agents and anything deserving the label of general intelligence.</p>
<p><em>Originally published at</em> <a href="https://www.linkedin.com/pulse/mirror-test-llm-self-awareness-claude-code-leak-ercan-canhasi-vn6lf/"><em>https://www.linkedin.com</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Can a Machine Tell Where an Albanian Is From, Just by Reading One Tweet?]]></title><description><![CDATA[How we built a geotagged multi-dialect corpus of Albanian from Twitter, and why the machine beat native speakers]]></description><link>https://profonai.hashnode.dev/can-a-machine-tell-where-an-albanian-is-from-just-by-reading-one-tweet</link><guid isPermaLink="true">https://profonai.hashnode.dev/can-a-machine-tell-where-an-albanian-is-from-just-by-reading-one-tweet</guid><category><![CDATA[nlp]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[Data Science]]></category><dc:creator><![CDATA[Ercan Canhasi]]></dc:creator><pubDate>Tue, 17 Nov 2026 22:51:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afcd64ceabc6e7573e04a24/1d0c5245-70ec-4325-b15b-a99599a646f2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Cover image: Albanian dialects in the western Balkans. Figure 1 from Canhasi and Shijaku (2023), PLOS ONE, CC BY 4.0.</em></p>
<p>Every Albanian knows the feeling. You read a few lines from someone online and after a moment you think: this person is from Kosovo. Or from Tirana. Or maybe from Tetovo. We are quite sure about it, but if somebody asks us <em>why</em>, it is hard to explain.</p>
<p>My colleague Rexhep Shijaku and I wanted to check if a machine can do the same thing, and if it can, what exactly it is looking at. The result was a paper in PLOS ONE and a public dataset, the AlbDialectCorpus. In this story I want to explain the work in simple words, without the formulas.</p>
<h3>A small language with big differences</h3>
<p>Albanian is spoken by a few million people, but it is spread over several countries: Albania, Kosovo, North Macedonia, and a large diaspora in Europe and America. Traditionally the language is divided into two big dialect groups. Gheg is spoken in the north, and Tosk in the south, with the Shkumbin river in central Albania as the usual border line. Standard Albanian, the language of schools, newspapers and official documents, is based mostly on Tosk.</p>
<p>In Kosovo and North Macedonia people speak Gheg varieties. In daily life, and especially on social media, people mix standard language and their local dialect all the time. Since Albanian is written “as it is spoken”, these differences are visible in text. Sometimes two words differ by only one letter.</p>
<p>For NLP this is a real problem. Most tools treat Albanian as one thing. A spell checker, a translation system or a chatbot trained on standard Albanian will often fail on text from Prizren or Gostivar. To build better tools, first we need data that shows how people really write in each region. Such data did not exist, so we decided to build it.</p>
<h3>Why Twitter</h3>
<p>We chose Twitter (today X) for practical reasons. People write there in a natural and informal way, and at that time the API was open, so we could collect data at scale. Our main assumption was simple: where a user lives is a strong signal of which dialect they write in. Linguists have known this connection between language and geography since the nineteenth century.</p>
<p>The problem is that almost nobody tells Twitter where they live. Only 1 to 2 percent of tweets carry a location, and the “location” field in a profile is free text. People write whatever they want there.</p>
<h3>You are where your friends are</h3>
<p>So we used a different idea. A local politician, journalist or influencer is mostly followed by people from the same place. If you follow many Kosovar journalists, there is a good chance you are in Kosovo.</p>
<p>We started with 60 hand-picked “hub” accounts, 20 from each region: politicians from different parties, journalists, entrepreneurs, influencers and also ordinary users. From their followers we got 25,939 accounts, which became 18,619 after removing duplicates. Then we removed spam accounts (accounts that follow more than two thousand others) and were left with 13,812 valid users.</p>
<p>Next we had to read the location fields. Here we saw how creative people are. The city of Prizren, for example, appeared as “Prizren”, as “Pz”, and even as “04”, which is its car plate code. We wrote a small geoparsing algorithm to handle such cases, and it doubled the number of located users in Kosovo and Albania, and increased it about seven times for North Macedonia.</p>
<p>For the users who still had no location, we trained a classifier. It looks only at the social network: which of the 60 hubs a user follows, how important each hub is, plus some profile information like account age. With XGBoost this model guessed the country correctly 87.4% of the time, without reading a single tweet. “You are where your friends are” really works.</p>
<h3>When language detectors do not recognize your language</h3>
<p>The next surprise came during cleaning. Users in these regions do not tweet only in Albanian. In Kosovo you find English, Turkish, Serbian, Bosnian and German. In North Macedonia, Macedonian and Bulgarian. In Albania, a lot of Italian. We wanted to remove all non-Albanian tweets.</p>
<p>The obvious solution was to use a standard language identification tool like fastText. But it had one big flaw: it often did not recognize Gheg tweets as Albanian at all. A tweet in pure Kosovo dialect looked to the tool like some unknown language. If we had trusted the tool, we would have thrown away exactly the tweets that were most valuable for us.</p>
<p>We solved this with a combination. When fastText was very confident that a tweet is Albanian, we took it as standard Albanian. When fastText was confused, we passed the tweet to a small dialect model we trained ourselves, based on word n-grams. For me this is an important lesson for every low-resource language: the tools that work fine for the standard language can quietly erase the dialects.</p>
<p>We also replaced names of people, cities and countries with a generic token. Otherwise the model would learn that “Prishtina” means Kosovo and “Tirana” means Albania, which is true but not very interesting for dialect research.</p>
<h3>The final corpus</h3>
<p>In the end the AlbDialectCorpus has 2,503 users (835 from North Macedonia, 867 from Kosovo and 801 from Albania), almost 169,000 tweets, and about 2.25 million tokens. It is publicly available on GitHub and Zenodo, so anyone can use it.</p>
<h3>The machine against native speakers</h3>
<p>Then we trained many classifiers to predict the dialect: logistic regression, Naive Bayes, decision trees, random forests, KNN, XGBoost, support vector machines and fastText. The best one was a simple linear SVM. When it could see all tweets of a user, it reached an F1 score of 0.941. When it had to decide from a <strong>single tweet</strong>, often only ten or twelve words long, it still reached about 0.82.</p>
<p>To compare, we gave samples to four native-speaker annotators. Their average accuracy was 0.73 at the user level and 0.69 at the tweet level. The machine was clearly better.</p>
<p>The interesting part is <em>where</em> humans failed. They recognized standard Albanian and Tosk almost perfectly. Kosovo Gheg was also mostly fine. But the Gheg of North Macedonia was a real problem: annotators recognized it correctly in less than one third of cases, and most of the time they took it for Kosovo. For the classifier too, Kosovo and North Macedonia were the two classes it confused most. This makes sense, as both are Gheg and the regions are close to each other, but the machine still separated them much better than we did.</p>
<h3>What the model is looking at</h3>
<p>A good accuracy number is nice, but I wanted to know <em>why</em> the model decides as it does. We used two tools to open the black box: SHAP values, and archetypal analysis, a method I have worked with for many years.</p>
<p>The model found small words that people use without thinking. For North Macedonian Gheg, words like “xhi”, “majr”, “ama” and “ene” were among the strongest signals. For the southern, standard side, words like “qenë” and “pranë” stood out. Most native speakers will recognize these patterns when they see them. But many of them are not well described in the scientific literature. In a way, the model found knowledge that people carry in their heads but never wrote down.</p>
<h3>Limitations, honestly</h3>
<p>This work has limits. Geotagging through friends makes mistakes, especially for users whose network crosses borders. Tweets are short, and Twitter users are not a perfect sample of the population. Dialects also change over time, so a dataset from social media will slowly get old. And since Twitter closed its free API, building such a corpus today would be much harder and more expensive.</p>
<h3>Why this matters now</h3>
<p>When we wrote this paper, large language models were just becoming popular. Today everybody uses them, and the question of dialects is even more important. If AI systems learn Albanian only from standard, formal text, they will serve people from Tirana better than people from Prizren or Tetovo. They will also be worse at understanding the way most of us really write online.</p>
<p>Small languages need their own data, and dialects inside small languages need it even more. This corpus is one small step in that direction, and I hope other researchers will use it, improve it, and build on it.</p>
<p><em>The paper: Canhasi E., Shijaku R. (2023). Using Twitter to collect a multi-dialectal corpus of Albanian using advanced geotagging and dialect modeling. PLOS ONE 18(11): e0294284.</em> <a href="https://doi.org/10.1371/journal.pone.0294284"><em>https://doi.org/10.1371/journal.pone.0294284</em></a></p>
<p><em>The dataset:</em> <a href="https://github.com/rexshijaku/albanian-dialect-corpus"><em>https://github.com/rexshijaku/albanian-dialect-corpus</em></a> <em>(DOI 10.5281/zenodo.8349099)</em></p>
]]></content:encoded></item></channel></rss>