<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://calicomills.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://calicomills.github.io/" rel="alternate" type="text/html" /><updated>2026-07-27T17:06:33+00:00</updated><id>https://calicomills.github.io/feed.xml</id><title type="html">Jishnu C K</title><subtitle>Home for blogs and project ideas, mostly related to Software Development.</subtitle><author><name>Jishnu C K</name></author><entry><title type="html">Teaching A Small Model To Withhold The Answer</title><link href="https://calicomills.github.io/2026/07/27/Teaching-a-Small-Model-to-Withhold-the-Answer.html" rel="alternate" type="text/html" title="Teaching A Small Model To Withhold The Answer" /><published>2026-07-27T00:00:00+00:00</published><updated>2026-07-27T00:00:00+00:00</updated><id>https://calicomills.github.io/2026/07/27/Teaching-a-Small-Model-to-Withhold-the-Answer</id><content type="html" xml:base="https://calicomills.github.io/2026/07/27/Teaching-a-Small-Model-to-Withhold-the-Answer.html"><![CDATA[<p>Imagine you are preparing for interviews. You open a problem, you stare at it, and you have no idea where to
start. So you ask an AI, and it hands you a complete, working, nicely commented solution in about four seconds.
You read it, it makes sense, you feel good about yourself. Two weeks later you get a variant of that same problem
in a real interview and your mind goes blank, because you never actually learned it. You watched someone else
learn it.</p>

<p>Richard Feynman had a way of describing this. If you cannot explain something in plain language, you do not
understand it, you have only memorised its shape. Reading a solution gives you the shape. It feels like
understanding right up until the moment you need the real thing.</p>

<p>So I built the opposite. <a href="https://www.asuralist.in">asuralist.in</a> is a DSA interview coach that refuses to give
you the answer. It names the pattern, asks you one pointed question, and makes you do the thinking. You can ask
for more, but you have to ask, and it makes you ask in stages.</p>

<p>One warning before you click. It runs on a CPU with no GPU, so replies are slow, sometimes very slow. That is
not a bug, it is the economics of the project, and I will come to why.</p>

<ul>
  <li><b>The model is the least interesting part</b></li>
</ul>

<p>I used qwen2.5-coder:1.5b. It is free, about a gigabyte, and runs on almost anything. It is also, to put it
kindly, not very bright. It cannot be trusted to follow an instruction like “do not show the code yet”. I know
this because I asked it to, politely, in several increasingly desperate ways.</p>

<p>The product here is not the model, it is the agent around it. What context it gets, what it is allowed to say,
what happens when it disobeys, and what the user finally sees. That layer is where all the engineering is, and
it is where all the value is. The model is a component you swap out.</p>

<p>The whole thing is a small state machine with four rungs:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>user message
     |
     +-- just the problem  -&gt;  rung 0 : name the pattern, ask one question
     +-- "I'm stuck"       -&gt;  rung 1 : point at the next decision
     +-- "give me a hint"  -&gt;  rung 2 : the approach in words
     +-- "show me"         -&gt;  rung 3 : the full solution
                                 |
                            model generates
                                 |
                        did it say too much ?
                          |            |
                        yes           no
                          |            |
                  strip it out      show it
</code></pre></div></div>

<ul>
  <li><b>Do not argue with the model</b></li>
</ul>

<p>My first attempt did the obvious thing. The system prompt said “do not write code”, the model wrote code anyway,
so I re-prompted it, and if it disobeyed twice I refused to show anything at all.</p>

<p>That was worse. I measured it, and on some runs three out of four coaching turns ended in a bare refusal. A user
typing “help” got stonewalled. I had built something that failed more rudely than it succeeded.</p>

<p>The fix was to stop arguing. The prose in a leaked reply is almost always fine, it is only the code block that is
not, so now I strip the block with a regex and keep the explanation. A regex always complies, a 1.5B model does
not.</p>

<p>That became the rule everywhere. Every time I caught myself writing a firmer instruction, I stopped and asked
whether I could make the thing structurally impossible instead. Usually I could, and the code got smaller.</p>

<ul>
  <li><b>Do not ask the model things you already know</b></li>
</ul>

<p>The app ships with 128 curated problems, and every one of them has a known pattern. Two pointers, sliding window,
Boyer-Moore voting. That is data I already have sitting in a file.</p>

<p>But my prompt was asking the model to work it out from scratch. A 1.5B model recalling “Boyer-Moore voting” from
its weights is a coin flip. Me looking it up in a dictionary is not. So I stopped asking, and the app now hands
the pattern to the model instead. Its job shrinks from knowing to phrasing, and phrasing it can actually do.</p>

<p>That led to my favourite failure of the whole project. I told it the pattern was Boyer-Moore voting and told it
not to explain the mechanism. It explained the mechanism. So I removed the mechanism from the prompt entirely,
reasoning that it cannot leak what it was never given.</p>

<p>It leaked anyway. It reconstructed the candidate and counter trick from its own weights, because for a named
algorithm the name is the explanation. You cannot say “Boyer-Moore” and withhold Boyer-Moore. If you already
know the answer, do not make the model say it, render it yourself and give the model the one job it is good at.</p>

<ul>
  <li><b>You cannot tune what you cannot measure</b></li>
</ul>

<p>For a while I was doing what everyone does with LLMs. Tweak the prompt, look at the output, decide it feels
better, move on. That is not engineering, that is vibes.</p>

<p>So I built an eval harness. It replays scripted model responses through the real agent code and asserts on what
the user actually saw, not on some internal flag. It turned “the coach feels leaky” into a number I could watch.</p>

<p>The first thing it told me was embarrassing. My intent router, a list of regexes deciding whether you want an
explanation or a fix, scored 14 out of 20. The failures were funny once I could see them. “add error handling”
was read as a debug request because “error” matched before “add”. “write a test for two sum” was read as a
request to run something because “test” matched before “write”. And “my code crashes” matched nothing at all,
because the regex looked for “crash” and the word was “crashes”. The patterns were not stemmed, so singular and
plural went down different code paths. I would never have found that by reading output.</p>

<p>There are 163 tests now. Most of them exist because something surprised me.</p>

<ul>
  <li><b>Why free models will be used more</b></li>
</ul>

<p>The instinct when something is hard is to reach for a bigger model, and often that is right. But it is worth
noticing what a small local model actually buys you.</p>

<p>It is free, not cheap but free, and no per-token cost means you can retry, verify and re-run in loops that would
be silly against a metered API. It is private, the code never leaves the machine, which matters for a tool people
paste half finished interview answers into. And it is yours, with no rate limits and no vendor changing the model
underneath you.</p>

<p>The catch is speed. On the box running asuralist.in the model generates at 0.85 tokens per second. A short hint
takes minutes. The same model on my laptop answers in seconds, and the entire difference is one shared vCPU with
no GPU. I could fix that with a credit card. I have left it alone because it makes the trade visible, this is
what free actually costs and the bill is paid in latency instead of dollars.</p>

<p>My bet is that the gap keeps closing. Most of what people reach for a frontier model to do, classify this,
rephrase that, pull these fields out, does not need one. It needs a well built agent around a modest model.</p>

<ul>
  <li><b>The unglamorous part</b></li>
</ul>

<p>Getting this deployed took an embarrassing number of attempts, and I am including it because this is the part
that usually gets edited out.</p>

<p>First the platform ignored my Dockerfile and tried to autodetect a build, and found nothing. Then the app could
not reach the model service, and the error message said, in full, “request failed”. I improved the error
handling, and it started saying “HTTP 502” followed by a wall of Cloudflare HTML. It turned out the edge was
replacing my error responses with its own page, so every layer trying to explain the problem was having its
explanation thrown away. And underneath all of it, the model service did not exist yet. I had spent hours
carefully configuring a URL that pointed at nothing.</p>

<p>The lesson I took from that was to stop guessing and build the instrument. I added a health endpoint that reports
what the app can genuinely see, which address it is dialling, whether it resolves, which models are loaded and
whether they are in memory. Ten minutes of work that would have saved me two hours if I had written it first.</p>

<ul>
  <li><b>Try it</b></li>
</ul>

<p><a href="https://www.asuralist.in">asuralist.in</a>. Pick a problem on the left and resist the urge to press “show me the
solution”. It will be slow, it is a 1.5 billion parameter model on a CPU doing its best. Give it a moment and it
will ask you a better question than you expected.</p>

<p>Built with React, CodeMirror, Pyodide so that Python runs in your browser and nothing executes on my server,
Express, and Ollama. Source is on <a href="https://github.com/calicomills/coachLLM">GitHub</a>.</p>]]></content><author><name>Jishnu C K</name></author><summary type="html"><![CDATA[Imagine you are preparing for interviews. You open a problem, you stare at it, and you have no idea where to start. So you ask an AI, and it hands you a complete, working, nicely commented solution in about four seconds. You read it, it makes sense, you feel good about yourself. Two weeks later you get a variant of that same problem in a real interview and your mind goes blank, because you never actually learned it. You watched someone else learn it.]]></summary></entry><entry><title type="html">Django Render Models Dynamically Using Generators</title><link href="https://calicomills.github.io/2022/10/03/Django-Render-Models-Dynamically-using-Generators.html" rel="alternate" type="text/html" title="Django Render Models Dynamically Using Generators" /><published>2022-10-03T00:00:00+00:00</published><updated>2022-10-03T00:00:00+00:00</updated><id>https://calicomills.github.io/2022/10/03/Django-Render-Models-Dynamically-using-Generators</id><content type="html" xml:base="https://calicomills.github.io/2022/10/03/Django-Render-Models-Dynamically-using-Generators.html"><![CDATA[<p>Imagine a platform that would let you build analytics dashboards or a website like shopify.com, how do they build the database tables, ORMs and the necessary backend functionality required to power your specific website. For a start in Django, if we give the user the ability to pick the fields he wants in his dashboard, to implement that feature completely we need also make those entries in models.py.</p>

<p>The following is a start/attempt to render models.py taking the fields as input from the user.(Also handles the Meta class attributes.)</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>class ClassEngine:
    def __init__(self):
        pass
    def class_generator(self, class_name, **kwargs):  
        yield f"class {class_name}: \n"
        meta_class_req = False
        meta_fields = []
        if kwargs.get('meta_fields', None):
            meta_class_req = True
            meta_fields = kwargs.pop('meta_fields')

        for key in kwargs:
            if key not in meta_fields:
                yield f"\t{key} = {kwargs[key]}\n"

        if meta_class_req:
            yield f"\tclass Meta: \n"
            for field in meta_fields:
                yield f"\t\t{field} = {kwargs[field]}\n"


class FileEngine:
    IMPORTS = {'models.py' : ['from django.db import models']}
    def __init__(self):
        pass
    def import_generator(self, file_name):
        for import_st in self.IMPORTS[file_name]:
            yield f"{import_st} \n"
</code></pre></div></div>

<p>Now, to create the models.py with the necessary input fields.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>from dynamic_django import FileEngine, ClassEngine

fg = FileEngine().import_generator('models.py')
cg = ClassEngine().class_generator("ModelClass", ref_id = "models.CharField()", fields = ['ref_id'],
                                   value = "models.IntegerField()", meta_fields = ['fields'])


with open("models.py", 'w') as f:
    for line in fg:
        f.write(line)

    for line in cg:
        f.write(line)
</code></pre></div></div>

<p>Similarly I believe we would be able to generate all the other necessary files which are required for a Django app dynamically, without going to the pain of manually generating all the files. #DRY</p>

<p>The generated models.py:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>from django.db import models 
class ModelClass: 
  ref_id = Models.CharField()
  value = Models.IntegerField()
  class Meta: 
    fields = ['ref_id']
</code></pre></div></div>]]></content><author><name>Jishnu C K</name></author><summary type="html"><![CDATA[Imagine a platform that would let you build analytics dashboards or a website like shopify.com, how do they build the database tables, ORMs and the necessary backend functionality required to power your specific website. For a start in Django, if we give the user the ability to pick the fields he wants in his dashboard, to implement that feature completely we need also make those entries in models.py.]]></summary></entry><entry><title type="html">Django Creating Drop Down Menu Using Forms</title><link href="https://calicomills.github.io/2022/09/25/Django-Creating-Drop-down-menu-using-Forms.html" rel="alternate" type="text/html" title="Django Creating Drop Down Menu Using Forms" /><published>2022-09-25T00:00:00+00:00</published><updated>2022-09-25T00:00:00+00:00</updated><id>https://calicomills.github.io/2022/09/25/Django-Creating-Drop-down-menu-using-Forms</id><content type="html" xml:base="https://calicomills.github.io/2022/09/25/Django-Creating-Drop-down-menu-using-Forms.html"><![CDATA[<p>Forms are an integral part of Django, and it facilitates the framework to accept inputs from the user in a safe and secure manner. 
It allows one to restrict the type and size of data entered, thus acting as an initial filter layer before the data reaches the back-end. 
This helps reining in the post processing to be done and reduces the chance of errors creeping in.</p>

<p>Here I explain how to render a drop down menu (shown below) which consist of a list of indexes queried from a database or a predefined 
list to the front-end.</p>

<p><img src="https://user-images.githubusercontent.com/24970675/192160595-7bb8d646-af8d-4cde-b6e3-6bb7be896f91.png" alt="image" /></p>

<p>Firstly, we create the model for the form field in models.py which would be used to model the form object in forms.py , 
here you can also specify various restrictions on the form fields.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> class Label(models.Model):
      label = models.CharField(max_length=50,null=False)
      label_ref = models.CharField(max_length=50,null=False)
</code></pre></div></div>

<p>Now in forms.py we override the LabelForm class, so that we are able to customize the data that goes into the label and label_ref fields.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>class LabelForm(forms.ModelForm):
        class Meta:
                  model = Label
                  fields = ['label','label_ref']

        def __init__(self,  *args, **kwargs):
            self.param_name = kwargs.pop('param_name')
            self.new_table = kwargs.pop('new_table')
            self.ref_table =  kwargs.pop('ref_table')
            super(LabelForm, self).__init__(*args, **kwargs)
            self.fields['label'].queryset = self.new_table.objects \
                                                        .filter(param_name__startswith=self.param_name) \
                                                        .order_by('label') 
            self.fields['label_ref'].queryset = self.ref_table.objects \
                                                            .filter(param_name__startswith=self.param_name) \
                                                            .order_by('-label') 
            self.fields['label'].label ="New Label"
            self.fields['label_ref'].label ="Reference Label"

        label = MyModelChoiceField(queryset=None, error_messages={
                                           'invalid_choice': ('Select a valid choice')
                                            }, to_field_name="label")
        label_ref =  MyModelChoiceField(queryset=None,error_messages= {
                                                'invalid_choice': ('Select a valid choice')
                                                 }, to_field_name="label_ref")
</code></pre></div></div>

<p>In views.py , we can provide different types of data and instantiate the LabelForm class to suit our requirements.
   These inputs can be used to query all types of data from the database , and can be passed on to different fields in the front-end through a queryset. 
   This feature greatly enhances the dynamic nature of the front-end, as this can be use to render different type of forms to different users or on 
   basis of other inputs.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  form =  LabelForm(initial={ 'label': latest_run_label,
                              'label_ref': latest_run_label,
                              'choices':(latest_label,latest_label)},
                              param_name=param_name,new_table=db_class,ref_table=db_class)
</code></pre></div></div>

<p>The html code used to render the form is shown below, the form object is passed to the Django template using the django.shortcuts.render() in views.py.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    &lt;form action="" method="post"&gt;
          &lt;ul&gt;
              &lt;li&gt;
                  {{ form.label.label }}
                  {{ form.label }}
                  {{ form.label_ref.label }}
                  {{ form.label_ref }}
             &lt;/li&gt;
      &lt;/form&gt;
</code></pre></div></div>

<p>Email : jishnuck26@gmail.com <br />
LinkedIn : (https://www.linkedin.com/in/jishnuck/)
<a href="https://www.amazon.in/gp/search?ie=UTF8&amp;tag=26120bd-21&amp;linkCode=ur2&amp;linkId=5696dc7fc82d9b7e82449d2304baacdb&amp;camp=3638&amp;creative=24630&amp;index=books&amp;keywords=Software,%20Technology">Books that helped me</a></p>]]></content><author><name>Jishnu C K</name></author><summary type="html"><![CDATA[Forms are an integral part of Django, and it facilitates the framework to accept inputs from the user in a safe and secure manner. It allows one to restrict the type and size of data entered, thus acting as an initial filter layer before the data reaches the back-end. This helps reining in the post processing to be done and reduces the chance of errors creeping in.]]></summary></entry><entry><title type="html">Django Custom Manager Class</title><link href="https://calicomills.github.io/2022/09/25/Django-Custom-Manager-Class.html" rel="alternate" type="text/html" title="Django Custom Manager Class" /><published>2022-09-25T00:00:00+00:00</published><updated>2022-09-25T00:00:00+00:00</updated><id>https://calicomills.github.io/2022/09/25/Django-Custom-Manager-Class</id><content type="html" xml:base="https://calicomills.github.io/2022/09/25/Django-Custom-Manager-Class.html"><![CDATA[<ul>
  <li><b>Django Models: Overiding the default queryset by using your Custom Manager class</b></li>
</ul>

<p>When you have data that should only be viewed by certain users, you need to have a filtering mechanism that selects only those particular rows in your database table that can be channeled to the front-end.</p>

<p>Here we enhance the Django models.Manager class to further our querying capabilities of the database table. The generic “filter” method is fairly limited when it comes to implementing more complex logic, in this case to display data to a user only if he has the necessary permissions to view it.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>      from django.db import models

      from user import User

      class DesignPermissionManager(models.Manager):
            def permissions_match(self, d_permissions, u_permissions):
                d_permission_list = d_permissions.split(',')
                for permission in d_permission_list:
                    if permission in u_permissions:
                       continue
                    else:
                       return False
                return True

            def get_viewable_data(self, user):
                      viewable_refids = []
                      for data in self.all():
                          if self.permissions_match(data.permissions,User.getPermissions(user)):
                             viewable_refids.append(data.id)
                      return self.filter(ref_id__in=viewable_refids)
</code></pre></div></div>

<p>The method get_viewable_data takes the user, filters the table, and limit it to rows that the specific user has access to.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>      class Main_View(View):
            def get(self, request, name):
                user = str(request.user)
                data = main_table.objects.get_viewable_data(user) \
                                         .order_by('-name') \
                                         .values()
</code></pre></div></div>

<p>In views.py which powers the front-end in Django, we can easily get the user info from the request object and pass it to our filtering method , and thus restrict the user to the data he has permission to.</p>]]></content><author><name>Jishnu C K</name></author><summary type="html"><![CDATA[Django Models: Overiding the default queryset by using your Custom Manager class]]></summary></entry></feed>