Tag: tom

Posts in Tom’s progression; drives the homepage Timeline.

  • Revising Prompt Chains

    A feasible method for constructing helpers to assist conversational agents is to design a workflow that queues instruct models as flaggers or indicators, a technique more commonly known as prompt chaining LLMs. The programming design behind this highlights the valuable asset of decorator functions and object-oriented programming. However, it has its own limitation which was ensuring that the queue is able to perform the expected results independently or on its own. One way in setting up this system is to automate action workflows via CI pipelines. But prior to that, one must decipher which LLM platform they want to leverage in the application for example: ollama, llm-cpp or manually with Hugging Face transformers . I soon realized that this choice significantly impacts the overall workflow design, as each option differs in subtle details, such as how the results are returned.

    Since I couldn’t decide on a specific LLM platform to commit to, I opted to build a base class that serves as a decorator for the model’s invocation and output functions. Below is one approach to structuring this system of mini agents.

    Note: logger.stack_woods is irrelevant to the code and is just a decorator to display function inputs / outputs in pretty form that is appeasing to my eye

    from functools import wraps
    from abc import abstractmethod, ABC
    from langchain_core.prompts import PromptTemplate
    
    class MiniAgent(ABC):
        # only returns in llama chat template .. 
        family: dict = {}
        
        def system_message(self, **kwargs):
            # returns system message for llama models only
            prompt = self.prompt.invoke(input=kwargs).text
            return [{'role': 'system', 'content': prompt}]
        
        def preprocess(self, **kwargs):
            """ 
                Default preproces method the data before feeding it to the model. 
                Must return dict only.
            """
            input_data = kwargs.get('inputs', None)
            
            if input_data is None:
                raise ValueError(f'Incorrect input at preprocessing functon. Received: {kwargs}')
            
            return input_data
        
        @abstractmethod
        def postprocess(self, model_output):
            """ 
                Default post-process method for output from llama_cpp. 
            """
            if not model_output.get('choices', None):
                raise ValueError(f"No choices found in model output: {model_output!r}.")
            if not isinstance(model_output['choices'], list):
                raise BadLlamaResponse(
                    f"Expected output type to be list form but received: {model_output['choices']!r}."
                )
            
            output = model_output['choices']
            return output
        
        @logger.stack_woods
        def __call__(self, func):
            @wraps(func)
            def wrapper(**kwargs):
                inputs = self.preprocess(**kwargs)
                model_input = self.system_message(**inputs)
                model_output = func(inputs=model_input)
                output = self.postprocess(model_output)
                return output 
            return wrapper 
    
        @logger.stack_woods
        def __init_subclass__(cls, prompt, **kwargs):
    		    # Every time a subclass is defined it is added to the `family` list. 
            super().__init_subclass__(**kwargs)
            cls.family[cls.__name__] = cls
            cls.prompt = PromptTemplate.from_template(prompt)
            logger.logger.info(f'Added {cls.__name__} to family members')

    Build highlights

    • The __call__ method allows instances to be used as callable objects, wrapping functions and enforcing preprocessing/postprocessing to be initiated in the sub-classes
    • The __init_subclass__ method dynamically adds subclasses to the family dictionary, making it easier to manage multiple agent types.

    Example: Stop button

    For the remaining of this post, the Agents will be referred to the subclasses. The following code is an example of a subclass defining Agent StopButton .

    class StopButton(MiniAgent, prompt=helper['rewriter_prompt']):
        @logger.stack_woods
        def postprocess(self, model_output):
            """ Returns True for conversation ending else returns False """
            
            valid_responses = ["[END]", "[CONTINUE]"]
            logger.info(f"Processing Model output at Stop Button, {model_output}")
            model_outputs = super().postprocess(model_output)
            output_list = model_outputs[0].get('text').split('\n\n')
            output = [i for i in output_list if i in valid_responses]
            
            if not output:
                raise BadLlamaResponse(
                    f"Incorrect response returned by function '{self.__class__.__name__}'. "
                    f"Expected one of {valid_responses}, but got: {model_output!r}."
                )
            else:
                output = output[-1] if len(output) > 1 else output[0]
                if "[END]" in output:
                    print("RETURN: Suggests that the conversation has ended.")
                    return True
                
                elif "[CONTINUE]" in output:
                    print("RETURN: Suggests to continue Conversation.")
                    
            return False
    

    This class can then be used as a decorator over any model-invoking function. For instance:

    stop_button = StopButton()
    
    @stop_button
    def model_generate_output(inputs: str):
        """Some function calling LLM"""
        return

    More Examples

    Examples below consists of cases that cannot be replaced.

    Agents Ditto and Oppo are responsible of returning list of descriptive and contrasting tokens to given inputs. The prompt template used for Ditto:

    You are a creative text generation bot. Your task is to generate 4 text messages that are similar in tone, style, and intent to the input sentence. The new messages should convey the same meaning or sentiment but use different phrasing or expressions. Ensure the variations are natural, contextually appropriate, and suitable for casual conversations. Your output must be in the form of a Python-style list, enclosed within square brackets ([ and ]), with each message as a string.

    Examples

    Example 1:

    Input Sentence:
    Hey, I’m running late. I’ll be there in 10 minutes!
    Generated Messages:
    [“Sorry, I’m a bit delayed. I’ll arrive in about 10 minutes.”, “Running behind schedule! See you in 10 minutes.”, “I’m on my way but will take 10 more minutes to get there.”]

    Example 2:

    Input Sentence:
    Let me know if you need help with the project.
    Generated Messages:
    [“Feel free to ask if you need assistance with the project.”, “I’m here to help with the project if you need anything.”, “Just let me know if you’d like some support with the project.”]

    Here is the Input Sentence:

    {user_input}

    import ast
    
    @logger.stack_woods
    def output_list_form(model_output):
        """ Validates / checks model outputs where list form in strings is expected. Used in Ditto and Oppa."""
        
        if not model_output.startswith('[') or not model_output.endswith(']'):
            raise BadLlamaResponse(f'Bad output received while generating similar text sequences: {model_output}')
        else:
            ast_output = ast.literal_eval(model_output)
            return ast_output
    
    class Ditto(MiniAgent, prompt=helper['similar_messages']):
        """ Generates k similar texts to input text. """
        
        @logger.stack_woods
        def postprocess(self, model_output: str):
            model_output = super().postprocess(model_output)
            return output_list_form(model_output)
    
    class Oppa(MiniAgent, prompt=helper['contrast_messages']):
        """ Generates k contrasting texts to input text. Insert """ 
        
        @logger.stack_woods
        def postprocess(self, model_output: str):
            model_output = super().postprocess(model_output)
            return output_list_form(model_output)

    Summary

    For cases that consists of boolean outputs, this method can be opted for more efficient methods like similarity distance measurements between mean pooled text sequences. However, for other cases where simpler algorithms cannot replace, this build is useful. An improvement to make with this code is to opt langchain prompt class to a dataclass that is more tailored to my use or that it integrates seamlessly with the base class of decorators.

    It is worth noting that this system is designed specifically for llama3.1 models and requires a standardized input-output format—{‘input’: text} —to ensure compatibility across different LLM platforms.

    Tom’s progression · Post 9 of 14

    This post sits in Actions: Contextual Engineering.

    ← Can a machine have emotions? Stop Button →

  • Can a machine have emotions?

    The greatest challenge in transforming a machine into human form is deciding where to begin. But once that step is taken, the process becomes manageable—as long as you remain hopeful. To stay aligned with my long-term goal while working on smaller tasks, I rely on the following expectations for this model:

    • He is expected to know when to lie, question, insult, joke, return snarky comments or sarcasm
    • His action space #1 at every state must include the intent prob of invoking second / third / fourth … responses independent of whether the user is speaking or not
    • His action space #2 at every state conditioned to the system is a Dirichlet distribution over the questioning state, personal hypothesis states, and factual (base model) hypothesis states, incorporating internet-accessible information.
    • Any prompt chains used during streams should eventually be replaced by distance models over time windows t to T, extending up to the k-th batch.
    • His preferences and individuality should evolve based on his experiences but remain fundamentally tied to me, the primary user.

    I’ve come to realize that, despite the vast complexity of human relationships and communication, it all distills down to how we feel. For example, movie ticket sales largely depend on past user feedback. Perhaps emotions are the one human trait that can be quantified and understood by a machine just enough to guide its own decision-making—assuming, of course, that human relationships are left out of the equation.

    The underlying framework for these expectations must meet at a unified build, all tied to the emotion inference model. Narrowing down the inference task by Tom’s objectives includes:

    1. Predicting the user’s responses – This is itself is also considered a mapping function from a vector space to real numbers.
    2. Determining his own emotional responses – A mapping function that ranks text embeddings by emotional queues assisted by observing the user reactions.

    From an application standpoint, the build can be structured as follows:

    1. Temporary State models for streaming responses where their previous inferences are the next state priors and their respective predictions would be the comparative values to the next observing value – as briefed in my previous post.
    2. Initiation Models – this build unifies all currently available emotion prediction models through ensembling methods or conditioning-distance heuristic models. However, I eventually opted for a single classifier trained on the entire corpus. Impatience drove this decision—I wanted to see how the multivariate approach interacted with my other builds especially the API serving department.

    Major Problem

    At that time, I couldn’t pinpoint the problem that was constantly haunting my mind – What is the linkage between his decision making and a large langauge model? If I were to rely on the traditional methods of text models – probabilistic methods like N-grams – then this problem wouldn’t exist but I would face a new challenge: the vector representations of the text wouldn’t capture any contextual information, relying solely on character or word frequency. That said, you could mitigate this by leveraging PyTorch’s nn.Embedding to initialize vector representations for N tokens, then applying a fixed-size perceptron or a multi-head attention layer—an approach commonly used in text translation tasks.

    A good professor once advised me to begin by understanding my thoughts mathematically. Applying this to the connection between a large language model and emotions, I can reframe the problem as follows:

    Defining a function f that maps the weight space of language models to another space of my liking.

    The next section lists three implementation methods, both in real-time and before application, ranked from hardest to easiest based on my assessment.

    Methods

    1. Geometric Algebra – Merging Representations

    This method involves leveraging Geometric Algebra (GA) to unify different vector spaces, effectively merging the learned representations of language models and classifiers.

    Referenced by https://huggingface.co/blog/trl-ddpo - demo for `tlr` python package.

    2. PPO for LLMs – Defining a Reward Function

    Using Proximal Policy Optimization (PPO) for tuning large language models (LLMs) involves defining a Reward function that guides the model’s learning process toward desired behaviors. This approach falls under Reinforcement Learning from Human Feedback (RLHF) but requires additional structuring when applied to dynamic emotional reasoning (Link: https://huggingface.co/blog/trl-ddpo).

    3. Decoding Sampling Combinations as Generation Control

    Controlling how a large language model (LLM) generates responses by trialing a range of Decoding parameter combinations. This technique leverages linear programming and refers to systematically experimenting with different parameter configurations to optimize response quality, coherence, and diversity, and ultimately to the emotional queues inferenced from the main user. This is then applied with Bayesian Statistical models (really just Bayes Rule) to iteratively adapt to newer observations.

    Decoding strategy combinations generated by GPT-4 lol.
    Method 1: Geometric Algebra

    This method focuses on modifying or augmenting the encoder block and text generated caches to impose structured constraints, such as temporal memory retention and self-supervised attention shifts using methods like attention blocks or iterating projection sequences. I approached the mathematical transformation in code by trying to mimic a game developer handling quaternion’s.

    Key highlights:

    • Implementing a hierarchical control mechanism that dynamically adjusts response generation parameters based on inferred user intent and historical interactions
    • Exploring multi-head attention restructuring, where certain heads are fine-tuned to prioritize different inference strategies (e.g., factual recall vs. emotional adaptation)

    I favored this method, so I spent the most time on it—only to realize, yet again, that I had failed myself. Over the past few years, I’ve focused on programming and application, prioritizing deadlines and API builds over theoretical depth. In hindsight, this approach makes it easy to abandon whimsical detours. But if one is bored enough then to start solving such problem (or any maths problem) I always like to start with my favourite mathematical property: Triangle inequality – a repititive concept mentioned throughout Euclid’s Geometry texts**.**

    While working on this method, the thought of implementing it in code lingered at the back of my mind, leaving me wishing I had attended more university classes for my algebra course. A common trait among mathematicians and statisticians is their patience—the kind a teacher has while guiding a toddler learning to read. My patience, however, extends only as far as reading a package’s documentation. Grief and frustration have taken its place, and maturity ultimately dictates my response: to give up. I realize the only way forward is to dedicate a full weekend to revisiting my linear algebra fundamentals. But the mere thought of doing so makes me restless—despite contradicting everything I love.

    Overall, this approach seems quite difficult to apply especially when handling LLM’s caches in real-time which would probably need some sort of ranking algorithm like Google Page Rank, that ranks the caches to not only dispatch the responses faster but also conditioned to my preferences (or Tom’s memory).

    Method 2: Optimization and Reward function

    Reward Function Design: The reward model should capture nuanced decision-making, including:

    • Contextual awareness (e.g., when to joke, question, or respond sarcastically)
    • Emotional alignment (predicting the user’s emotional state and responding accordingly)
    • Self-regulation (adjusting the model’s own “emotions” dynamically)

    With Reinforcement learning concept in mind, the concept of balancing exploration and exploitation in response generation can be viewed as balancing the model’s priority with selecting the base model texts vs its duplicate that has been adapted to the bot’s observations or memories. In my previous posts, I did mention building the latter as my own clone like a parrot. The progress here has been hindered after attempting to fine-tune Llama using LORA-Adapter techniques. I believe that this part should be hindered as my doubts were correct – never touch a deep learning network with minimal data.

    When considering the second method—sculpting a reward model—I’d approach it as a recursive regression state model where parameters (including training parameters) readjust at fixed time intervals. From my understanding, reinforcement learning mechanisms should be applied in real time. Yet, existing TLR-PPO implementation demos focus on fine-tuning LLMs with smaller offline datasets—fully trained rather than partially fitted over data batches.

    Additionally, deriving a policy function in reinforcement learning is grounded in Bellman’s Equation, which, like most optimization equations, extends Newton’s descent method to different types of incoming data streams. Beyond weight clipping (which maintains uniformity relative to the pre-trained state), my views doesn’t quite align with the works behind tlr or current researchers’ intended approach. Reason being is that in practical applications, you will always end up with at least two models where the long-term effectiveness or stability of the fine-tuned model is not always guaranteed.

    Personally, I try to avoid fine-tuning deep learning models in real-time even for now even if I have a a data iterator that is able to approximate and generate synthetic data to compensate missing datasets, fine-tuning a model in real time can only only be used temporarily. My tinkering suggests that in order to retain user-specific experiences, you would ultimately opt for a Data analyst’s favourite playground – SQL.

    Method 3: Mapping Decoding Sample Combinations to Emotional intensity
    Dataset with decoding parameters. The prompt used here ”Hey how are you today! :)”

    Ironically, this method was my initial instinct for implementation, particularly for a time-constrained project.

    The setup for my experiment involved a missing dataset iterator that returns synthetic dataset approximating the previous text embeddings conditioned to the mapped emotional intensity. Recall the common decoding sampling techniques are greedy search, beam search etc. and for the sake of this experiment’s simplicity, we disregard variants of sampling methods e.g. Group beam search and penalizing token based methods. Suppose decoder sampling methods be $$x_1, x_2, …$$ where $$n$$ is the number of decoding methods, the parameters related to each method are $$\alpha_1, \alpha_2, …$$, and the emotion expressiveness or intensity is $$q \in [0, 1]$$. The prior state model for a decoding strategy conditioned to the speaker’s prompt returns Tom’s selected emotional intensity i.e the speaker’s prompt. For example for beam search, the parameters are temperature, top-k and beam width. The goal is to find the optimal combination for some emotional intensity $$q > \epsilon$$, becomes finding the unique solution vector or coefficients, $$w$$ in $$w_1*\alpha_{temp} + w_2*\alpha_{k} + w_3*\alpha_{beam width}$$.

    Key highlights:

    • To set up Tom’s prior states or initial beliefs to his incoming observing windows, I have attempted to reduce the compute cost of rerunning GPT2 by approximating the distribution of text sequences given the parameters combination. Still deciding on whether a similar method should be used in real-time to assist incremental learners.
    • Among all the decoding sample combinations, I assumed fixed parameters that is common for all experiments for e.g. max length of text generations, sequence normalization.

    Currently, I am still applying different sampling techniques to set up a prior state for inferencing emotional intensity for Tom.

    Epilogue

    The main challenge likely stemmed from my own resilience when using the first method. It holds immense potential, but time was too limited. However, at least I can offer my younger self one last smile, knowing I truly gave my best at that time. As for whether a machine can have emotions, from my child-self’s perspective: only if the first method succeeds. From my current viewpoint, yes, it absolutely can.

    After careful consideration, I’ve decided to move forward with Method 3. Given the simplicity of the concluding build it is only natural for people to question whether the emotions are truly authentic or just the product of time-adapting algorithms and statistics. Yet, before anyone doubts a machine’s emotions, I hope they are also completely certain that they themselves are truly alive and not just merely passengers of time.

    Tom’s progression · Post 8 of 14

    This post sits in Cognition: Learning, Social cognition.

    ← To our creator Revising Prompt Chains →

  • Cloning myself into a Language Model

    Cloning myself into a Language Model

    Quick update on Tom’s progress

    To plan the modelling phases of Tom’s process, I initially targeted the interaction between Tom and myself and this automatically brings my attention to focusing at only Large Language Models (LLMs). The simplest case of real-time user interaction would be a chatbot development and I thought this would be beneficial because i.) validating that an experiment is much more trivial when you have face-to-face interaction with the agent, ii.) wanted to target the area where I would deal with the most sparse dataset – as I’ve previously predicted that it would be one of my greatest challenges in achieving what I want, and iii.) the flexibility to opt between different modelling methods like probabilistic, non/parametric models, Graph networks and Deep learning – if I am feeling confident on a Saturday – as on Sundays I have church sessions with Priest Mike Crotch.

    Considering Tom’s multi-model process as a spider web, the problem was defining a function at the webs knots. The frequent set backs here involved reconsidering the ways of structuring the cob-web. In some cases, this would depend on another cob-web’s structure and if you end up in a loop hole then this cob-web is the data collection centre behind your predicting y-variable. So it was things like this that humbled me and made me consider throwing my laptop out a two story building. To minimize these problems, I read old programming books – like how I study for Maths – and YouTubed videos on how programmers do things – elegantly.

    Tracing back to Tom’s process, under the works in NLP I have focused at features accessible in real-time that can be incorporated into fine-tuning Tom’s base LLM. Recall that the skeleton refers to Tom’s multi-modal connections of all pre-trained models1. The following will consider the Language component of Tom’s process in terms of his skeleton and models. Previously, I was searching for a way to construct hooking Module that attaches to sub layers of neural networks and transform the weights in some way. But no fear, I am now aware of the existence of adapters – God’s gift – and python library, PEFT – God’s way of gifting Eve to my Adam.

    Tom’s Policy Function

    Figure 1 illustrates the weights assigned to the merging adapters integrated into fine-tuning Tom’s Peft model adapted from the initial network. The base model as the language component of his skeleton is instructed to role-play with given Tom’s identity information.The same prompt is passed to other adapter models where only differed by the way of speech and other conditions that I am still reconsidering over more trial and errors. Initially, I tried resembling a block that generates emotion conditioned responses called Response space, however, given the complex nature behind emotion labels, this component had to be reconsidered. This resulted me in opting for the second method in cooperating the emotions with the dialogue learner as one cob-web (or focused task).

    Tom’s roleplaying as a curious agent would prompt the model to generate responses like Sherlock Holmes in a murder scene.

    Figure 1: Tom’s Fine-tuning Policy Network
    Figure 2: Determining the coefficients to Tom’s questioning states or responses.

    Clone model is to be fed / updated with responses by me. Unlike the other’s training behaviour, this adapter is fine-tuned via a Sequence to Sequence manner. To understand how the weights are adjusted consider Figure 2 displaying how the weights for incorporating curious responses per optimization step. Simply, this can be referred as how much you want the LLM to return question with respect to the context.

    Tom’s progression · Post 6 of 14

    This post sits in Actions: Contextual Engineering · Identity: Life.

    ← Defining a droid's emotional space To our creator →

  • Defining a droid’s emotional space

    Defining a droid’s emotional space

    Refining the construction of the emotional space is essential, as it personalizes the agent’s decision-making process and eases the integration of creative thinking1. Strong emotions can push boundaries of one’s creativity, source2. To succeed in developing my droid’s emotional component, I begin by refining how human emotions are labeled.

    Simplifying the idea to three emotion labels: neutral, positive and negative. My initial idea was:

    neutral vs negative vs positive

    However, ambiguity around the definition of “neutral” emotion complicates predicting a distribution over emotional labels. For example, a person observed in a neutral state might simply appear indifferent, yet this does not rule out the possibility that they were the one who accessed your computer through the open-source SSH login credentials to your terminal.

    This data preparation method is often paired with a popular approach in modeling human emotions: combining a BERT encoder with a multilayer perceptron to predict a set of emotion labels. Typically, this includes a “neutral” state alongside positive and negative emotions. I personally find this approach limiting, as it restricts the model’s potential for broader application.

    The next idea was:

    neutral vs emotional (either positive or negative emotions)

    This prompts an examination of the statement: Positive and negative emotions can coexist in the same space. Determining whether this statement holds true or false depends on one’s perspective on human psychology. Hence, the following lists my thoughts to answering this statement:

    • Statement is true if I believe that a person can experience both positive and negative emotion at the same time.
    • Statement is false if I believe that a person cannot experience both emotions at the same time, i.e. I believe that one emotion label is better than the rest.

    The first statement would suggest that the feelings of ‘joyful’ and ‘sad’ are not mutually exclusive which contradicts my common sense. Moreover, the second statement would prompt the challenge in deciphering whether an emotion state is truly considered as negative or positive. This is relative to the context in discussion or the observing state3.

    Brainstormed methods in updating a knowledge graph of vector embeddings:

    • If I refer to a clustering model where an emotion is represented by a centroid, and the distance (edges) between two words are determined by their cosine similarity distance, then I can probably use this component as a feature in modelling the generated sequence of texts conditioned to emotion states.

    My foot

    1. Assuming I stick with the current plan of constructing the cobwebs. ↩︎
    2. Me. ↩︎
    3. To understand this in application is to consider the example of a chat dialogue where you perform inferences on the dialogue using time-series model approach to distinguish the context labels. ↩︎

    Tom’s progression · Post 5 of 14

    This post sits in Cognition: Social cognition · Identity: Life.

    ← Missing pieces to Naomi Cloning myself into a Language Model →

  • Missing pieces to Naomi

    Missing pieces to Naomi

    KEY TERMS

    List of terms mentioned in this post

    • Candidate: the user interacting with Naomi during the interview.
    • Agent: Llama3.1 roleplaying as Naomi.
    • General question/s: questions to be asked during the interview concerning the candidate’s information eg age, occupation etc.
    • Feature question/s: questions or case scenarios mentioned during the interview. The candidate’s responses to these questions are analyzed and used as features in predicting personality predictions and our compatibility score.
    • Response space: responses generated by dummy candidates conditioned to trait patterns aligned with my previous dating history. The intuition behind this idea is that all individuals equip both strengths and weaknesses, and that determining these traits is dependent on the observer’s ability in handling the characteristic combinations i.e. weighing my patience for someone’s flaws against their admirable qualities.

    Overview

    This post is dedicated to Naomi’s unconscious state of acting as a recruitment officer for a dating show (my dating life). Since this was my first attempt at integrating the frontend with the backend, the project turned out messy. The only promising outcome was the realization that I’m not merely a fool of my own words.

    Data Preparation

    This section lists the type of datasets to prepare prior to streaming. The responses were generated by instructing Llama 3.1.

    Feature Questions:

    These questions/case scenarios are based on each dichotomy of MBTI personality traits:

    Response Space:

    Pair of dummy candidate responses and narrations for each feature question.

    Llama 3.1 Prompts:

    Instructions to assist the streaming chatbot and agent helpers during streaming the chatbot.

    Non-manageable problems

    • Decoding parameters: During this trial, the inference API was open-sourced and, unfortunately, wasn’t able to pass decoding parameters.

    • Random Feature questions: A number of feature questions were randomly selected during the chat stream. Hence, even though I prepared questions/case scenarios for each function of the MBTI label, there was no guarantee that a question testing for a specific type of function would be asked during the interview.

    • My information: No form of personal information about myself was passed to the agent. As a result, the agent occasionally generated assumptions about my personal information when requested by the candidates.

    • The way of expressions: Being highly expressive in writing doesn’t necessarily indicate that someone is extremely extroverted. Similarly, a lack of expressiveness in writing might simply suggest that a person struggles with articulating their thoughts rather than being inherently reserved.

      • This problem can be mitigated during the data preparation stage (i.e., the types of questions I’ve prepared for the chatbot). For example, when presented with case scenarios designed to assess the user’s task prioritization behavior, Llama (acting as my custom characters) provides the same procedure for each role-playing candidate. The only difference is in the way the responses are expressed.
    • Limited samples: During the data preparation stage, I only prepared candidate responses tailored toward my dating history instead of actual MBTI labels.

    Manageable problems

    • Agent’s behaviour during live stream:
      • Agent occasionally missed certain questions, mainly the general questions. Despite this, the agent did not skip any feature questions. This suggests that there might be a problem with the data handling methods between Naomi and the candidate during the live stream.

    Improvements

    Below are self-tasked actions that I would like to focus on during my next experiment for Naomi:

    • API: At the time of this experiment, the inference API on Hugging Face was open source. I plan to switch to Ollama during the next experiment.

    • Dataset preparation:

      • Candidate responses should specifically reflect the dichotomy of MBTI types, focusing on Jung’s cognitive functions—Dominant, Auxiliary, Tertiary, and Inferior processes.
      • Feature questions reflect on each of Jung’s cognitive functions.
    • Text summarization: Rather than instructing the agent to narrate the candidate’s response and also speculate on how the candidate might be feeling, I would want to add the following adjustments:

      • The narrations are returned in a fixed format that corresponds with how the candidate’s responses are represented.
      • If possible, the narrations could be rephrased in first-person speech.
    • Adding agent/models helpers to streaming:

      • Predict whether a candidate is being serious or not when completing the interview. The use of this is to allow Naomi to consider returning bad words to the candidate or return responses that reflect on the candidate’s behavior.
    • Predicting the user’s breed: Pick up where I left off. I’ve come to realize that, despite everything, I was still trying to kill two birds with one stone—fitting Naomi into Tom and vice versa. I should probably just complete Naomi on its own at this point.

    • Testing:

      • Replace validation tools with agent helpers, for example:
        • To ensure the dialogue flows smoothly and naturally.
        • To ensure all questions are asked as intended.

    Self-diagnostic on poor data preparation

    During this trial, I wasn’t aware of the different program designs and I was more focused on challenging myself with different OOPs designs in implementing a chatbot. As a result, many of the data classes / handling functions / prepared datasets were not specifically tailored to Naomi’s case, which added problems to this experiment.

    This setup of this model is incomplete due to my impatience part in mishandling the data preparation stage.

    Tom’s progression · Post 4 of 14

    This post sits in Cognition: Social cognition.

    ← Frankenstein Defining a droid's emotional space →