<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chananop W on Medium]]></title>
        <description><![CDATA[Stories by Chananop W on Medium]]></description>
        <link>https://medium.com/@chananop.w?source=rss-abfc5c5f8431------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Chananop W on Medium</title>
            <link>https://medium.com/@chananop.w?source=rss-abfc5c5f8431------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:55:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chananop.w/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Custom Ragas metrics for Thai language]]></title>
            <link>https://medium.com/ibm-watsonx-th/custom-ragas-metrics-for-thai-language-0082ea9b54d5?source=rss-abfc5c5f8431------2</link>
            <guid isPermaLink="false">https://medium.com/p/0082ea9b54d5</guid>
            <dc:creator><![CDATA[Chananop W]]></dc:creator>
            <pubDate>Tue, 27 Aug 2024 07:29:47 GMT</pubDate>
            <atom:updated>2024-09-04T07:54:09.517Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ragas metrics for Thai language</h3><p>Authors: <a href="https://medium.com/u/27133606626e">tanyaaton</a>, <a href="https://medium.com/u/7082220e4952">Mew Leenutaphong</a>, <a href="https://medium.com/u/abfc5c5f8431">Chananop W</a> <a href="https://medium.com/u/11447b74e01c">Pongsasit Thongpramoon</a></p><p>As RAG applications are being built and productionized, the necessity for comprehensive monitoring and evaluation of NLP models becomes increasingly important.</p><h3>Introduction</h3><ol><li><strong>Using BLEU,ROGUE score to evaluate</strong></li></ol><ul><li>BLEU Score is the assessment of similarity between the machine-translated text and the reference translations using n-grams, which are contiguous sequences of n words. N-grams used are unigrams (single words), bigrams (two-word sequences), trigrams (three-word sequences), and so on.</li><li>ROGUE Score is the assessment of the similarity between the machine-generated summary and the source summaries using overlapping n-grams.</li></ul><p><strong>2. Using Custom Ragas metrics to evaluate</strong></p><ul><li>Ragas is a framework that helps evaluate your Retrieval Augmented Generation (RAG) pipelines. Ragas also consists of multiple method which for example are Faithfulness score, Answer relevancy score, Context recall score, Context precision score and etc. <a href="https://docs.ragas.io/en/stable/">https://docs.ragas.io/en/stable/</a>. -&gt; For optimal performance and capturing semantic meaning this is preferred way as it uses LLM rather than Ngram to evaluate.</li></ul><h3>How does these metrics compare to Thai Language?</h3><p>Thai language syntax differs from English, as Thai words are written without spaces between them (‘thaiwordarelikethis’), making it unsuitable for n-gram-based evaluation methods like BLEU and ROUGE. These methods, which rely on n-gram overlap to assess text, struggle to accurately evaluate Thai text since they can’t separate words that are packed together. Consequently, BLEU may inaccurately assess meaning and fluency in Thai, and ROUGE, which also depends on n-grams, may not optimally evaluate Thai language content.</p><p>Currently the RAGAS metrics is built based on GPT-4o model, which from a few testing in Thai language we get that the evaluation isn’t as good compared to english. Hence, we built a custom RAGAS repository based on llama3.1 models in IBM watsonx.ai (Smaller but cost effective model)</p><h3>Using Custom Ragas metrics to evaluate Thai language content</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-lvUx1Xq-UDOV475ik3FMg.png" /><figcaption>Source : <a href="https://docs.ragas.io/en/latest/concepts/metrics/index.html">https://docs.ragas.io/en/latest/concepts/metrics/index.html</a></figcaption></figure><p>We focus on two scores for this repository (Faithfulness and answer relevency)</p><ol><li><strong>Faithfulness</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_hkTmVSzQ9q6Prz43I8fQ.png" /><figcaption><a href="https://docs.ragas.io/en/latest/concepts/metrics/faithfulness.html">https://docs.ragas.io/en/latest/concepts/metrics/faithfulness.html</a></figcaption></figure><p>Faithfulness score is a methods for measuring the factual consistency of the generated answer compared to the given context. It is calculated from answer and retrieved context.</p><p><strong>2. Answer Relevancy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qT59A9-qy9ZwyU0kJ4BnHg.png" /><figcaption><a href="https://docs.ragas.io/en/latest/concepts/metrics/answer_relevance.html">https://docs.ragas.io/en/latest/concepts/metrics/answer_relevance.html</a></figcaption></figure><p>Answer Relevancy, is a methods of evaluating generated content which focuses on assessing how relevant the generated answer is comparing to the given prompt.</p><h3>We implemented an opensourced repo — integrated with ibm watsonx.ai and Traditionally we used GPT4 to evaluate but in this case we decided to use llama3.1 to optimize cost.</h3><p>Once we have chosen llama3.1 we pre-generated 80 HR policy related questions assessing with different areas like numerical, out of context, suggestions and etc. [repo link to be released]</p><p>you can directly modify the model used to evaluate/ path to evaluate model performance in a settings.yaml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*46TFiTFkZu0_7I_hTMSiRA.png" /></figure><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*BdxJ6KhbSifa4rrnk0HS3g.png" /><figcaption>Using Faithfulness Score to evaluate models</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*HvgOZpDf1SG2McfPHq_NNQ.png" /><figcaption>Using Answer Releavancy Score to evaluate models</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCe4MCIzYaTVCRfhucIHMg.png" /><figcaption>Using custom metrics for evaluation</figcaption></figure><pre>def prompt_generation(reference, question, written_answer, answer):<br>    messages = {<br>        &quot;messages&quot;: [<br>            {<br>            &quot;content&quot;: &quot;You are a careful grader tasked with evaluating the differences between a response from a model and an answer written by a human.&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>            },<br>            {<br>            &quot;content&quot;: f&quot;&quot;&quot;User question: {question}<br><br>Sources that was retrieved from vector database (Could be right or wrong):<br>{reference}<br><br>Model Answer written by human which is always right:<br>{written_answer}<br><br>Response from the model:<br>{answer}<br><br>Model Grading Criteria:<br><br>Accuracy of Information (0-4 points):<br>4 points: The response is perfectly accurate, matching the model answer without any discrepancies.<br>2-3 points: Minor differences from the model answer are present, but they do not significantly distort the informational content.<br>0-1 point: Major discrepancies from the model answer, or content not found in the model answer, greatly affecting the response&#39;s credibility.<br><br>Relevance and Completeness (0-3 points):<br>3 points: The response completely aligns with the model answer in terms of relevance, addressing the query in full.<br>1-2 points: The response generally aligns with the model answer but misses some important nuances or aspects.<br>0 points: Significant deviation from the model answer in terms of relevance or completeness, missing key portions of the query or altering the intended information.<br><br>Clarity and Coherence (0-2 points):<br>2 points: The response maintains the clarity and structure of the model answer, well-structured and coherent.<br>1 point: Minor deviations in clarity or coherence from the model answer, with some grammatical/style issues or logical inconsistencies.<br>0 points: Major divergence from the model answer in terms of structure or coherence, difficult to understand or poorly articulated.<br><br>Traceability (0-1 point):<br>1 point: All information in the response can be directly traced to and aligns with the model answer.<br>0 points: The response introduces conjectures or contains untraceable pieces of information not aligned with the model answer.<br><br>Qualitative Feedback:<br>Compare the model response with the human written response as the ground truth, to grade the model response out of 10.<br><br>Response Format:<br>Score out of 10: []<br><br>Response:&quot;&quot;&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>            },<br>            {<br>            &quot;content&quot;: &quot;Score out of 10: [&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>            },<br>        ]<br>    }<br>    return messages[&quot;messages&quot;]</pre><p>The above is the prompt used for custom metrics.</p><p>We can see that by utilizing these method to evaluate the model the model which performs best in terms of faithfulness is <a href="https://huggingface.co/meta-llama/Meta-Llama-3-70B">Meta-Llama-3–1–70B</a>, for answer relevancy is <a href="https://huggingface.co/meta-llama/Meta-Llama-3-8B">Meta-Llama-3–8B</a> and the model which is the best when for custom metric is <a href="https://huggingface.co/meta-llama/Meta-Llama-3.1-405B">Meta-Llama-3.1–405</a>.</p><h3>Conclusion</h3><p>In conclusion, with Thai language character being tightly placed next to each other without spaces in between. We suggest using the method of implementing Custom Ragas metrics as it process the evaluation output by utilizing LLMs capability. Which means that we can ignore the condition of Thai language’s syntax and process the output more efficient than BLEU, ROGUE score method due to the BLEU and ROGUE scoring method relying heavily on N-grams.</p><p>On the other hand, as we know that BLEU and ROGUE score relies heavily on N-grams. BLEU and ROGUE score might be more suitable to utilize these score to evaluate the content which are generated in other languages that have space between words instead(eg. English, Spanish and etc.).</p><p>References: <a href="https://medium.com/@sthanikamsanthosh1994/understanding-bleu-and-rouge-score-for-nlp-evaluation-1ab334ecadcb">https://medium.com/@sthanikamsanthosh1994/understanding-bleu-and-rouge-score-for-nlp-evaluation-1ab334ecadcb</a><br><a href="https://docs.ragas.io/en/latest/concepts/metrics/answer_relevance.html">https://docs.ragas.io/en/latest/concepts/metrics/answer_relevance.html</a><br><a href="https://docs.ragas.io/en/latest/concepts/metrics/faithfulness.html">https://docs.ragas.io/en/latest/concepts/metrics/faithfulness.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0082ea9b54d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watsonx-th/custom-ragas-metrics-for-thai-language-0082ea9b54d5">Custom Ragas metrics for Thai language</a> was originally published in <a href="https://medium.com/ibm-watsonx-th">ibm-watsonx-th</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>