Fine-Tuning GPT: Creating a Real AI Version of Star Trek’s Lt. Cdr. Data

Last year, OpenAI released a fine-tuning API that allows developers to customize the latest GPT models, including GPT-4. To explore its capabilities, I embarked on an interesting experiment: creating a real AI based on a fictional one. Using every line of dialogue from Star Trek: The Next Generation’s android character Data, I fine-tuned GPT to replicate his unique communication patterns. This project not only showcases the practical applications of the new API but also highlights the fascinating intersection between science fiction and real artificial intelligence. Let’s look at how the new fine-tuning process works, what it takes to prepare training data, and how well the resulting model performs compared to the base GPT model.

This article draws upon insights from the e-learning course Machine Learning, Data Science and Generative AI with Python, which covers a comprehensive range of topics in AI development.

Introduction to the Fine-Tuning API

In August 2023, OpenAI introduced an updated fine-tuning API, marking a significant advancement in AI customization. This API allows developers to fine-tune the latest models, such as GPT-4o. This development opens up new possibilities for tailoring AI models to specific needs and applications.

Structure and Requirements for Fine-Tuning

The updated fine-tuning API operates similarly to the older version, with a key difference: the input data must be in the chat completions API format. While you still provide a JSON-L file for training, containing one line of JSON per entry, the data now requires more structure to accommodate the chat format.

Example: Fine-Tuning a Model to Simulate Lt. Cdr. Data from Star Trek

Imagine creating a fine-tuned model of GPT to play the role of Data from the TV series Star Trek: The Next Generation. Data is a fictional android, and the goal is to transform this fictional character into a real artificial intelligence.

In this scenario, you can assign a system role with each message, providing additional context about the task. For instance, you can instruct the system to embody Data, the android from the show. You can then supply examples of user and assistant responses, potentially expanding to larger conversations for more extensive training. Typically, this involves using pairs of dialogue lines where someone interacts with Data, and Data responds.

For example, consider Data’s first line in Star Trek, season one. Picard says, “You will agree, Data, that Starfleet’s instructions are difficult,” to which Data responds, “Difficult? How so? Simply solve the mystery of Farpoint Station. Feeding these lines and their responses into the fine-tuning API builds a model that learns how to talk like Data. This illustrates the power of the new models, which can be fine-tuned using this API to train on the latest advancements.

Necessity of Fine-Tuning vs. Prompt Engineering

OpenAI emphasizes the importance of evaluating whether fine-tuning is truly necessary, as their models perform exceptionally well out of the box. Often, you can achieve desired results through prompt engineering—refining your prompts or providing a few examples—rather than resorting to the more costly and complex process of fine-tuning.

With older models, fine-tuning was more incentivized, but the newer models, like GPT-4o, often don’t require it. For instance, even GPT-3.5 can adequately play the role of Data from Star Trek without fine-tuning, although fine-tuning enhances its performance. (This capability does raise questions about how the model may have been trained on copyrighted TV scripts.)

Creating Training Data for Fine-Tuning

Once you have a fine-tuned model, it will be used with the chat completions API instead of the legacy completions API. The process is straightforward: define the message structure, omitting the assistant role to let the model generate it. You can provide both training and validation files for the fine-tuning job. Use OpenAI’s file API to upload these files in advance, referring to them by their IDs in subsequent requests to initiate the fine-tuning job. This approach provides objective metrics on the model’s performance, allowing you to assess how accurately it predicts responses, such as those Data from Star Trek might have given.

Python Script for Extracting Dialogue

Let’s explore an example of creating a real AI based on a fictional AI using OpenAI’s fine-tuning API. We aim to fine-tune GPT to simulate Data from Star Trek: The Next Generation. By training the model with every line of dialogue Data ever said, we can produce a simulation closely resembling the original character.

To gather this data, we extract every line spoken by Data and the preceding line from the scripts of Star Trek: The Next Generation. Although sharing the scripts directly would infringe copyright, they are accessible online for personal use. 

The challenge is to create a training data file for fine-tuning GPT. The system role is defined as an android from Star Trek: The Next Generation, with the user being whoever interacts with Data. For example, Picard might say “You will agree, Data, that Starfleet’s instructions are difficult,”, and Data would respond, “Difficult? How so?” By doing this for all of Data’s lines, we can use the chat completions API to generate responses consistent with Data’s speech in the show.

Uploading Files and Starting the Fine-Tuning Job

To begin the fine-tuning process, we need to prepare a script. This script, named extract_script_new.py, is a pre-processing Python script designed to handle data wrangling, which is a crucial part of the job. The script starts by using the process_directory function, which points to the directory where all the Star Trek scripts are stored. If you’re replicating this process, ensure you adjust the path to match where your scripts are saved.

The script allows for the simulation of any Star Trek character, but for this project, we focus on Data, as it poetically simulates a real AI with a fictional one.

# extract_script_new.py
import os
import re
import random
character_lines = []

def strip_parentheses(s):
    return re.sub(r'\(.*?\)', '', s)
    
def is_single_word_all_caps(s):
    # First, we split the string into words
    words = s.split()

    # Check if the string contains only a single word
    if len(words) != 1:
        return False

    # Make sure it isn't a line number
    if bool(re.search(r'\d', words[0])):
        return False

    # Check if the single word is in all caps
    return words[0].isupper()
    
def process_directory(directory_path, character_name):
    for filename in os.listdir(directory_path):
        file_path = os.path.join(directory_path, filename)
        if os.path.isfile(file_path):  # Ignore directories
            extract_character_lines(file_path, character_name)
            
    with open(f'./{character_name}_lines.jsonl', 'w', newline='') as outfile:
        prevLine = ''
        for s in character_lines:
            if (s.startswith('DATA:')):
                outfile.write("{\"messages\": [{\"role\": \"system\", \"content\": \"Data is an android in the TV series Star Trek: The Next Generation.\"}, {\"role\": \"user\", \"content\": \"" + prevLine + "\"}, {\"role\": \"assistant\", \"content\": \"" + s + "\"}]}\n")
            prevLine = s

def extract_character_lines(file_path, character_name):
    with open(file_path, 'r') as script_file:
        lines = script_file.readlines()

    is_character_line = False
    current_line = ''
    current_character = ''
    for line in lines:
        strippedLine = line.strip()
        if (is_single_word_all_caps(strippedLine)):
            is_character_line = True
            current_character = strippedLine
        elif (line.strip() == '') and is_character_line:
            is_character_line = False
            dialog_line = strip_parentheses(current_line).strip()
            dialog_line = dialog_line.replace('"', "'")
            character_lines.append(current_character + ": " + dialog_line)
            current_line = ''
        elif is_character_line:
            current_line += line.strip() + ' '
            
def split_file(input_filename, train_filename, eval_filename, split_ratio=0.8, max_lines=10000):
    """
    Splits the lines of the input file into training and evaluation files.

    :param input_filename: Name of the input file to be split.
    :param train_filename: Name of the output training file.
    :param eval_filename: Name of the output evaluation file.
    :param split_ratio: Ratio of lines to be allocated to training. Default is 0.8, i.e., 80%.
    """
    
    with open(input_filename, 'r') as infile:
        lines = infile.readlines()

    # Shuffle lines to ensure randomness
    random.shuffle(lines)
    
    lines = lines[:max_lines]

    # Calculate the number of lines for training
    train_len = int(split_ratio * len(lines))

    # Split the lines
    train_lines = lines[:train_len]
    eval_lines = lines[train_len:]

    # Write to the respective files
    with open(train_filename, 'w') as trainfile:
        trainfile.writelines(train_lines)

    with open(eval_filename, 'w') as evalfile:
        evalfile.writelines(eval_lines)

process_directory('e:/Downloads23/scripts_tng', 'DATA')
split_file('./DATA_lines.jsonl', './DATA_train.jsonl', './DATA_eval.jsonl')

The process_directory function iterates through each file in the specified directory, confirming each is a file and not a directory. It then passes the file to the extract_character_lines function. Since scripts are not structured data, assumptions are made to process the information. The script reads each line into an array called lines and tracks whether the current line is part of a dialogue.

The assumption is that a line with a single word in all caps, without numbers, indicates a character’s dialogue. For example, if “PICARD” is in all caps, the following lines are assumed to be Picard’s dialogue. A blank line indicates the end of the dialogue.

The script identifies who is speaking by looking for these capitalized words, using the is_single_word_all_caps function to confirm character names. The output is written to data_lines.jsonl, formatted for the chat completions API. Each line includes a system role, which provides context that Data is an android in “Star Trek: The Next Generation,” a user role for the person speaking to Data, and an assistant role for Data’s response.

Finally, the script creates training and evaluation files, allowing OpenAI to measure the model’s progress. This process helps determine how accurately the model simulates Data’s speech, providing metrics to evaluate its performance objectively.

Monitoring the Fine-Tuning Process

To prepare for fine-tuning, we use a function to split the original data_lines.jsonl file into data_train and data_eval files, following an 80-20 split for training and testing data. This split ensures that the model has sufficient data for training while reserving a portion for evaluation.

For cost efficiency during development, you can limit the number of lines processed by setting max_lines to a smaller number. Initially, I used 100 lines of Data’s dialogue to expedite the process and minimize costs. However, the complete dataset contains approximately 6,000 lines, and for this example, we increase it to 10,000 lines to ensure comprehensive training.

To generate these files, execute the command python extract-script-new.py. This script will create the necessary training and evaluation files, readying them for use in fine-tuning the model.

Comparing Fine-Tuned and Non-Fine-Tuned Models

To evaluate the effectiveness of the fine-tuning process, we can use a Jupyter notebook to run comparisons between the fine-tuned and non-fine-tuned models. This step involves executing the fine-tuning process and analyzing the results. Note that fine-tuning can incur costs, potentially around $50, so consider this before proceeding with your own experiments.

!pip install openai --upgrade

Output:

Requirement already satisfied: openai in e:\anaconda3\lib\site-packages (0.27.9)
Requirement already satisfied: tqdm in e:\anaconda3\lib\site-packages (from openai) (4.64.1)
Requirement already satisfied: requests>=2.20 in e:\anaconda3\lib\site-packages (from openai) (2.28.1)
Requirement already satisfied: aiohttp in e:\anaconda3\lib\site-packages (from openai) (3.8.3)
Requirement already satisfied: idna<4,>=2.5 in e:\anaconda3\lib\site-packages (from requests>=2.20->openai) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in e:\anaconda3\lib\site-packages (from requests>=2.20->openai) (2022.12.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in e:\anaconda3\lib\site-packages (from requests>=2.20->openai) (1.26.13)
Requirement already satisfied: charset-normalizer<3,>=2 in e:\anaconda3\lib\site-packages (from requests>=2.20->openai) (2.1.1)
Requirement already satisfied: frozenlist>=1.1.1 in e:\anaconda3\lib\site-packages (from aiohttp->openai) (1.3.3)
Requirement already satisfied: aiosignal>=1.1.2 in e:\anaconda3\lib\site-packages (from aiohttp->openai) (1.3.1)
Requirement already satisfied: multidict<7.0,>=4.5 in e:\anaconda3\lib\site-packages (from aiohttp->openai) (6.0.2)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in e:\anaconda3\lib\site-packages (from aiohttp->openai) (4.0.2)
Requirement already satisfied: attrs>=17.3.0 in e:\anaconda3\lib\site-packages (from aiohttp->openai) (22.1.0)
Requirement already satisfied: yarl<2.0,>=1.0 in e:\anaconda3\lib\site-packages (from aiohttp->openai) (1.8.1)
Requirement already satisfied: colorama in e:\anaconda3\lib\site-packages (from tqdm->openai) (0.4.6)

To begin, ensure you have the latest version of the OpenAI package installed, as version 27.9 or later is required for the fine-tuning API. After installation, import the necessary os and OpenAI packages. Set your API key using your OpenAI developer key, which should be stored in a system variable, such as openai_api_key. This key is essential for accessing the API, but once set, you won’t need to reference it again, simplifying the process.

import os
from openai import OpenAI
client = OpenAI()

To begin the fine-tuning process, upload the training and evaluation data files using the OpenAI file API. Specify the file path and set the purpose to ‘fine-tune’ to ensure proper usage. After uploading, the API will return file IDs, which are necessary for subsequent requests.

client.files.create(
  file=open("./DATA_train.jsonl", "rb"),
  purpose='fine-tune'
)

Output:

<File file id=file-9lI2ovFA1UJskgOPpxDTwEhG at 0x2266872ea90> JSON: {
  "object": "file",
  "id": "file-9lI2ovFA1UJskgOPpxDTwEhG",
  "purpose": "fine-tune",
  "filename": "file",
  "bytes": 1774941,
  "created_at": 1692794707,
  "status": "uploaded",
  "status_details": null
}

client.files.create(
  file=open("./DATA_eval.jsonl", "rb"),
  purpose='fine-tune'
)

Output:

<File file id=file-UqPVnkk9z8Q74BEUqPlnhjHL at 0x226669e59f0> JSON: {
  "object": "file",
  "id": "file-UqPVnkk9z8Q74BEUqPlnhjHL",
  "purpose": "fine-tune",
  "filename": "file",
  "bytes": 442619,
  "created_at": 1692794711,
  "status": "uploaded",
  "status_details": null
}

To ensure your files are ready for fine-tuning, it’s important to check their status. This step will reveal any validation errors, such as malformed JSON. You can use the file.retrieve method with the file ID to verify the status. For instance, when checking an evaluation file, it should confirm that everything is fine. If there are issues, it will indicate errors and guide you on how to fix them. OpenAI plans to release a Python script to help validate data and estimate training costs, which may be available by the time you read this.

client.files.retrieve("file-UqPVnkk9z8Q74BEUqPlnhjHL")

Output:

<File file id=file-UqPVnkk9z8Q74BEUqPlnhjHL at 0x2266865c180> JSON: {
  "object": "file",
  "id": "file-UqPVnkk9z8Q74BEUqPlnhjHL",
  "purpose": "fine-tune",
  "filename": "file",
  "bytes": 442619,
  "created_at": 1692794711,
  "status": "uploaded",
  "status_details": null
}

With our training and evaluation data ready, we can initiate the fine-tuning job. To do this, we pass the ID of the training file uploaded via the file API, along with the optional validation file, and specify the model we wish to fine-tune, which in this case is GPT-3.5-turbo but should also work with newer models. This process allows us to customize GPT to meet specific needs, such as simulating Data from Star Trek.

client.fine_tuning.jobs.create(training_file="file-9lI2ovFA1UJskgOPpxDTwEhG", validation_file="file-UqPVnkk9z8Q74BEUqPlnhjHL", model="gpt-3.5-turbo")

Output:

<FineTuningJob fine_tuning.job id=ftjob-mQlhbPB5vsog1SeDLNx2xAMj at 0x226669e58b0> JSON: {
  "object": "fine_tuning.job",
  "id": "ftjob-mQlhbPB5vsog1SeDLNx2xAMj",
  "model": "gpt-3.5-turbo-0613",
  "created_at": 1692794886,
  "finished_at": null,
  "fine_tuned_model": null,
  "organization_id": "org-DBeDgDH8c36NSJobwuaBPXrW",
  "result_files": [],
  "status": "created",
  "validation_file": "file-UqPVnkk9z8Q74BEUqPlnhjHL",
  "training_file": "file-9lI2ovFA1UJskgOPpxDTwEhG",
  "hyperparameters": {
    "n_epochs": 3
  },
  "trained_tokens": null
}

Once the fine-tuning job is initiated, it provides information about the job status. Monitoring the progress is important, as the process can take some time; in this case, it took about half an hour, which is quite efficient. To track the job, use the fine-tuning job.retrieve function with the job ID provided in the response to the create call. This function gives general information about the fine-tuning job, ensuring it is proceeding correctly.

For instance, the default number of epochs is set to three, but you can specify a different number if needed. Keep in mind that costs are incurred per epoch based on the number of tokens in your training dataset. Therefore, it’s advisable not to exceed the necessary number of epochs unless you’re prepared for the additional expense.

client.fine_tuning.jobs.retrieve("ftjob-mQlhbPB5vsog1SeDLNx2xAMj")

Output:

<FineTuningJob fine_tuning.job id=ftjob-mQlhbPB5vsog1SeDLNx2xAMj at 0x22666a16220> JSON: {
  "object": "fine_tuning.job",
  "id": "ftjob-mQlhbPB5vsog1SeDLNx2xAMj",
  "model": "gpt-3.5-turbo-0613",
  "created_at": 1692794886,
  "finished_at": null,
  "fine_tuned_model": null,
  "organization_id": "org-DBeDgDH8c36NSJobwuaBPXrW",
  "result_files": [],
  "status": "running",
  "validation_file": "file-UqPVnkk9z8Q74BEUqPlnhjHL",
  "training_file": "file-9lI2ovFA1UJskgOPpxDTwEhG",
  "hyperparameters": {
    "n_epochs": 3
  },
  "trained_tokens": null
}

To monitor the progress of your fine-tuning job, you can use the list_events function. This allows you to specify which events you want to track and how many of the most recent events you wish to see. By passing in the ID of your fine-tuning job, you can receive updates on its status. Once the job is complete, you’ll receive a message confirming its success, along with the ID of the fine-tuned model. This ID is crucial for using the model with the chat completions API or in the playground.

client.fine_tuning.jobs.list_events(id="ftjob-mQlhbPB5vsog1SeDLNx2xAMj", limit=10)

Output:

<OpenAIObject list at 0x22668759950> JSON: {
  "object": "list",
  "data": [
    {
      "object": "fine_tuning.job.event",
      "id": "ftevent-n0GA9lmPtAulghPIgsfSSdM1",
      "created_at": 1692797270,
      "level": "info",
      "message": "Fine-tuning job successfully completed",
      "data": null,
      "type": "message"
    },
    {
      "object": "fine_tuning.job.event",
      "id": "ftevent-miblzvSktANikUk7sJOQe6Ir",
...(output truncated)...
  ],
  "has_more": false
}

Upon completion, the training loss was recorded at 1.89, and the token accuracy was 0.54. Unlike previous experiments where metrics were provided throughout the training process, this time only the final metrics were available. Typically, you would see these metrics fluctuate as training progresses, providing insight into the model’s improvement.

Conclusion: The Future of AI Development

In this article, we explored the fascinating process of fine-tuning GPT to create a real AI version of Star Trek’s Data. We explored the intricacies of OpenAI’s fine-tuning API, the preparation of training data, and the steps involved in customizing an AI model. This experiment not only showcased the practical applications of advanced AI technologies but also highlighted the intersection between science fiction and real-world artificial intelligence. By understanding these processes, we gain valuable insights into the potential and limitations of current AI development techniques. Thank you for joining us on this journey through the cutting edge of AI technology.

If you’re intrigued by the possibilities of AI and machine learning, and want to dive deeper into these topics, consider exploring the comprehensive Machine Learning, Data Science and Generative AI with Python course. This course covers a wide range of topics from basic statistics to advanced AI techniques, providing you with the skills needed to excel in the rapidly evolving field of artificial intelligence.

Two New AWS Certification Courses! AI Practitioner and Machine Learning Engineer Associate

AWS has announced not one, but two new certifications that have released simultaneously! Both the AWS Certified AI Practitioner (AIF-C01) and AWS Certified Machine Learning Engineer – Associate (MLA-C01) exams are open for registration in beta form now, and we have prep courses available for each:

These are very different exams; AI Practitioner is mainly simple “which service does this” questions, while the Machine Learning Engineer exam is much more advanced – it’s basically the Machine Learning Specialty exam, but with less of a focus on system design and with an even broader scope that covers newer services like Bedrock and newer features in SageMaker.

Our prep courses reflect this; our AI Practitioner course clocks in at under 10 hours, while Machine Learning Engineer is over 22 hours! For the latter, I’ve teamed up again with celebrity instructor Stephane Maarek to pair his deep AWS service-level expertise with my own machine learning expertise.

Both are available exclusively on Udemy; please follow the links above to learn more! As always, thank you for having me along on your learning journey.

-Frank

Infrastructure Improvements

We’ve had a few outages these past few days, so just wanted to say (1) I’m sorry if you were affected by them, and more importantly, (2) I’ve addressed the underlying issue.

I’ve doubled the capacity of our underlying server, as it was just running out of memory. We’ve been seeing a lot more traffic lately, and it just couldn’t handle it. A good problem to have, I suppose!

Let’s turn this into an educational moment though, because that is what I do 🙂

Although I teach complex system designs and the use of web services, a site like this can often make do with a single monolithic server. Our current level of traffic doesn’t require anything more, and you should always opt for the simplest solution that meets your needs. This site runs on an Amazon Lightsail instance, running WordPress with Bitnami. The issue wasn’t with that architectural choice, it was just in choosing an instance type that didn’t keep up with our growth in an attempt to minimize costs.

But, I have automated alerts set up when the site becomes unresponsive – so as long as it happens while I’m awake, I can respond quickly. And I have automated snapshots of the site stored daily, so recovering from a hardware failure or something can be done quickly.

In this case, a few brief outages that fixed themselves after a few minutes were a warning sign I should have paid more attention to. I assumed it was some transient hacking attempt that was quickly thwarted by the security software this site runs. But a couple of days ago, the site went down, and stayed down. When I saw the alert, I examined the apache error logs which plainly pointed to PHP running out of memory. The memory limit in php.ini didn’t appear to be the problem, but running “top” on the server showed that free memory on our virtual machine was perilously low. A simple reboot freed up some resources, and bought me some time to pursue a longer-term solution.

Fortunately, in Lightsail it’s pretty easy to upgrade a server. I just restored our most recent snapshot to a new, larger instance type, and switched over our DNS entry. Done.

There are still a couple of larger instance types to choose from before we need to think about a more complex architecture, but if that day does come, Lightsail does offer a scheme for using a load balancer in front of multiple servers. We’d have to move off our underlying database to something centralized at the same time, but that’s not that hard either.

Surviving a Layoff in Tech

Sometimes it seems like the tech industry lives in an alternate universe. Despite headlines about how great the economy is doing and how many jobs are being added to it, the tech industry continues to undergo wave after wave of layoffs – mainly driven by investors demanding profitability by any means. A lot of smart, driven, talented people are finding themselves without a job, and it’s hard to imagine a more stressful situation to be in.

If you’re one of those people, I want to help. The most important thing in a job search these days is who you know. I don’t know if my own network on LinkedIn might expose you to new connections, but feel free to connect with my own network there. I’m also in some discussions with recruiting firms who are interested in tapping into my network of past students, as you have skills that are still in demand. More on that as things solidify.

Upskilling and interview preparation are of course important. Here are some courses that might prove especially helpful:

If the jobs you are applying for require AWS certification, we can help you prepare for that as well:

If you are affected by the ongoing wave of tech layoffs, I wish you prosperity and finding a new employer that’s better than the one you left – or maybe this will lead to your own endeavors taking off. Make the best use of the time you have!

New Course: AWS Certified Data Engineer Associate 2023 – Hands On!

The AWS Certified Data Engineer Associate Exam is one of the most challenging associate-level certification exams you can take from Amazon, and even among the most challenging overall. 

Passing it tells employers in no uncertain terms that your knowledge of data pipelines is wide and deep. But, even experienced technologists need to prepare heavily for this exam. 

This course will set you up for success, by covering all of the data ingestion, transformation, and orchestration technologies on the exam and how they fit together.

Enroll today for just $9.99 and save with our launch sale!

For this course, I’ve teamed up with a fellow best-selling Udemy instructor, Stéphane Maarek to deliver the most comprehensive and hands-on prep course we’ve seen. Together, we’ve taught over 2 million people around the world. 

This course combines Stéphane’s depth on AWS with Frank’s experience in wrangling massive data sets, gleaned during his 9-year career at Amazon itself.

Throughout the course, you’ll have lots of opportunities to reinforce your learning with hands-on exercises and quizzes.  We’ll also arm you with some valuable test-taking tips and strategies along the way.

Although this is an associate-level exam, it is one of the more challenging ones. AWS recommends having a few years of both data engineering experience and AWS experience before tackling it. This exam is not intended for AWS beginners.

You want to go into the AWS Certified Data Engineer Associate Exam with confidence, and that’s what this course delivers. Sign up today– we’re excited to see you in the course…and ultimately to see you get your certification! 

Enroll today for just $9.99! These special prices won’t last long!

As always thank you for having me along on your learning journey.

– Frank Kane

CEO, Sundog Education

The Importance of Communication Skills in the Tech Industry

By Frank Kane 

This article is an excerpt from our “Breaking into Technology with a Non-Traditional Background” course. For this section, we will take a deeper dive into the importance of communication skills. 

Communication skills are important to employers. It may not jive with your ideas about meritocracy, but the reality is the world cares about more than just your coding skills.

It takes more than coding skills to be successful in business, you have to play nice with others and be an active part of a team. You have to be able to collaborate with people and communicate your ideas effectively, not only to other engineers but also to your manager and people who are outside of your discipline entirely. 

So if you’re light on technical skills, learning to effectively communicate with your team could become your unique advantage.

Communication in Interviews 

Let’s start with the interview, where it all begins. Your ability to communicate plays a large role in how your interviews go. So if you’re just sitting there looking depressed and mumbling and people can’t understand what you’re saying, and you can’t convey your thoughts and talk about how you’re thinking through the problems you’re being asked, that interview is not going to go well no matter how smart you are.

But if you can sit there and effectively convey what you’re thinking, your thought process, where you’re going as you’re answering these questions and do that in an articulate manner, people will say, “Hey, I like this person. I want to work with this person. This person can work well in a larger organization.” That’s important too.

How you present yourself in interviews is going to make a big difference. How you communicate on the job impacts your career in the long term. You need to be able to express your ideas clearly to other engineers and your management. It’s a hard thing to teach, but practice does help.

Find Speaking Opportunities

One way to start practicing your communication skills is through public speaking. Looking for opportunities to speak publicly even if it’s not technical related. Join local clubs and give presentations to them. I hone my skills by hosting meetings for my local astronomy club, and I’ve also worked as a DJ on the side.

Thankfully, I was born with a voice that’s okay to listen to. That is sort of an unfair advantage that I had, but it took practice for me to become a good public speaker because, as you might be, I’m a pretty hardcore introvert. I get a lot of stage fright. 

It’s hard for me to get in front of a group and sound confident, but that comes with practice. Find opportunities to speak in front of a group. It doesn’t have to be in person, but just getting in front of a microphone and talking about stuff for a while will help you hone your communication skills and minimize your use of filler words.

So practice, practice, practice. Communication is important.

Communication Essentials 

Next is learning the communication essentials. These include: Speaking clearly, enunciating, and making sure that you’re pronouncing all of your consonants and syllables. 

Move your mouth more. Don’t just mumble. Don’t just keep your jaw locked and just move your lips. You want to move your jaw as well. The more mouth movement, the more clarity you have as you’re speaking.

Use proper grammar, especially when you’re dealing with management. A lot of people these days do most of their communication via text and the grammar there is pretty fast and loose. But in a professional setting, you might be dealing with people from an older generation, and that’s not going to fly. So do learn how to communicate using proper English grammar.

Take a course on that if you need to. If you’re not a native English speaker, that can be especially challenging. However, it is important to use complete sentences and complete grammar.

When you’re communicating in written form with management, be concise, and don’t blather on about the same thing over and over again. Get to the point. People in business don’t have a lot of time. They appreciate people who can be direct, and say, “Hey, this is the problem, this is how we’re going to fix it. What do you think?” 

Don’t mince words. Avoid filler words. The ums, the ahs, and the filler words can be distracting. The more you can learn to eliminate that, the better. Try to get that filter between your brain and your mouth working as efficiently as possible. 

Avoiding Jargon 

Next, work to avoid using jargon when you’re talking to people who are not engineers, if you’re talking to management, artists, designers, program directors, or project managers, you can’t get into the nitty-gritty of how your code works with them.

There is a learned skill in communicating complex technical concepts to people who are not technical. Maybe you could do an online course about some sort of technology. It just takes practice. It’s a learned skill. 

The more you can communicate with people outside of your discipline, the more that will open up more career paths for you going forward. And it makes it easier to communicate with people in your interview loop when you’re looking for a job because not everybody who’s interviewing you is going to be a fellow engineer. You’re going to be interviewing with your manager, you’re going to be interviewing with someone outside the team (potentially) who’s evaluating you on soft skills. You might be talking to a project manager who works with your team, so you need to learn how to communicate with people who are not engineers. 

As I said, the best way to hone your communication skills is to communicate more. Join a local club, do some public speaking, give talks online, whatever it is, the more you’re in front of a microphone, a camera talking to people, or in front of a live audience, the better you’re going to get at this.

So here are the key takeaways: 

  • Communication is essential.
  • Use proper grammar in professional settings. 
  • Avoid using technical jargon with non-technical people. 
  • Practice makes perfect. 

If you’re interested in learning more – check out our full course, Breaking Into Technology with a Non-Traditional Background. 

Or get access to our top courses in our 10-Course Mega Bundle for only $50! Click here to learn more.

3 Tips to Ace Your Next Tech Interview

By Frank Kane 

This article is an excerpt from our “Mastering the System Design Interview” course. For this section, we will take a deeper dive into how to prepare for your technical interview. 

What are technical hiring managers looking for? It’s more than just your technical skills, they are looking for perseverance and self-motivation. Additionally, you should be researching the companies you want to work for and prepare for your interview by practicing coding, preparing questions, and thinking big! 

1. Hiring Managers are looking for perseverance and self-motivation.  

Hiring managers want to see evidence of independent thought. Can you research solutions to new problems on your own? Can you invent things? Can you come up with new, novel solutions to new problems that nobody’s ever seen before?

Can you learn things independently? There is nothing more annoying than a new hire who demands help on everything that they’re asked to do when they could just look it up on the internet. Have some evidence of where you were faced with new technology and you just dove in and learned how to do it, and how you applied that knowledge to build something. 

Do you have the grit to see challenging problems through to completion? They would love to hear stories about how you were faced with learning a new technology and solving a new problem. 

Also, interviewers will be looking for evidence that you are self-motivated. If you don’t have specific instructions for what to do today, you should be asking your project manager or your manager, “What should I be doing today?” And if they don’t have an answer, then you should come up with something new to do on your own that will bring value to the company. 

Experiment with some new idea you have, make it happen, and see how it performs. Those are great stories to have: stories of pure initiative, where you had an idea of your own, and in your own spare time, you made a prototype and experimented with it to see how it worked. 

Hiring managers love that sort of thing. 

2. Understand the company’s values and principles before the interview. 

Big tech companies take their values seriously. They will evaluate you on how well you might embody those values. This is your cheat sheet of what sorts of stories you should have ready to tell. Demonstrate that you understand those values and that you embody them. Have stories ready to prove that to your interviewer.

They are not just looking for your technical skills, they want to make sure that you embody the company’s values. That is just as important. I’ve very often hired someone who didn’t do so well on the technical side of things, but really, really aligned well with the company’s values. And they ended up as good hires. 

3. Practice coding, be well rested, prepare questions, and think big before your interview. 

Practice coding and designing at the whiteboard or some virtual whiteboard, ahead of time. Writing code on a whiteboard is much harder, and it takes practice. So, get some practice. Find a friend, or find a family member, and just make them watch you while you solve technical problems on the board to make sure that you’re not thrown off kilter just by the stress of being asked to do this while somebody is watching.

If you had to fly out for an in-person interview, halfway across the world, don’t put yourself in a situation where you’re fighting jet lag at the same point where you’re trying to go through the most grueling, mentally challenging experience of your life. 

Think about your questions for them ahead of time. Usually, an interview will end with, “do you have any questions for me?” And if you just say, “Nope, can’t think of anything”, you just blew an opportunity to make a good last impression on that interviewer. So, display some curiosity. Think about some questions ahead of time that you might want to ask.

Another tip is always to think big. If you’re interviewing at a big technical company, everything you do has to be on a massive scale, with massive amounts of data, and huge requirements. Make sure you’re thinking about the business and not just the technology.

So here are the key takeaways: 

  • Perseverance and self-motivation are just as important as your technical skills. 
  • Research the company and understand its values and principles. 
  • Before your interview, practice coding, prepare questions to ask them, and think big! 

If you’re interested in learning more on how to nail your next tech interview – check out our full course, Mastering the Systems Design Interview, click here.

Or get access to our top courses (this one included) in our 10-Course Mega Bundle for only $50! Click here to learn more.

3 Tips to Ace Your Next Tech Interview

3 Tips to Ace Your Next Tech Interview

By Frank Kane 

This article is an excerpt from our “Mastering the System Design Interview” course. For this section, we will dive into a few tips and tricks to help you ace your tech interview. 

What are our hiring managers looking for? It’s more than just your technical skills. They want to see you have developed your soft skills as well. 

They want to see that you have determination, grit, perseverance-whatever you want to call it. They want to make sure that you have the internal drive and motivation to solve new problems and find new solutions on your own. 

1. Tech skills don’t matter as much as you think. 

You’re not going to be given recipes for how to solve the problems you’re given. You need to have the determination to figure these things out-collaboratively, of course, when appropriate-but, you’ve got to have the determination to get things done with minimal guidance. You shouldn’t need to have someone pushing you forward all the time. You need to be curious enough and driven enough to solve new problems that haven’t been solved before.

That’s what they want. Why? Because technology changes quickly. 

The technology they are quizzing you on from a technological standpoint might be obsolete a year from now. 

We talked about things like Apache Spark and Hadoop, for example. Hadoop’s already on the decline. The value of testing your knowledge on specific technologies really isn’t that high. But your ability to adapt to new technologies as they come out, your ability to self-learn, and continue to drive yourself forward, that’s what’s hard to find. That’s what they really want to see. 

Your determination to learn new technologies, or changes to technologies as they come out going forward, is what people want in the long term. You still need to prove you can code. That won’t go away anytime soon. You’ll still have to code on the whiteboard and show that you can think in code. You will be expected to code and assemble technical solutions from discreet components on a whiteboard or its digital equivalent. 

2. Demonstrate your coding skills and technical knowledge

Your tech skills still matter, but they’re just table stakes. Tech skills are what get your foot in the door. The first thing you’ll be asked is some simple coding questions. That’s to weed out the people who just can’t function, and there are a shockingly large number of them. But once you get past that initial hurdle of technology, what they’re really looking for is your perseverance and the inner qualities that will make you a good, long-term hire that can adapt to new, changing technologies. 

So how do you demonstrate perseverance? That’s a hard thing to show in the limited time of an interview. Interviewers have their ways of drawing it out of you, but a good way to approach this from your side is by telling them a story. 

Hiring managers are usually trained to do something called behavioral interviewing. They’re not going to ask you, “Did you do X?” and allow you to lie about it and say, “Yeah, I did X! I’m great at whatever that is!” They want to hear stories that they can dig into about how you demonstrated whatever skill they’re trying to find out about.

3. Tell real-life scenarios highlighting your skills 

So, make sure you have those stories ready. If they want a story about how you handled a very tough technical problem, how you handled some conflict within your team, or how you handled convincing your manager to do something the right way, have those stories in your back pocket. Those are things you can talk about to prove that you’ve dealt with these situations before, and how you dealt with them.

Expect the interviewer to dig into the details of your story. That’s the whole idea behind behavioral interviewing. They say, “Give me an example of when you did this,” and you say, “I did this, this way!”They will dig into details like, “Okay, tell me more about this aspect of it.”That’s their way of confirming that you really did what you said you did. 

Come prepared with those stories about how you solved challenging problems in the past. It could be stories from your past employers, from the world of academia, or even in a self-taught environment. You could talk about some Kaggle challenge you had trouble with.

Have a story about where and when you demonstrated perseverance in the real world. And there’s no better proof that you can do things than to say, “Hey, I’ve already done this before. I can tell you all about it.” 

Practice, practice, practice. It’s just like anything else. The more you practice, the better you get at it. The same is true of getting through an interview loop with a big technical company. 

So here are the key takeaways: 

  • Your tech skills don’t matter as much as your determination and perseverance. 
  • Be able to demonstrate your coding skills and technical knowledge. 
  • Have stories and real-life scenarios highlighting your skills prepared. 

If you’re interested in learning more on how to nail your Tech Interview – check out our full course, Mastering the Systems Design Interview: click here.

Or get all of them in our 10-Course Mega Bundle for only $50! Click here to learn more.

Machine Learning / Data Science Course Updated with GPT, ChatGPT, and Generative AI

We’ve just added over two hours of videos and hands-on learning exercises in our Machine Learning, Data Science, and Generative AI course! If you’re already enrolled in this course or through our Sundog Mega-Bundle, you have access to two new sections now: Generative AI and the OpenAI API.

We go in-depth on how GPT works, which is pretty exciting if you’re curious about exactly how ChatGPT sounds so much like an all-knowing real person. It’s not magic; you’ll learn how the Transformer architecture works, and how multi-headed self attention unlocked the key to training systems like GPT in parallel on massive amounts of training data.

You’ll also practice using the OpenAI API, allowing you to use GPT, ChatGPT, and DALL-E’s capabilities within your own applications.

These new lessons are chock-full of professionally designed illustrations, and new hands-on activities using Google CoLab, HuggingFace, and lots of our own code. There are a couple of really fun activities – we’ll fine-tune GPT using real IMDb movie reviews, and create a system capable of talking in depth about movies. And even more fun, we’ll create our own version of Data from Star Trek by fine tuning OpenAI’s Davinci model with all of the scripts from Star Trek: The Next Generation. Just imagine: we’re creating a real AI that mimics a fictional one from the 80’s!

These are exciting times in the world of AI, and understanding how the latest AI systems work will really make you stand out with your employers. Enroll now if you haven’t already.

CLOUD COMPUTING: A VERY BRIEF REVIEW – Part 1 

CLOUD COMPUTING: A VERY BRIEF REVIEW – Part 1 

By Frank Kane 

This article is an excerpt from our “Mastering the System Design Interview” course. For this section we will dive into a brief review of the various cloud computing technologies out there, and how they connect to the system design interview.  

One thing that’s changed in system design interviews is that it’s not always necessary to design things from scratch. We don’t always have to assume that you’re going to be designing your own layout of servers in your own data center. Oftentimes, you can just use an existing technology within one of those cloud service providers like Amazon Web Services or Google Cloud, or Microsoft Azure. And sometimes, that might be a perfectly appropriate thing to invoke, and it can save you some time and trouble. So, let’s get started!

Again, these are just tools in your toolbox that you can draw on during a given system design problem. I’m not going into a lot of depth here; I could spend hundreds of hours talking about each one of these services if I wanted to. The objective here is to know these services exist and you can call upon them as needed as part of your design. 

I’ve made three columns in the chart above, one for Amazon Web Services, one for Google Cloud, and one for Microsoft Azure. They all have their own offerings for these basic general classes of services. 

Let’s start with storage. You have to put your raw data somewhere, right? If you’re being asked to process a massive amount of data, that must start in some location. These storage services can store pretty much anything (technically they are “object stores”.) Unlike a database, they are not limited to structured data. 

AWS’s storage solution is S3, the Simple Storage Service. S3 is just a place where you can store objects across the cloud within AWS. You pay based on usage and the prices are cheap. If you need to store a massive dataset, you can throw it in S3 and then use additional AWS services to process that data and impart structure to it. 

Google Cloud offers cloud storage of its own, and Azure has different flavors of storage services. You can ask it for disk, blob, or data lake Storage, depending on what you’re trying to do. There’s that “data lake” term again. That is the concept of storing a massive amount of unstructured data somewhere, imparting structure to that data, and querying it as if it were structured. A data lake needs a massive storage solution like S3, Google Cloud Storage, or Microsoft Azure Data Lake Storage to store that data in the first place. 

Let’s also talk about compute resources. If you need to provision individual servers and you want to have complete control over what those servers are doing, they all have solutions for that as well. Amazon offers EC2 which allows you to rent virtual machines as small or large as you want. That can even include different flavors of boxes that might focus more on GPUs than CPUs or might focus more on memory or storage speed. Whatever it is you need to optimize for, they have a specific server type you can choose from. If you’re doing deep learning, you might want to choose one of their big GPU instances to throw the most muscle you can at a big deep learning problem (they won’t be cheap, though). 

Similarly, Google has Compute Engine, which is the same idea. And Microsoft Azure just calls their offering virtual machines. Every cloud provider has a solution for renting virtual machines on an as-needed basis and being charged by the hour for how much you’re using them. 

If you need a big NoSQL distributed database, we can do that too. DynamoDB is the go-to solution for that on AWS. Google Cloud still calls it BigTable, and they have some more specific services for more refined use cases. Azure has something called CosmosDB or Table Storage. All three providers offer a distributed NoSQL data store that will allow massive scaling of key/value lookups. 

Containers are also a big deal. If you want to deploy code to the outside world, putting that within a container is a modern operational practice. These days, Kubernetes is winning the battle versus Docker for what’s popular on the cloud services. All three services offer some sort of Kubernetes service. On AWS, they call that Kubernetes on ECR or ECS. Google Cloud also offers Kubernetes, and Azure as well. 

They each offer solutions for data streaming as well. You can always just run Kafka or Spark Streaming on a compute instance or on Amazon’s Elastic MapReduce (EMR) service. But there are also managed, purpose-built services for streaming. AWS has something called Kinesis that’s used for data streaming, which integrates tightly with other AWS services. That’s just used for getting data from one place to another, and maybe transforming it and analyzing it along the way. Google Cloud calls the same thing DataFlow, and Microsoft Azure offers Stream Analytics. 

We can also briefly discuss Spark and Hadoop. How would I deploy them in the public cloud? On AWS, they have something called EMR, which stands for Elastic MapReduce. The name is a bit of an anachronism because you can use it for much more than MapReduce these days. Specifically, you can also deploy Apache Spark on it, as well as other streaming technologies and analytics technologies. But the nice thing about EMR is that it manages the cluster for you. You just say, “Hey, I want a Spark cluster with this many nodes. Go create it for me”. And EMR says, “Yup, here you go. Here’s your master node. Go run your driver script here. And it’s all set up and ready for you.” EMR saves you a ton of hassle in provisioning and configuring those servers. You just get a Spark cluster that’s ready to go. 

Similarly, Google Cloud has something called Dataproc, and on Azure, they have an implementation of Databricks. Databricks is a very influential company in the world of Apache Spark and a big contributor to Spark itself. If you’re a fan of Databricks, Microsoft Azure might be your platform of choice. 

For larger-scale data warehousing, they all offer solutions for that as well. On AWS, we have something called Redshift. Again, you just tell it, “I want to provision a data warehouse that has this much storage capacity,” and it says, “Okay, here you go, go to town.” It also has a variant called Redshift Spectrum, which can sit on top of an S3 data lake and issue queries on unstructured data as well. Google Cloud still offers BigQuery, its original technology for distributing SQL queries or queries in general, across a massive dataset. And on Azure, we have Azure SQL or Azure Database. 

Finally, let’s talk about caching. On AWS, we have something called ElastiCache, which is just a wrapper on top of Redis. And on Google Cloud, they call it Memorystore, which can be Redis or Memcached under the hood. Azure offers a Redis solution as well. It seems like Redis is winning the battle against Memcached in the public cloud. All three platforms allow you to deploy your own Redis server fleet and manage it for you.

No matter the system the goal is always the same. If you’d like to learn more about any of these cloud computing platforms before you’re systems design interview. Enroll in our courses at www.sundog-education.com 

Or get all of them in our 10-Course Mega Bundle for only $50! Click here to learn more.