Teadmiste formaliseerimine: erinevus redaktsioonide vahel

Allikas: Lambda
Mine navigeerimisribale Mine otsikasti
 
(ei näidata 2 kasutaja 124 vahepealset redaktsiooni)
15. rida: 15. rida:
</table>
</table>


= Eksamitulemused =
Eksamitulemused siin:
* [[Esimene (27 mai) teadmiste eksam 2026]]
* [[Teine  (1 juuni) teadmiste eksam 2026]]
* [[Kolmas  (8 juuni) teadmiste eksam 2026]]
= Eksamikonsultatsioon =
(a) väike salvestuse teamsi, teemaks siis eksamikorraldus, ülesanded jne:[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2026/Shared%20Documents/General/Recordings/Eksami%C3%BClevaate%20salvestus-20260520_053318UTC-Meeting%20Recording.mp4?csf=1&web=1&e=rQObCH&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D salvestus siin], asub kursuse teamsi-salvestuste kataloogis.
(b) Konsultatsioonide lingid siin:
* [https://teams.microsoft.com/meet/313481263783182?p=n6Lqqc5BNDUaCUX0IJ eksamikonsultatsioon] 20. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).
* [https://teams.microsoft.com/meet/365383768774501?p=WPjQ5sq3VKweu8doJT eksamikonsultatsioon] 25. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).
= Eksamikorraldus ja materjalid õppimiseks =
Eksamiks on kokku aega 2.5 tundi, aga enamik peaks saama hakkama ca 1.5 tunniga.
Eksam on kirjalik, samas ruumis/ajal toimub ka hajussüsteemide kirjalik eksam.
Allolevad punase E1-ga on eksami jaoks kõige olulisemad materjalid, E2 veidi vähem olulised.
NB! Võrreldes varasemaga on lisaks markeeritud E2-ga need varasemalt olemas, aga markeerimata materjalid:
* [[Media:Llm_intro_2026.pdf|Lecture material part 1]] <font color="red">E2</font>
* [[Media:Llm_details_2026.pdf|Lecture material part 2]] <font color="red">E2</font>
* [[Media:Llm_usage_rag.pdf|Lecture material]] <font color="red">E2</font>
* [[Media:Visual Reasoning 2026.pdf|Lecture presentation]] <font color="red">E2</font>
Ekamil tuleb neli eraldi hinnatavat osa: kolm teemaküsimust ja üks osa paari lühiküsimusega. Spetsiifiliste süntaksite (RDF, loogikavarandid jne) osas: ühtegi täpset süntaksit/võtmesõnu ei pea teadma, aga esitus peab olema õppejõule sisuliselt arusaadav.
Millised on teemaküsimused ja millised on lühiküsimused:
SQL ja loogika: esitan paar tabelit ja küsin mõnda taolist küsimust:
* nende sisu võimalikult täpset esitust esimest järku loogikas või RDFs
* mõne konkreetse where- või join-päringu kirjutamist esimest järku loogikas
JSON-LD: annan JSON-LD jupi ja küsin selle tähendust ehk teisendust RDF kujule kolmikutena.
Reeglite esitamine: pane rdf ja/või rdfs kujule ja/või predikaatloogikale baseerudes kirja etteantud konkreetsed inimkeelsed väited.
Reeglite rakendamine klassikalises teoreemitõestamises: oskus teha käsitsi läbi väike resolutsioonimeetodi rakendamise näide, kui disjunktid ette antud.
Sõnavektorid ja N-grammid ja keelemudelite üldprintsiibid: arusaamine, oskus esitada väike näide töötamise kohta, võimalikud kasutus- või loomisstsenaariumd
Ebakindlate teadmiste esitamise põhimeetodid: pidevad (erinevat sorti tõenäosuste-tüüpi esitus) ja diskreetsed (eranditega süsteemid, eeskätt default logic). Siin võin tuua väikese näite ja küsida lahendust või palun ise esitada mõne pisinäite sobival kujul. Konkreetseid süntakseid teadma ei pea, piisab õppejõule arusaadavaks tegemisest.
Lühiküsimused (siit valitakse iga eksami jaoks paar):
Seleta paari lausega, mis asi on, vahel küsin ka näidet: freimiprobleem, open/closed world, blocks world, RAG, erinevad tõenäosuste interpretatsioonid, RDFa; mis asi on ja mida sealt umbes leida võib ja mida pigem mitte: schema.org, wordnet, conceptnet, yago, cyc; mida sa mäletad "semantiline parsimine" ja "visual reasoning" teemade kohta.
= Eksamipäevad ja ajad =
Siin on täpsustunud esimese kahe eksami ajad:
* 27 mai, kolmapäev, kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium NRG-226.
* 1 juuni, esmaspäev: eraldi eksamiajad hajussüsteemide (11:00) ja teadmiste esitamise (14:00) jaoks. Auditoorium SOC-211a.
* 8 juuni, esmaspäev: kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium ICT-315.
<!--
= <font color="red">NB! Kolmas kodutöö uuendatud</font> =
Vaata allpool "Third lab: questions in NLP": see on uuendatud 2026 aasta jaoks. Idee on analoogiline eelmise aasta ülesandega, aga konkretiseeritud piltide ülesandega (esimese ja teise kodutöö teemad) sobivaks.
-->
<!--
= <font color="red">NB! 23 ja 24 veebruar on puhkepäevad</font> =
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.
-->
<!--
= <font color="red">NB! Materjalid hetkel uuendamisel</font> =
= <font color="red">NB! Materjalid hetkel uuendamisel</font> =
-->


= Time, place, result =
= Time, place, result =


Lectures (Tanel): Mondays 12:00-13:30 room SOC 414<br>  
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414<br>  
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122.
Practice sessions (Riina): Tuesdays 08:00-09:30 room <s>MEK-122</s> MEK-109.


The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.
62. rida: 133. rida:


The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture.  
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture.  
== The first weekly task ==
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.
Konkreetselt tee järgmist:
* Eksperimenteeri veidi [http://logictools.org logictools.org] "simple examples" valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest.
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda).
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga "SQL join as logical rule", kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):
<pre>
client table: id name balance
1 john 100
2 pete -200
cars table: id model owner
1 ford 1
2 opel 2
3 saab 2
select client.name, client.balance
from client where balance<0
select client.name, cars.model from client, cars
where client.id=cars.owner
</pre>
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna "formaliseerimine", et kirja kergesti üles leiaks.
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!
Soovitused:
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis "arithmetic" näidet.
== The second weekly task ==
Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid "example" valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.


<!--
<!--
73. rida: 187. rida:
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga "SQL join as logical rule", kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga "SQL join as logical rule", kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna "formaliseerimine", et kirja kergesti üles leiaks.
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna "formaliseerimine", et kirja kergesti üles leiaks.
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!


Soovitused:
Soovitused:
82. rida: 197. rida:
= Practical work =
= Practical work =


<font color="red">NB!</font> The plan for practice work is currently being updated. The information below is not up to date yet.


There are three labs.
There are three labs.
93. rida: 207. rida:
== First lab ==
== First lab ==


The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions.  
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions.  


Lab is updated! Future updates may include clarifications, but the task itself will not change.
Deadline: 10. March.


Deadline: 5. March.
== Second lab ==


== Second lab ==
The [[KR 2026 homework part 2|2026 task for the second lab]] is about using a VLM (visual language model) to get a structured description from an image which would fit with the pre-existing simple world model.


See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.
Deadline: 7. April


Lab is updated! Future updates may include clarifications, but the task itself will not change.
== Third lab: questions in NLP ==


Deadline: <s>9. April</s> 16. April
This is the task for 2026:


== Third lab: questions in NLP ==
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner for images: 2026]]


This is updated!
Deadline: 12. May


<!--
This is an example from 2025, not the task for 2026:
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]]  
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]]  
-->
<!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] -->
<!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] -->
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after the 14. May (including 21. May).
<!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. -->
<!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. -->
 
<!--
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&web=1&e=McaLE9&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]
NB! The task description above has just been updated (at 13. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&web=1&e=McaLE9&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]
-->


= Books to use =
= Books to use =
125. rida: 240. rida:


* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.
* <b>The</b> book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].
* <b>The</b> book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. <!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --> [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].


Other useful books and tools for symbolic K&R:
Other useful books and tools for symbolic K&R:
137. rida: 252. rida:


* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]
<!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] -->
<!--
<!--
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]
158. rida: 273. rida:
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]


Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] <!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] -->,


=== Lecture: Nosql, json and rdf in databases: 9. February  ===
=== Lecture: Nosql, json and rdf in databases: 9. February  ===
174. rida: 289. rida:




=== Lecture: simple rules in rdfs, logic and owl: 16. February ===
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===


* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]
206. rida: 321. rida:
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page


=== Lecture: what the reasoner does: 23. February ===
What the reasoner does:
 
<font color="red">NB!</font>This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:
 
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]


We will consider the reasoning part of K&R to understand what provers do:
We will consider the reasoning part of K&R to understand what provers do:
226. rida: 337. rida:
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.


=== Lecture: looking into main large knowledge bases  ===
=== Lecture: DPP ontology development. 2. March ===
 
Loengu annab Riina. Digital Product Passport (DPP)
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.
 
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht].
 
[https://cirpass2.eu/ CIRPASS-2]
 
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]
 
[https://www.w3.org/TR/shacl/ SHACL]
 
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]
 
 
 
<!--
 
=== Lecture: what the reasoner does: märtsi algul ===
-->
<!--
<font color="red">NB!</font>This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:
-->
<!--
 
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]
-->
 
=== Lecture: Next homework and looking into main large knowledge bases: 9. March ===
 
We will first present the next homework.
 
Then we will continue with existing large knowledge bases.


Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] <font color="red">E2</font>, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] <font color="red">E2</font>, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool
278. rida: 422. rida:
== Block 3: natural language and question answering ==
== Block 3: natural language and question answering ==


=== Lecture: Intro to NLP, n-grams, word vectors ===
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===


<!--
<!--
289. rida: 433. rida:
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] <font color="red">E1</font> ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] <font color="red">E1</font> ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf].  
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variant].  
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] <font color="red">E2</font> ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] <font color="red">E2</font>. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7: Neural Networks and Neural Language Models
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] <font color="red">E2</font> ja siis [https://web.stanford.edu/~jurafsky/slp3/5.pdf chapter 5: Embeddings] <font color="red">E2</font>. Vaata [https://web.stanford.edu/~jurafsky/slp3/ sisukorrast] ka slaide nende kohta.
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. <font color="red">E2</font>
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation
298. rida: 441. rida:
-->
-->
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks
<!--
<!--
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:
314. rida: 456. rida:
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.


=== Lecture: large language models (LLM) ===
=== Lecture: large language models (LLM) 23 March ===
 
* [[Media:Llm_intro_2026.pdf|Lecture material part 1]] <font color="red">E2</font>
* [[Media:Llm_details_2026.pdf|Lecture material part 2]] <font color="red">E2</font>


[[Media:Llm_intro.pdf|Lecture material]]
<!--
<!--
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&web=1&e=j8fZj2&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&web=1&e=j8fZj2&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]
355. rida: 499. rida:
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].


=== Lecture: LLM usage patterns and RAG ===
=== Lecture: RAG usage pattern / context engineering for LLMs : 30 March ===


[[Media:Llm_usage_rag.pdf|Lecture material]]
[[Media:Llm_usage_rag.pdf|Lecture material]]: this is focused on RAG and written in 2024 and spring 2025: good tool use, good reasoning and more autonomy like claude code and openclaw are not covered in this overview.
 
<b>"Context Engineering"</b> became a popular phrase in 2025: essentially it means "fancy RAG", i.e. significant effort put towards creating a really good set of additional information (prompt additions: "context") for each user query/prompt. It can also mean approaches for storing such additional information on the fly in special files which
are then used RAG-like as extra input in addition to user dialog.For example, claude code [https://code.claude.com/docs/en/memory memory principles] and [https://blog.dailydoseofds.com/p/anatomy-of-the-claude-folder memory folder structure], openclaw [https://lumadock.com/tutorials/openclaw-memory-explained memory].


Useful reading in addition to pointers in the lecture material:
Useful reading in addition to pointers in the lecture material:
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]
<!-- * early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use] -->
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]
* RAG focus: [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]
* Old finetuning example: [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]
* RAG:
* RAG:
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] <font color="red">E1</font>
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] <font color="red">E1</font>
370. rida: 517. rida:
** [https://en.wikipedia.org/wiki/Vector_database vector database] <font color="red">E2</font> as a useful tool
** [https://en.wikipedia.org/wiki/Vector_database vector database] <font color="red">E2</font> as a useful tool
** [https://www.promptingguide.ai/research/rag different kinds of rag] <font color="red">E2</font> based on [https://arxiv.org/abs/2312.10997 paper]
** [https://www.promptingguide.ai/research/rag different kinds of rag] <font color="red">E2</font> based on [https://arxiv.org/abs/2312.10997 paper]
<!--
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]
** [https://getalign.com/ example estonian startup using a kind of rag]
-->
<!-- ** [https://getalign.com/ example estonian startup using a kind of rag] -->


== Block 4: hybrid systems and uncertain knowledge ==
== Block 4: hybrid systems and uncertain knowledge ==
378. rida: 527. rida:
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems


=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===
=== Lecture: issues in formalizing commonsense reasoning: open/closed world, frame problem, uncertainties: 6. April ===


<!--
<i>First, some results/challenges in neurosymbolic reasoning.</i>
<i>First, some results/challenges in neurosymbolic reasoning.</i>


388. rida: 538. rida:
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] <font color="red">E2</font>
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] <font color="red">E2</font>
 
-->
<!--
<!--
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use]  
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use]  
401. rida: 551. rida:
-->
-->


<i>Second, planning, open/closed worlds and the frame problem. </i>
 
<b><i>First, open/closed world, world states, frame problem</i></b>


The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks
414. rida: 565. rida:


Importantly, the frame problem arises since normal first order logic has  
Importantly, the frame problem arises since normal first order logic has  
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] <font color="red">E1</font> (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.
* the <i>open world assumption</i>: if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.


Prolog and databases operate under the  
Prolog and databases operate under the  
421. rida: 572. rida:


Please look at and read these materials about the frame problem:
Please look at and read these materials about the frame problem:
 
<!--
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)
-->
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: <font color="red">E1</font> must read.
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: <font color="red">E1</font> must read.
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).
435. rida: 587. rida:
Next, importantly, you should experiment yourself with gkc and both of the following
Next, importantly, you should experiment yourself with gkc and both of the following
files. Please copy and read the files and understand the encoding. At the end of the files are
files. Please copy and read the files and understand the encoding. At the end of the files are
several queries to experiment with: instructions are also there.
several queries to experiment with: instructions are also there. The simplest way to experiment is to use https://logictools.org/ . There is already a <b>blocks world</b> example available.


In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).
444. rida: 596. rida:
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].


=== Reasoning with uncertainty and intro to lab 3 ===
 
<b><i>Second, uncertainty</i></b>
 


Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] <font color="red">E1</font>.
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] <font color="red">E1</font>.
468. rida: 622. rida:
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]


=== Lecture: research in neurosymbolic reasoning: 13 April ===
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].
=== Lecture: semantic parsing with LLMs and with UDP: 20 April ===
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].
For a quick intro we will use Martin's slides from 2024 [[Media:KR_2024_Parsing_01.pdf|semantic parsing]] <font color="red">E2</font>.
The rest of the lecture will explain stuff in [https://github.com/tammet/nlpsolver nlpsolver]. See the [[Media:Nlpsolver_presentation.pdf|nlpsolver presentation]].
Useful background:
About important concepts in parsing:
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&Martin: Constituency Parsing]
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&Martin: Dependency Parsing]
Some important toolkits and representation schemes:
* [https://spacy.io spacy], [[a small spacy UD parsing example]]
* [https://stanfordnlp.github.io/stanza/ stanza]
* [https://universaldependencies.org/ universal dependencies]
Some draft parsing papers:
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]
=== Lecture: we explore some recent papers in neurosymbolic reasoning: 27 April  ===
A reading session: we will read and attempt to understand together some case studies.
* Google DeepMind paper [https://www.nature.com/articles/s41586-023-06747-5 Solving olympiad geometry without human demonstrations]
* Google DeepMind paper [https://www.nature.com/articles/s41586-025-09833-y Olympiad-level formal mathematical reasoning with reinforcement learning]
* [https://arxiv.org/abs/2502.13834 Proving Olympiad Inequalities by Synergizing LLMs and Symbolic Reasoning]
* [https://arxiv.org/abs/2511.11751 Concept-RuleNet: Grounded Multi-Agent Neurosymbolic Reasoning in Vision Language Models]
* [https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf What’s Left?Concept Grounding with Logic-Enhanced Foundation Models]
=== Lecture: visual reasoning: 4. May  ===
The lecture will be given by our postdoc researcher [https://vaishnavmohit.github.io/ Mohit Vaishnav].
[[Media:Visual Reasoning 2026.pdf|Lecture presentation]] <font color="red">E2</font>
Related preprints:
* [https://arxiv.org/pdf/2501.13620 Cognitive paradigms for evaluating vlms on visual reasoning task]
* [https://arxiv.org/pdf/2604.21346 Symbolic Grounding Reveals Representational Bottlenecks in Abstract Visual Reasoning]
=== Lecture: we continue exploring recent papers in neurosymbolic reasoning: 11 May  ===
We look at some of the more interesting papers from each subarea (maybe not all the papers):
Logic focus:
* Neuro-Symbolic Concepts https://arxiv.org/pdf/2505.06191
* Sound and Complete Neurosymbolic Reasoning with LLM-Grounded Interpretations https://arxiv.org/pdf/2507.09751
Visual reasoning:
* MuSLR: Multimodal Symbolic Logical Reasoning https://arxiv.org/pdf/2509.25851
* Can VLMs Reason Robustly? A Neuro-Symbolic Investigation https://arxiv.org/pdf/2603.23867
Planning:
* LLMs as Planning Formalizers: A Survey for Leveraging Large Language Models to Construct Automated Planning Models https://arxiv.org/pdf/2503.18971
* Planning in the Dark: LLM-Symbolic Planning Pipeline without Experts https://arxiv.org/pdf/2409.15915 or newer https://ojs.aaai.org/index.php/AAAI/article/view/34855/37010
* Fast and Accurate Task Planning using Neuro-Symbolic Language Models and Multi-level Goal Decomposition https://arxiv.org/pdf/2409.19250
* See also PDDL https://fareskalaboud.github.io/LearnPDDL/ https://homepages.inf.ed.ac.uk/mfourman/tools/propplan/pddl.pdf
Text-to-SQL:
* SPIDER 2.0: EVALUATING LANGUAGE MODELS ON REAL-WORLD ENTERPRISE TEXT-TO-SQL WORKFLOWS https://arxiv.org/pdf/2411.07763
* CHASE-SQL: Multi-Path Reasoning and Preference Optimized Candidate Selection in Text-to-SQL https://arxiv.org/pdf/2410.01943
=== Consultation for the exam: 18 May  ===
<!--
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].
-->
<!--
=== Lecture: visual reasoning  ===
=== Lecture: visual reasoning  ===


479. rida: 717. rida:


A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.
 
-->
<!--
<!--
=== Lecture: continuing with uncertain knowledge ===
=== Lecture: continuing with uncertain knowledge ===
490. rida: 728. rida:
-->
-->


<!--
=== Lecture: Semantic parsing  ===
=== Lecture: Semantic parsing  ===


512. rida: 751. rida:
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]
 
-->
<!--
=== Semantic parsing continued  ===
=== Semantic parsing continued  ===


518. rida: 758. rida:


Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] <font color="red">E2</font>
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] <font color="red">E2</font>
-->


<!--
=== Topics in neurosymbolic reasoning and consultation for the exam  ===
=== Topics in neurosymbolic reasoning and consultation for the exam  ===
 
-->
<!--
<!--
Some papers to explore:
Some papers to explore:

Viimane redaktsioon: 12. juuni 2026, kell 22:19

teadmised
teadmised

Name: Knowlege representation
Code: ITI8700
Link: http://lambda.ee/Teadmiste_formaliseerimine
Lecturer: Tanel Tammet tanel.tammet@ttu.ee ICT-426
Practice sessions: Riina Maigre
Archives of previous years: 2025.

Eksamitulemused

Eksamitulemused siin:

Eksamikonsultatsioon

(a) väike salvestuse teamsi, teemaks siis eksamikorraldus, ülesanded jne:salvestus siin, asub kursuse teamsi-salvestuste kataloogis.

(b) Konsultatsioonide lingid siin:

  • eksamikonsultatsioon 20. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).
  • eksamikonsultatsioon 25. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).

Eksamikorraldus ja materjalid õppimiseks

Eksamiks on kokku aega 2.5 tundi, aga enamik peaks saama hakkama ca 1.5 tunniga.

Eksam on kirjalik, samas ruumis/ajal toimub ka hajussüsteemide kirjalik eksam.

Allolevad punase E1-ga on eksami jaoks kõige olulisemad materjalid, E2 veidi vähem olulised. NB! Võrreldes varasemaga on lisaks markeeritud E2-ga need varasemalt olemas, aga markeerimata materjalid:

Ekamil tuleb neli eraldi hinnatavat osa: kolm teemaküsimust ja üks osa paari lühiküsimusega. Spetsiifiliste süntaksite (RDF, loogikavarandid jne) osas: ühtegi täpset süntaksit/võtmesõnu ei pea teadma, aga esitus peab olema õppejõule sisuliselt arusaadav. Millised on teemaküsimused ja millised on lühiküsimused:

SQL ja loogika: esitan paar tabelit ja küsin mõnda taolist küsimust:

  • nende sisu võimalikult täpset esitust esimest järku loogikas või RDFs
  • mõne konkreetse where- või join-päringu kirjutamist esimest järku loogikas

JSON-LD: annan JSON-LD jupi ja küsin selle tähendust ehk teisendust RDF kujule kolmikutena.

Reeglite esitamine: pane rdf ja/või rdfs kujule ja/või predikaatloogikale baseerudes kirja etteantud konkreetsed inimkeelsed väited.

Reeglite rakendamine klassikalises teoreemitõestamises: oskus teha käsitsi läbi väike resolutsioonimeetodi rakendamise näide, kui disjunktid ette antud.

Sõnavektorid ja N-grammid ja keelemudelite üldprintsiibid: arusaamine, oskus esitada väike näide töötamise kohta, võimalikud kasutus- või loomisstsenaariumd

Ebakindlate teadmiste esitamise põhimeetodid: pidevad (erinevat sorti tõenäosuste-tüüpi esitus) ja diskreetsed (eranditega süsteemid, eeskätt default logic). Siin võin tuua väikese näite ja küsida lahendust või palun ise esitada mõne pisinäite sobival kujul. Konkreetseid süntakseid teadma ei pea, piisab õppejõule arusaadavaks tegemisest.

Lühiküsimused (siit valitakse iga eksami jaoks paar):

Seleta paari lausega, mis asi on, vahel küsin ka näidet: freimiprobleem, open/closed world, blocks world, RAG, erinevad tõenäosuste interpretatsioonid, RDFa; mis asi on ja mida sealt umbes leida võib ja mida pigem mitte: schema.org, wordnet, conceptnet, yago, cyc; mida sa mäletad "semantiline parsimine" ja "visual reasoning" teemade kohta.

Eksamipäevad ja ajad

Siin on täpsustunud esimese kahe eksami ajad:

  • 27 mai, kolmapäev, kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium NRG-226.
  • 1 juuni, esmaspäev: eraldi eksamiajad hajussüsteemide (11:00) ja teadmiste esitamise (14:00) jaoks. Auditoorium SOC-211a.
  • 8 juuni, esmaspäev: kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium ICT-315.


Time, place, result

Lectures (Tanel): Mondays 12:00-13:30 room SOC 414
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122 MEK-109.

The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.

Please join the teams group of the course. The code for joining is zb3z457.

Weekly teams link for the lecture.

Weekly teams link for the practice session.

Grading

Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises.

The materials below marked with the red E1 are the main materials for the exam (10 of these on the page), while E2 materials (20 on the page) will also come up, but less and/or in a simpler form.

To finish the course successfully, you need to

  • successfully pass three practical works
  • receive at least 1/3 of the max points at exam
  • get practice work + weekly tasks + exam at least 50% points altogehter.

Contents overview: what the course is about

The theme of the course: from SQL to natural language.

Hence the main focus of the course is on hybrid methods for knowledge representation and reasoning: symbolic AI, machine learning / neural methods and their neurosymbolic combinations. We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks. A closely related subject is commonsense reasoning.

The course contains the following blocks:

  • Knowledge in SQL, RDF and JSON
  • Handling simple facts and rules in symbolic AI and logic
  • General-knowledge databases
  • Natural language and question answering
  • Uncertain knowledge and hybrid systems

Weekly tasks

The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture.

The first weekly task

Ülesanne on eksperimenteerida veidi logictools.org saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.

Konkreetselt tee järgmist:

  • Eksperimenteeri veidi logictools.org "simple examples" valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest.
  • Loe seejuures predikaatloogika väikest seletust about lehel kuni lausearvutuseni (seda pole enam otse vaja lugeda).
  • Kirjuta ise valmis näide vastavalt kursuse materjalile Background: relations of sql and logic lk pealkirjaga "SQL join as logical rule", kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):
client table: id name balance
1 john 100 
2 pete -200

cars table: id model owner
1 ford 1
2 opel 2
3 saab 2

select client.name, client.balance
from client where balance<0

select client.name, cars.model from client, cars
where client.id=cars.owner

Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.

  • Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna "formaliseerimine", et kirja kergesti üles leiaks.
  • Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!

Soovitused:

  • Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).
  • Aritmeetika jaoks vaata help teksti Arithmetic peatükki.
  • Väiksem-tingimuse jaoks vaata complex examples valikuboksis "arithmetic" näidet.


The second weekly task

Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.

Vaata alustuseks json-ld näiteid logictoolsi json-tabi alt. NB! Enamus näiteid "example" valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.


Practical work

There are three labs.

The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people.

Each lab is evaluated independently and gives the same number of points. NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.

First lab

The 2026 task for the first lab is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions.

Deadline: 10. March.

Second lab

The 2026 task for the second lab is about using a VLM (visual language model) to get a structured description from an image which would fit with the pre-existing simple world model.

Deadline: 7. April

Third lab: questions in NLP

This is the task for 2026:

Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner for images: 2026

Deadline: 12. May


Books to use

Main materials:

Other useful books and tools for symbolic K&R:

  • logictools.org for experimenting with classical automated reasoning
  • Symbolic reasoning themes are covered in this book with (hopefully) freely accessible pdf-s via Taltech. See also slides for the book.
  • Similarly, the freely accessible pdf of the handbook of knowledge representation gives a detailed and thorough coverage of the subject; far more than necessary for the course.
  • You may want to get a small intro to Prolog by reading the first 100 pages of a classic Art of Prolog book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.

Other useful material for neural NLP:

Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.

Blocks and lectures: the main content of the course

The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.


Block 1: knowledge in SQL, RDF and JSON

Lecture: Intro and background: 2. February

Intro presentation:

teadmised_intro2026.pdf

Recommended non-obligatory listening: Francois Chollet, Yann LeCun, Gary Marcus, Demis Hassabis, Ilya Sutskever, Ben Goertzel ,

Lecture: Nosql, json and rdf in databases: 9. February

Lecture materials:

See also

The weekly homework will be about trying out small things in logic: please try out logictools from "basics" to "equality" in simple examples selectbox. Details will appear after the lecture.

Block 2: handling simple facts and rules in symbolic AI and logic

Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February

Rdf example developed during lectureE2

Have a brief a look at this, no need to read thoroughly:

The main materials covered in the lecture:


And then have brief look (skim through) at:

Certainly read:

We will also start at looking and understanding the examples in logictools.org

More resources:

What the reasoner does:

We will consider the reasoning part of K&R to understand what provers do:

You may want to have a look at the additional materials - from easier to harder - from the

Lecture: DPP ontology development. 2. March

Loengu annab Riina. Digital Product Passport (DPP) kui näide praktilisest ontoloogia/sõnastiku arendamisest CIRPASS projektis.

Hetkeseisu algusleht.

CIRPASS-2

Ühikute ontoloogia

SHACL

UNTP DPP



Lecture: Next homework and looking into main large knowledge bases: 9. March

We will first present the next homework.

Then we will continue with existing large knowledge bases.

Slides:lecture slides E2, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool

You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.

About knowlege base creation using LLMs: have a look at this paper.

We will have a look at the goals, main content and differences between:


Block 3: natural language and question answering

Lecture: Intro to NLP, n-grams, word vectors: 16 March

Lecture: large language models (LLM) 23 March


Eesmärk: saada pinnaliselt aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.

Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.

Mida vaadata ja lugeda:

Eriti soovitav

Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.

Pikemaks lugemiseks:


Optsionaalselt üldisem arusaam klassikutelt:

Optsionaalselt diipim arusaam:

Lecture: RAG usage pattern / context engineering for LLMs : 30 March

Lecture material: this is focused on RAG and written in 2024 and spring 2025: good tool use, good reasoning and more autonomy like claude code and openclaw are not covered in this overview.

"Context Engineering" became a popular phrase in 2025: essentially it means "fancy RAG", i.e. significant effort put towards creating a really good set of additional information (prompt additions: "context") for each user query/prompt. It can also mean approaches for storing such additional information on the fly in special files which are then used RAG-like as extra input in addition to user dialog.For example, claude code memory principles and memory folder structure, openclaw memory.

Useful reading in addition to pointers in the lecture material:

Block 4: hybrid systems and uncertain knowledge

We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems

Lecture: issues in formalizing commonsense reasoning: open/closed world, frame problem, uncertainties: 6. April

First, open/closed world, world states, frame problem

The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks and put them on other blocks or on the table. The arm cannot lift several blocks or a tower of blocks. Then, given a position of blocks at initial situation, can the robot arm create a required new position of blocks? Can we get the steps required? For getting the steps we use the $ans predicate.

One hard issue arising is that how do we know that doing some action like lifting a block does not create side effects like stumbling existing towers, moving other blocks etc? This issue is called the frame problem and it has no easy solutions.

Importantly, the frame problem arises since normal first order logic has

  • the open world assumption: if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.

Prolog and databases operate under the

  • closed world assumption E1 (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog "negation" really means "cannot prove". One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about "true", "false" and "unknown". See also negation as failure in prolog


Please look at and read these materials about the frame problem:

These two readings are optional:

  • frame problem at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.
  • another classic about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.

You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: see this article.

Next, importantly, you should experiment yourself with gkc and both of the following files. Please copy and read the files and understand the encoding. At the end of the files are several queries to experiment with: instructions are also there. The simplest way to experiment is to use https://logictools.org/ . There is already a blocks world example available.

In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).

To get a simple visualization of the blocks world, have a look at this tiny video.


Second, uncertainty


Loengu sissejuhatava osa presentatsioon: Reasoning_with_uncertainty.pdf E1.

Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.

We will consider two different ways to tackle uncertainty:

  • Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.
  • Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people.

NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.

The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer Numeric uncertainty: (E2 up to and including the chapter 3, see also E2 tags inside)

  • Read carefully up to and including the chapter 4 "Different ways to encode confidences in logic" and have a quick look at all the wikipedia links. In particular, Wiki on Bayesian inference and this
  • Skim through the later parts and look only into these subchapters which you found interesting.

Next,

  • Read the paper E2 about confidences. containing intro, algorithms and experiments. Then look at the web page with the confer reasoner and a wealth of examples.
  • Read the paper E2 about exceptions (default logic). containing intro, alorithms and experiments. Then look at the web page with the gk reasoner and a wealth of examples.

Next, have a brief look at a good example system doing some specific kinds of probability reasoning:

Lecture: research in neurosymbolic reasoning: 13 April

lecture slides

The lecture will be given by our PhD student Otto Mättas.

Lecture: semantic parsing with LLMs and with UDP: 20 April

The focus of the lecture is on semantic parsing.

For a quick intro we will use Martin's slides from 2024 semantic parsing E2.

The rest of the lecture will explain stuff in nlpsolver. See the nlpsolver presentation.

Useful background:

About important concepts in parsing:

Some important toolkits and representation schemes:

Some draft parsing papers:


Lecture: we explore some recent papers in neurosymbolic reasoning: 27 April

A reading session: we will read and attempt to understand together some case studies.

Lecture: visual reasoning: 4. May

The lecture will be given by our postdoc researcher Mohit Vaishnav.

Lecture presentation E2

Related preprints:

Lecture: we continue exploring recent papers in neurosymbolic reasoning: 11 May

We look at some of the more interesting papers from each subarea (maybe not all the papers):

Logic focus:

Visual reasoning:

Planning:

Text-to-SQL:

Consultation for the exam: 18 May