AI-assisted
    How this works

    Learn · Info

    The verification layer behind every Finnish & Swedish output: classified inputs that route the request, the deterministic output cascade, and the prerequisite graph that gates concepts.

    Anti-hallucination · Verification Layer · v0.1

    Verification Layer

    Every Finnish output passes a deterministic cascade before reaching you. Ontology grounding, vowel-harmony, and a refuse-when-ungrounded policy. The pedagogy is in the rules, not in a black box.

    Ontologies in use

    YSO
    General Finnish Ontology
    Live

    General-purpose lemmas — the lexical existence backbone.

    Used as Tier-2 deterministic lookup. If a generated lemma has no YSO match, it is flagged as ungrounded.

    Source: api.finto.fi (SPARQL)
    TERO
    Education / CEFR descriptors
    Human-only

    CEFR-aligned concept tagging (A1–C1).

    CEFR tagging is not auto-applied — a teacher annotates difficulty. The system reports level, never invents one.

    Source: Manual curation
    OIKO
    Legal & administrative
    Advisory

    KELA, Migri, citizenship, residence, taxation terminology.

    Consulted for civic / legal queries. Refuses rather than guesses on procedure-specific facts.

    Source: api.finto.fi (read-only)
    TSR
    Occupational safety / labour
    Advisory

    Workplace-safety, labour-law, shift-handover vocabulary.

    Used for sote / metal vocational tracks.

    Source: api.finto.fi (read-only)
    MESH-FI
    Medical Subject Headings (Finnish)
    Advisory

    Healthcare and clinical terminology.

    Used by the sote / dental tracks for terminology grounding.

    Source: api.finto.fi (read-only)
    AFO
    Agriforest ontology
    Advisory

    Agriculture, forestry, environmental terminology.

    Niche track; consulted only when domain matches.

    Source: api.finto.fi (read-only)

    Classifier inputs

    What the system reads BEFORE generating, to route the output to the right ontology and CEFR band.

    User UI language
    en, es, fr, ar, sv …

    Drives the explanation/output language. Finnish output is verified; explanations are localised.

    CEFR target
    A1, A2, B1, B2, C1

    Constrains vocabulary tier. A1 task ≠ C1 vocabulary; the verifier rejects above-band lemmas.

    Domain / profession
    general, sote, metal, it, dental

    Routes ontology lookups (sote → MESH-FI, metal → TSR, civic → OIKO).

    Task type
    translate, conjugate, yki-exercise

    Translation, conjugation, exercise generation. Different verifiers per task.

    Source text
    ≤ 2000 chars

    Length and language detected. Finnish output is checked against vowel-harmony + ontology.

    Output verifiers (cascade)

    Tiers run in order. Failure at a lower tier short-circuits — the policy tier (3) decides whether to refuse, annotate, or return.

    Tier 1
    deterministic
    Length & character sanity

    Rule: Output is non-empty, within length budget, and uses only Finnish-legal characters.

    On fail: Reject. Re-prompt the model.

    Tier 1
    deterministic
    Vowel-harmony check

    Rule: Native Finnish stems must not mix front (ä/ö/y) and back (a/o/u) vowels. Loanwords are excepted.

    On fail: Flag stem as likely hallucination. Refuse or annotate.

    Tier 2
    ontology
    Finto YSO lemma existence

    Rule: Each non-trivial content lemma is queried against api.finto.fi/sparql with a 1500ms timeout.

    On fail: Mark output as ungrounded. Return refusal-with-citation, never the unverified answer.

    Tier 2
    ontology
    Domain ontology consultation

    Rule: If domain ≠ general, route to MESH-FI / TSR / OIKO / AFO and require at least one domain match for domain claims.

    On fail: Strip domain claim or refuse with 'not in ontology'.

    Tier 3
    policy
    Refuse-when-ungrounded

    Rule: If Tier 1 or Tier 2 fails AND the user asked for a factual claim, the function returns HTTP 422 with a verification trace instead of the model's text.

    On fail: (this IS the failure handler)

    Tier 3
    policy
    CEFR cap (advisory)

    Rule: If an output lemma is annotated above the requested CEFR band, attach a warning. Never silently substitute.

    On fail: Annotate, do not rewrite.

    Prerequisite graph

    Each concept points to what it depends on. The verifier refuses to teach downstream concepts when upstream ones are not yet at self-regulation.

    A0
    Vowel harmony
    Foundational — no prerequisites.
    A1
    Verb types 1–6
    Needs: Vowel harmony
    A1
    Consonant gradation
    Needs: Vowel harmony
    A2
    Partitive case
    Needs: Verb types 1–6, Consonant gradation
    A2
    Genitive case
    Needs: Consonant gradation
    A2
    Local cases (illative/elative/allative)
    Needs: Genitive case
    B1
    Object case selection
    Needs: Partitive case, Genitive case
    B1
    Passive voice
    Needs: Verb types 1–6
    B2
    Participle constructions
    Needs: Passive voice, Object case selection

    Simulator

    Type Finnish text below. The same deterministic checks the edge function runs (Tier 1) execute live in your browser. Tier 2 (Finto SPARQL) is described, not called.

    Token highlighting
    Minä menen kauppaan ostamaan leipää.
    Cascade trace
    Would return
    Tier 1
    Length & character sanity

    36 chars, within budget.

    Tier 1
    Character set

    Only Finnish-legal characters.

    Tier 1
    Vowel-harmony check

    All native stems harmonise.

    Tier 2
    Finto YSO ontology lookup (simulated)

    (simulator) 5/5 lemmas grounded against the demo ontology. Server would hit api.finto.fi/sparql.

    Tier 3
    Policy outcome

    Would return model output annotated with verification trace.

    Specification, not marketing. The cascade described here is implemented insupabase/functions/_shared/finnish-verification.tsand wired into the Finnish translator, Swedish translator, and YKI exercise edge functions.

    Verification failure rates

    Last 168h of anti-hallucination decisions across edge functions.