Countering the LLM parrot worshippers

bird-animal-beak-color-kiss-fauna-647058-pxhere.com_

Deep learning guru, NYU professor, and chief AI scientist at Meta Yann LeCun has been bullish about neural nets for years now. But in March 2023, his position became more nuanced. Here’s a slide he shared from a talk via Twitter:

Countering the LLM parrot worshippers
Yann LeCun Talk @ NYU (https://phildeeplearning.github.io/) on YouTube, March 2023

An auto-regressive large language model, I understand from LeCun’s March talk at the Philosophy of Deep Learning conference, is one with millions or billions of parameters, and one that continually predicts the next tokenized word or subword in a string of such words. Referring to AR-LLMs, he said, “Those things also suck. They’re amazing in many ways, but they’re nowhere near what’s required for human-level intelligence.”

It’s a relief to hear that folks like LeCun are also dissatisfied with the current state of these models. And it’s wearisome to hear enthusiasts who may know very little about large language models (LLMs) heap praise on GPTx like it’s the AI answer to all our prayers. My Twitter and LinkedIn feeds have been full of this talk for months.

Bizarrely, Geoff Hinton of the University of Toronto and a deep learning luminary himself with many decades of experience, went on the PBS News Hour in May 2023 to claim that GPT4 and other giant statistical language models like it have “understanding” and “intuition.”

Granted, LLMs can be useful tools, and the prompt + machine-assisted coding help they offer for developers is one of the most useful things about them. But when it comes to mainstream use, are they creating more problems than they’re solving right now?

The stochastic parrot and documentation debt

The more I read about LLMs, the more I find out about their long-term, detrimental effects.

For example, Emily Bender of the University of Washington and team have been critical of the LLM approach and particularly the size of and the less-than-painstaking approach to the datasets used to train the models.

Their most telling criticism is what they call “documentation debt”: “When we rely on ever larger datasets we risk incurring documentation debt,” they say, “i.e., putting ourselves in the situation where the datasets are both undocumented and too large to document post hoc…. The solution, we propose, is to budget for documentation as part of the planned costs of dataset creation, and only collect as much data as can be thoroughly documented within that budget.”

“Stochastic parrot” is a term Bender, et al., came up with to describe the fact that LLMs are just parroting what they’re being trained on. Here’s their definition:

“A Language Model is a system for haphazardly stitching together sequences of linguistic forms it has observed in its vast training data, according to probabilistic information about how they combine, but without any reference to meaning: a stochastic parrot.” –Emily Bender, et al.,

“On the Dangers of Stochastic Parrots: Can Language Models Be Too Big?,” ACM paper presented at FAccT ’21, March 3–10, 2021, virtual event, Canada

In that context, stochastic parrot worshippers IMHO are those who mindlessly praise LLMs without realizing they’ve mistaken the parrot part—probabilistic language methods alone–for the whole. These worshippers seem to assume those methods alone will deliver artificial general intelligence.

As Bender and team have pointed out, LLM question answering does not evidence natural language understanding (NLU). NLU requires the involvement of other disciplines–experts besides the existing cadre of statistical machine learning folks. In fact, it’s best if those experts bring other thinking styles to the table, welcomed by the ML folk. Otherwise, the result will be groupthink.

Avoiding AI groupthink: An oil and gas metaphor

Think of today’s LLMs as the tech industry equivalent of the energy industry’s kerosene, first distilled from coal and shale oil by the Chinese as far back as 1500 BC. Kerosene today is used as a base for jet fuel. But back then, the most common use for kerosene was as lamp oil and to heat homes.

The process used for making kerosene through the mid-1800s was expensive, just as LLMs are expensive today. But then people in Poland, Canada and the US discovered how to distill kerosene from petroleum. By the 1860s, kerosene displaced whale oil as the favored fuel for lamps.

In 1863, John D Rockefeller with his brother William and some other partners founded what became Standard Oil in the US. Standard Oil first gained prominence by making kerosene much more efficiently and cheaply than its competitors. Standard acquired its competitors and put the inefficient ones out of business.

Through the early 1900s Standard Oil diversified its products considerably by diversifying its petrochemical refineries. Instead of discarding the by-product gasoline, it used gasoline to power its own machines, and gasoline then became the standard fuel for cars. It bought a company that invented Vaseline, a petroleum-based lubricant and moisturizer. It developed and sold paraffin, a synthetic replacement for beeswax. Today, over 6,000 commercially made products are petroleum based.

A hybrid AI approach

Standard Oil created a system to extract, refine and distribute petroleum and petroleum-based products for various purposes. Similarly, what we need to create now is the data equivalent of a comparable system that extracts, refines, stores, and provides discoverability of and access to ready-to-use data and data products–not applications.

Today’s machine learning relies on probabilistic modeling only, as pointed out before. A hybrid AI approach called neurosymbolic AI, by contrast, incorporates the reasoning capabilities of knowledge representation and rules along with neural nets.

The following diagram, based on a video John Launchbury made when he was at DARPA, spells out how the probabilistic and deterministic can be blended together, which is how machines can reason their way to more certainty. With the right data, that is. Neurosymbolic AI is a means of contextual computing in Wave III. Statistical machine learning alone is still in Wave II.

To get to Wave III, data scientists need to collaborate with those who understand and value the symbolic side of AI.

Countering the LLM parrot worshippers

How to get ahead of the curve when using ChatGPT

How to Get Ahead of the Curve When Using ChatGPT

The majority of us are using ChatGPT incorrectly. The prompts we provide do not include examples. The fact that roles allow us to modify ChatGPT’s actions is overlooked.

Instead of feeding ChatGPT hard data, we just let it make educated guesses. This occurs because, most of the time, we rely on generic suggestions that may assist us in doing the task once but not again.

To improve our outcomes, we need to master the art of making effective prompts. Quick engineering is a skill we must have. In addition, this guide teaches us four methods of rapid engineering.

Standard Prompts Are Rarely Used

According to AI professionals, the few-shot standard prompts are the same as the regular ones, except they now provide examples of the assignment.

Whence the need for illustrations? Providing concrete instances of the problem that the prompt is attempting to tackle can greatly improve your chances of success.

The conventional format for few-shot AI prompts includes the job description, several examples, and the prompt itself. The prompt serves as the introduction to a new instance that the model is expected to finish by producing the remaining text.

Let’s pretend we need to evaluate the phrase “I want to fly from Orlando to Boston” for airport codes.

This is the typical question that will be asked:

Use this text to find the airport codes: “I’d like to book a flight from Orlando to Boston.”

This might be adequate, but it could also fall short. When this happens, you need to rely on a handful of tried-and-true cues.

Use this text to find the airport codes:

Text: “I’m looking at booking a flight from LA to Miami.”

Airport Codes: LAX, MIA

Text: “I would like to fly from Nashville to Kansas City.”

Airport Codes: BNA, MCI

Text: “I’d like to take a flight from Orlando to Boston.”

Airport Codes:

Remember that prior studies have indicated that the instances’ actual solutions are unimportant, but the labelspace is. The set of all feasible labels for a certain job is called the labelspace. The outcomes of your AI prompts might be enhanced by including arbitrary labels from the labelspace.

Let’s put this to the test by entering some made-up airport codes.

Use this text to find the airport codes:

Text: “I’m looking for a flight from LA to Miami.”

Airport Codes: DEN, OAK

Text: “I would like to fly from Nashville to Kansas City.”

Airport Codes: DAL, IDA

Text: “I would like to fly from Orlando to Boston.”

Airport Codes:

If you used the previous ChatGPT prompt, you would still receive the correct airport codes, MCO and BOS.

Include arbitrary labels from the labelspace regardless of how accurate your examples are. This will teach the model the proper way to best style the response to the prompt, allowing for the best possible results.

Prompting One’s Role

There are instances when ChatGPT’s default settings just won’t cut it. At this point, you’ll want to assign ChatGPT a specific function.

Let’s pretend you need to improve your job interview skills. ChatGPT may replicate any job interview by being instructed to “act as hiring manager” and given additional information about the employment being sought.

Similarly, you may transform ChatGPT into a movie critic to assess any film you choose to watch or a language instructor to learn a new language like Spanish.

Start your prompt with “Act as a…” and fill in the blanks with as much information as you can. You can discover examples of how to make ChatGPT act like a doctor, a stand-up comedian, and more in this repository if you’re feeling stuck.

Personalize Your Questions to Inspire Learning

These two methods of suggestion work well for thinking of material for writing projects like emails, blogs, tales, essays, etc.

When we say we should “add personality to our prompts,” we mean give them a voice and some identifying characteristics. Incorporating a style into our writing may help us achieve the desired formality, tone, and authorial voice.

Write about [subject] like you have at least ten years of expertise in [industry].

We may add descriptors to the output to further tailor it to our needs. To modify your prompt, you may include a description, which is just an adjective.

Let’s say you have 500 words and an idea of how AI will cause the end of the human race. With a basic request like “Write a 500-blog post on how AI will replace humans,” you’re likely to receive a generic blog post.

However, the addition of words like inspiring, satirical, fascinating, and engaging using AI tools will significantly change the outcome.

To our last prompt, let us add some descriptive words.

Create a clever 500-word blog article explaining why AI won’t replace human beings. Use the tone of a writer who has been working with AI for at least ten years. Provide illustrative examples.

Now we may enhance the post using the generated knowledge strategy. The goal here is to come up with as much relevant data as possible before coming to a conclusion.

Prompting a Continuum of Thoughts

Chain of thought prompting differs from traditional prompting in that it induces the model to generate intermediate reasoning stages prior to providing a solution. In other words, rather than just providing a solution, the model will provide an explanation of its thought process.

Why is it so crucial to use reason? Justifying one’s actions usually produces more reliable results.

To implement thought-chain prompting, we must provide relatively brief instances in which the logic is presented with the sample itself. In this manner, not only will the solution to the question be shown, but so will the logic behind it.

To Conclude

Embracing ChatGPT as a crucial tool in your daily interactions with clients and colleagues will set you apart from the rest. It’s essential to understand that using ChatGPT is not only about responding promptly but also about providing quality service.

The tips we’ve shared in this blog will undoubtedly help you get ahead of the curve when using ChatGPT. Keep in mind that ChatGPT is continually evolving, so it’s essential to stay updated with new features and trends. Use artificial intelligence certification by a reputed platform to your advantage, and you’ll undoubtedly build meaningful relationships that will benefit your brand and career in the long run.

The Peril of AI: Leading Scientists Sound Alarm on Extinction-Level Threat Comparable to Nuclear War

Yet Again, OpenAI’s GPT-3 Proved To Be A Doom For Humanity

A collective of AI scientists, including Turing Award recipients Geoffrey Hinton and Yoshua Bengio, as well as Sam Altman of OpenAI and Demis Hassabis of Google DeepMind, have endorsed a concise statement from the Center for AI Safety.

The joint statement is that safeguarding against the threat of extinction posed by AI should be regarded as a global priority on par with other significant risks to society, such as pandemics and nuclear warfare, adding on to the steady stream of doomsday predictions revolving around AI.

This unprecedented collaboration brings together AI experts, along with philosophers, ethicists, legal scholars, economists, physicists, political scientists, pandemic scientists, nuclear scientists, and climate scientists, in recognizing the risk of extinction from advanced AI systems as one of the most critical challenges facing the world. Every other influential leader also repeated this sentiment right after OpenAI was released which probably influences the growing public sentiment, as a recent poll revealed that 61 percent of Americans believe AI poses a threat to humanity’s future.

The mounting concerns regarding the potential consequences of AI echo the early discussions surrounding atomic energy, where J. Robert Oppenheimer, one of the pioneers of the atomic bomb, had emphasised the need for international cooperation to prevent nuclear war.

Dan Hendrycks, the Director of the Center for AI Safety, highlights the importance of engaging in conversations similar to those held by nuclear scientists before the development of the atomic bomb. He stresses that addressing the negative impacts of AI, which are already being experienced globally, is imperative. Additionally, we must anticipate the risks associated with more advanced AI systems.

Hendrycks also asserts that while we grapple with immediate AI risks, such as malicious use, misinformation, and disempowerment, the AI industry and governments worldwide must seriously confront the potential threat that future AI systems may pose to human existence. Effectively mitigating the risk of AI-induced extinction will necessitate collaborative global action.

There are sceptics who contend that A.I. technology is not yet developed enough to pose a threat of great magnitude. Their concerns primarily revolve around immediate issues such as biassed and inaccurate responses, rather than long-term risks.

The post The Peril of AI: Leading Scientists Sound Alarm on Extinction-Level Threat Comparable to Nuclear War appeared first on Analytics India Magazine.

LLM Apocalypse Now: Revenge of the Open Source Clones

LLM Apocalypse Now: Revenge of the Open Source Clones
Image from Adobe Firefly

“There were too many of us. We had access to too much money, too much equipment, and little by little, we went insane.”

Francis Ford Coppola wasn’t making a metaphor for AI companies that spend too much and lose their way, but he could have been. Apocalypse Now was epic but also a long, difficult and expensive project to make, much like GPT-4. I’d suggest that the development of LLMs has gravitated to too much money and too much equipment. And some of the “we just invented general intelligence” hype is a little insane. But now it’s the turn of open source communities to do what they do best: delivering free competing software using far less money and equipment.

OpenAI has taken over $11Bn in funding and it is estimated GPT-3.5 costs $5-$6m per training run. We know very little about GPT-4 because OpenAI isn’t telling, but I think it’s safe to assume that it isn’t smaller than GPT-3.5. There is currently a world-wide GPU shortage and – for a change – it’s not because of the latest cryptocoin. Generative AI start-ups are landing $100m+ Series A rounds at huge valuations when they don’t own any of the IP for the LLM they use to power their product. The LLM bandwagon is in high gear and the money is flowing.

It had looked like the die was cast: only deep-pocketed companies like Microsoft/OpenAI, Amazon, and Google could afford to train hundred-billion parameter models. Bigger models were assumed to be better models. GPT-3 got something wrong? Just wait until there's a bigger version and it’ll all be fine! Smaller companies looking to compete had to raise far more capital or be left building commodity integrations in the ChatGPT marketplace. Academia, with even more constrained research budgets, was relegated to the sidelines.

Fortunately, a bunch of smart people and open source projects took this as a challenge rather than a restriction. Researchers at Stanford released Alpaca, a 7-billion parameter model whose performance comes close to GPT-3.5’s 175-Billion parameter model. Lacking the resources to build a training set of the size used by OpenAI, they cleverly chose to take a trained open source LLM, LLaMA, and fine-tune it on a series of GPT-3.5 prompts and outputs instead. Essentially the model learned what GPT-3.5 does, which turns out to be a very effective strategy for replicating its behavior.

Alpaca is licensed for non-commercial use only in both code and data as it uses the open source non-commercial LLaMA model, and OpenAI explicitly disallows any use of its APIs to create competing products. That does create the tantalizing prospect of fine-tuning a different open source LLM on the prompts and output of Alpaca… creating a third GPT-3.5-like model with different licensing possibilities.

There is another layer of irony here, in that all of the major LLMs were trained on copyrighted text and images available on the Internet and they didn’t pay a penny to the rights holders. The companies claim the “fair use” exemption under US copyright law with the argument that the use is “transformative”. However, when it comes to the output of the models they build with free data, they really don’t want anyone to do the same thing to them. I expect this will change as rights-holders wise up, and may end up in court at some point.

This is a separate and distinct point to that raised by authors of restrictive-licensed open source who, for generative AI for Code products like CoPilot, object to their code being used for training on the grounds that the license is not being followed. The problem for individual open-source authors is that they need to show standing – substantive copying – and that they have incurred damages. And since the models make it hard to link output code to input (the lines of source code by the author) and there’s no economic loss (it’s supposed to be free), it’s far harder to make a case. This is unlike for-profit creators (e.g, photographers) whose entire business model is in licensing/selling their work, and who are represented by aggregators like Getty Images who can show substantive copying.

Another interesting thing about LLaMA is that it came out of Meta. It was originally released just to researchers and then leaked via BitTorrent to the world. Meta is in a fundamentally different business to OpenAI, Microsoft, Google, and Amazon in that it isn’t trying to sell you cloud services or software, and so has very different incentives. It has open-sourced its compute designs in the past (OpenCompute) and seen the community improve on them – it understands the value of open source.

Meta could turn out to be one of the most important open-source AI contributors. Not only does it have massive resources, but it benefits if there is a proliferation of great generative AI technology: there will be more content for it to monetize on social media. Meta has released three other open-source AI models: ImageBind (multi-dimensional data indexing), DINOv2 (computer vision) and Segment Anything. The latter identifies unique objects in images and is released under the highly permissive Apache License.

Finally we also had the alleged leaking of an internal Google document “We Have No Moat, and Neither Does OpenAI” which takes a dim view of closed models vs. the innovation of communities producing far smaller, cheaper models that perform close to or better than their closed source counterparts. I say allegedly because there is no way to verify the source of the article as being Google internal. However, it does contain this compelling graph:

LLM Apocalypse Now: Revenge of the Open Source Clones
The vertical axis is the grading of the LLM outputs by GPT-4, to be clear.

Stable Diffusion, which synthesizes images from text, is another example of where open source generative AI has been able to advance faster than proprietary models. A recent iteration of that project (ControlNet) has improved it such that it has surpassed Dall-E2’s capabilities. This came about from a whole lot of tinkering all over the world, resulting in a pace of advance that is hard for any single institution to match. Some of those tinkerers figured out how to make Stable Diffusion faster to train and run on cheaper hardware, enabling shorter iteration cycles by more people.

And so we have come full circle. Not having too much money and too much equipment has inspired a cunning level of innovation by a whole community of ordinary people. What a time to be an AI developer.
Mathew Lodge is CEO of Diffblue, an AI For Code startup. He has 25+ years’ diverse experience in product leadership at companies such as Anaconda and VMware. Lodge is currently serves on the board of the Good Law Project and is Deputy Chair of the Board of Trustees of the Royal Photographic Society.

More On This Topic

  • Introducing MPT-7B: A New Open-Source LLM
  • The 7 Best Open Source AI Libraries You May Not Have Heard Of
  • Top Open Source Large Language Models
  • GitHub Copilot Open Source Alternatives
  • Baize: An Open-Source Chat Model (But Different?)
  • OpenChatKit: Open-Source ChatGPT Alternative

 5 Android Apps That Were Caught Spying

Recently, an Android app called iRecorder – Screen Recorder was busted spying on Android phones. The sneaky little app not only recorded the screen like it was supposed to, but it also had a secret side gig as an audio spy, sending your confidential conversations to a developer’s server like it was the latest gossip.

But wait, there’s more! This app wasn’t just a one-time offender, oh no. It had been lurking in the shadows of the Google Play Store since September 2021, amassing a staggering 50,000 downloads. Apparently, its creator had a knack for multi-tasking, as they managed to master the art of screen recording while moonlighting as a shady server’s courier for your intimate conversations.

In this day and age, privacy seems to be about as mythical as unicorns. We can’t help but wonder, how many more popular applications are out there, pulling the wool over our unsuspecting eyes. Will we ever regain our privacy, or is it doomed to become an endangered species in the digital jungle?

CamScanner

CamScanner is a popular mobile application used for scanning documents using a smartphone camera. It allows users to convert images into PDF or JPEG files and offers additional features such as OCR (optical character recognition) for extracting text from scanned documents. However, the application is touted to be a safety hazard.

Cybersecurity experts have found a malicious component installed in the app that acts as a Trojan Downloader and keeps collecting infected files. This kind of app can seriously damage the users’ phones and should be de-installed instantly. Luckily, once you remove it from your phone, it is highly unlikely that it will continue harming you.

The application was among the first tranche of Chinese apps to be banned by India in June 2020 over concerns about national security.

Facebook

Facebook is widely regarded as the worst app for compromising personal information, according to experts. Its data collection practices are extensive and often more invasive than those of Google. Raffi Jafari, cofounder and creative director of Caveni Digital Solutions, asserts that if you had to choose one app to delete for data protection, it should be Facebook.

In a recent development, the European Union imposed a record-breaking $1.3 billion privacy fine on Meta (formerly Facebook) and mandated the cessation of user data transfers across the Atlantic by October. This decision is the latest development in a long-standing case fueled by concerns about U.S. cybersnooping. The fine of 1.2 billion euros exceeds the previous highest penalty under the EU’s stringent data privacy regulations, which was Amazon’s 746 million euro fine in 2021 for data protection breaches.

Whatsapp

The news is, even your beloved app, WhatsApp, isn’t entirely secure. In the past year, WhatsApp inadvertently released a “critical” vulnerability that has since been patched in newer versions of the app. However, older installations that haven’t been updated could still be susceptible. This information was disclosed in a September update on WhatsApp’s security advisory page and came to light on September 23rd.

This critical bug essentially allows attackers to take advantage of an integer overflow code error. By exploiting this vulnerability, attackers can execute their own code on a victim’s smartphone after initiating a specially crafted video call. Exploiting remote code execution vulnerabilities is a crucial step for installing malware, spyware, or other malicious applications on a target system. Essentially, it serves as a gateway for attackers to compromise the victim’s device further using techniques like privilege escalation attacks.

Flashlight Apps

According to numerous experts, free flashlight apps pose significant cybersecurity risks. Although these apps are available at no cost and are ad-supported, they often request permissions that seem necessary for their functionality, such as audio recording and access to contact information. However, when users install these apps, they unknowingly expose their personal data to app developers who monetize it by selling it to advertisers.

Zombie Mod

The infamous game has gained notoriety for its audacious endeavour to acquire an extensive range of personal data from users’ Google accounts, encompassing Gmail usernames and passwords. Furthermore, it shamelessly sought to generate profits through intrusive advertisements, which, in certain instances, resulted in device malfunctions, leaving users with no choice but to reset their devices and begin anew.

According to reports, this particular game has had a detrimental impact on over 50,000 Android users and is part of a group of modified games that share a common underlying code structure.

The post 5 Android Apps That Were Caught Spying appeared first on Analytics India Magazine.

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices
Image by Author

ChatGPT, its successor GPT-4, and their open-source alternatives have been extremely successful. Developers and data scientists are all looking to be more productive and use ChatGPT to simplify their day-to-day tasks.

Here, we’ll see how to use ChatGPT for data science through a pair programming session with ChatGPT. We’ll build a text classification model, visualize the dataset, identify the best hyper parameters for the model, try out different machine learning algorithms, and more—all using ChatGPT.

Along the way, we’ll also look at certain tips to structure prompts so as to get helpful results. To follow along, you need to have a free OpenAI account. If you're a GPT-4 user, you can follow along with the same prompts, too.

Build a Working Model Faster

Let us try to build a news classification model using ChatGPT for the 20 newsgroups dataset in scikit-learn.

Here’s the prompt I used: “I’d like to build a news classification model using sklearn 20 newsgroups dataset. Do you know about this?”

Though my prompt is not very specific at this point, I’ve stated both the objective and the dataset:

  • Objective: To build a new classification model
  • Dataset to use: 20 newsgroups dataset from scikit-learn

The response from ChatGPT tells us to start by loading the dataset.

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices

# Load the dataset  newsgroups_train = fetch_20newsgroups(subset='train', shuffle=True)  newsgroups_test = fetch_20newsgroups(subset='test', shuffle=True)

As we’ve also stated the objective (to build a text classification model), ChatGPT tells us how we can go about doing this.

We see that it gives us the following steps:

  • Using TfidfVectorizer for text preprocessing and coming up with a numerical representation. This approach of using the TF-IDF scores is better than using the count occurrences using a CountVectorizer.
  • Creating a classification model on the numeric representation of the dataset using a Naive Bayes or Support Vector Machine (SVM) classifier.

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices

It also gave the code for a Multinomial Naive Bayes classifier, so let’s use it and check if we can have a working model already.

from sklearn.feature_extraction.text import TfidfVectorizer  from sklearn.naive_bayes import MultinomialNB  from sklearn.metrics import classification_report    # Preprocess the text data  vectorizer = TfidfVectorizer(stop_words='english')  X_train = vectorizer.fit_transform(newsgroups_train.data)  X_test = vectorizer.transform(newsgroups_test.data)    # Train a Naive Bayes classifier  clf = MultinomialNB()  clf.fit(X_train, newsgroups_train.target)    # Evaluate the performance of the classifier  y_pred = clf.predict(X_test)  print(classification_report(newsgroups_test.target, y_pred))

I went ahead and ran the above code. And it works as expected—without errors. We went from a blank screen to a text classification model—in a few minutes—with a single prompt.

Output >>  precision    recall  f1-score   support               0       0.80      0.69      0.74       319             1       0.78      0.72      0.75       389             2       0.79      0.72      0.75       394             3       0.68      0.81      0.74       392             4       0.86      0.81      0.84       385             5       0.87      0.78      0.82       395             6       0.87      0.80      0.83       390             7       0.88      0.91      0.90       396             8       0.93      0.96      0.95       398             9       0.91      0.92      0.92       397            10       0.88      0.98      0.93       399            11       0.75      0.96      0.84       396            12       0.84      0.65      0.74       393            13       0.92      0.79      0.85       396            14       0.82      0.94      0.88       394            15       0.62      0.96      0.76       398            16       0.66      0.95      0.78       364            17       0.95      0.94      0.94       376            18       0.94      0.52      0.67       310            19       0.95      0.24      0.38       251        accuracy                           0.82      7532     macro avg       0.84      0.80      0.80      7532  weighted avg       0.83      0.82      0.81      7532

Though we got a working model to solve the problem at hand, here are certain tips that can help you when prompting. The prompt could have been better and broken down into smaller steps, like so:

  • Please tell me more about the scikit-learn 20 newsgroups dataset.
  • What are the possible tasks that I can perform with this dataset? Can I build a text classification model?
  • Can you tell me which machine learning algorithm will be best suited for this application?

Visualize the Dataset

Okay, we’ve already built a text classification model. But it happened really fast, so let's slow down and try to come up with the simple visualization of the dataset.

In particular, let’s try to understand the distribution of the training samples across the 20 news categories and identify if there is any class imbalance.

Here is the prompt that I used: “I’d like to visualize the dataset to understand the class distribution and identify class imbalance. Can you help me with the visualization?”

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices
ChatGPT suggested that a bar chart or histogram of the number of samples in each of the classes would be a good visualization. That sounds reasonable.

Here is the code that ChatGPT generated to create a simple bar chart in matplotlib:

import matplotlib.pyplot as plt    # Load the dataset  newsgroups_train = fetch_20newsgroups(subset='train', shuffle=True)    # Count the number of samples for each class  class_counts = {}  for label in newsgroups_train.target:      class_name = newsgroups_train.target_names[label]      if class_name in class_counts:          class_counts[class_name] += 1      else:          class_counts[class_name] = 1    # Plot the class distribution  plt.bar(class_counts.keys(), class_counts.values())  plt.xticks(rotation=90)  plt.xlabel('Class')  plt.ylabel('Number of Samples')  plt.title('Class Distribution')  plt.show()

Here is the plot. It's neat, the labels are readable. We can also see the number of samples in each of the 20 classes.

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices

The distribution of training samples across the 20 classes is approximately even, and there is no visible class imbalance. Therefore, the model that we obtained in the previous step is useful. And we don't need to use any novel resampling techniques to address class imbalance.

Hyperparameter Tuning

Next, I would like to tune the hyperparameters of the model. First, I would like to understand the different hyperparameters that can be tuned. Then, we can do a simple grid search if there are not too many hyperparameters.

Here’s the prompt: “Are there any hyperparameters I can tune to make the classifier model better?”

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices

In the code that we got, max_df for the TfidfVectorizer is also tunable. We know that TF-IDF score works by assigning higher weight to terms that occur frequently in a particular document while assigning substantially lower weight to terms that occur frequently in all the documents. The max_df uses the percentage of occurrence to ignore a particular term.

For example, max_df of 0.5 indicates that all terms that occur in at least 50% of the documents will be ignored. If you’d like, you can remove this. But I am going to retain it just to see what max_df I can use.

The code uses a simple grid search and picks the optimal values based on cross-validation scores.

from sklearn.model_selection import GridSearchCV  from sklearn.pipeline import Pipeline    # Define the pipeline with TF-IDF and Multinomial Naive Bayes  pipeline = Pipeline([      ('tfidf', TfidfVectorizer(stop_words='english')),      ('clf', MultinomialNB())  ])    # Define the hyperparameter grid  param_grid = {      'tfidf__max_df': [0.5, 0.75, 1.0],      'clf__alpha': [0.1, 0.5, 1.0],      'clf__fit_prior': [True, False],  }    # Perform grid search with cross-validation  grid_search = GridSearchCV(pipeline, param_grid, cv=5)  grid_search.fit(newsgroups_train.data, newsgroups_train.target)    # Print the best hyperparameters and cross-validation score  print("Best hyperparameters: ", grid_search.best_params_)  print("Cross-validation score: ", grid_search.best_score_)
Output >>  Best hyperparameters:  {'clf__alpha': 0.1, 'clf__fit_prior': False, 'tfidf__max_df': 0.5}  Cross-validation score:  0.9088736147919108

Plugging in the values of these hyperparameters, I got about 2% improvement in the classification accuracy.

Here, we didn’t have a lot of hyperparameters to tune. If you have a lot of hyperparameters where each can take on a set of values, running grid search might be expensive. And it might make sense to run a randomized search instead.

Faster Iteration Over Different Models

We saw in one of the first steps that an SVM works fine for such a classification problem, too.

I’d now like to build a support vector classifier for the same dataset.

The prompt I used: “Can you let me know if I can use an SVM to solve the same problem? Can you generate the code to do that?”

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices

And here we go:

from sklearn.datasets import fetch_20newsgroups  from sklearn.feature_extraction.text import TfidfVectorizer  from sklearn.svm import SVC  from sklearn.metrics import accuracy_score  from sklearn.model_selection import train_test_split    # Load the dataset  newsgroups_train = fetch_20newsgroups(subset='train', shuffle=True)    # Convert the text data to a matrix of TF-IDF features  vectorizer = TfidfVectorizer()  X = vectorizer.fit_transform(newsgroups_train.data)  y = newsgroups_train.target    # Split the data into training and testing sets  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)    # Define the SVM classifier  clf = SVC(kernel='linear')    # Train the SVM classifier  clf.fit(X_train, y_train)    # Predict the class labels for the test set  y_pred = clf.predict(X_test)    # Calculate the accuracy of the SVM classifier  accuracy = accuracy_score(y_test, y_pred)  print('Accuracy:', accuracy)

Given that we have an accuracy score of over 90%, SVM seems to be a good choice for this dataset.

Output >> Accuracy: 0.9019001325673884

As seen, you can use ChatGPT to quickly try out different models to solve the same problem.

Exploring Dimensionality Reduction

Once you’ve doubled down on building a working model, you can as well explore other available directions. Let’s look at dimensionality reduction as an example.

At this point, I’m not interested in running dimensionality reduction algorithms because I already have a working model. And the feature space is not very high dimensional. So we don’t need to reduce the number of dimensions ahead of model building.

However, let’s look at the approaches to dimensionality reduction for this specific dataset.

The prompt I used: “Can you tell me the dimensionality reduction techniques that I can use for this dataset?”

Integrating ChatGPT Into Data Science Workflows: Tips and Best Practices

The following techniques have been suggested by ChatGPT:

  • Latent Semantic Analysis or SVD
  • Principal Component Analysis (PCA)
  • Non-negative Matrix Factorization (NMF)

Let's end our discussion by enumerating the best practices to use ChatGPT.

Best Practices to Use ChatGPT for Data Science

The following are some of the best practices to keep in mind when using ChatGPT for data science:

  • Don't input sensitive data and source code: Do not feed in any sensitive data into ChatGPT. When you’re working on data teams in organizations, you’ll often build models on customer data—which should be kept confidential. You can instead try to build prototypes for similar publicly available datasets and try to transpose it onto your dataset or problem. Similarly, refrain from inputting sensitive source code or any info that should not be disclosed.
  • Be specific with your prompts: Without specific prompts, it is quite difficult to get helpful answers from ChatGPT. Therefore, structure your prompt such that they’re specific enough. Prompts should at the least, convey the objective clearly. one step at a time.
  • Decompose longer prompts into smaller prompts: If you have a chain of thought on accomplishing a particular task, try to break it down into simpler steps and prompt ChatGPT to do each of the steps.
  • Debug effectively using ChatGPT: In this example, all the code that we got ran without errors; but this may not always be the case. You may run into errors because of deprecated features, invalid API references, and more. When you run into errors, you can feed in the error message and relevant traceback in your prompt. And look at the offered solutions, then proceed to debug your code.
  • Track prompts: If you use (or plan on using) ChatGPT a lot in your everyday data science workflow, it might be a good idea to keep track of the prompts. This can help refine prompts over time and identify prompt engineering techniques to get better results from ChatGPT.

Conclusion

When using ChatGPT for data science applications, understanding the business problem is the first and the most important step. Therefore, ChatGPT is only a tool to simplify and automate certain tasks and is not a replacement for the technical expertise of developers.

However, it’s still an invaluable tool to increase productivity by helping quickly build and test out different models and algorithms. So let’s leverage ChatGPT to hone our skills and become better developers!
Bala Priya C is a developer and technical writer from India. She likes working at the intersection of math, programming, data science, and content creation. Her areas of interest and expertise include DevOps, data science, and natural language processing. She enjoys reading, writing, coding, and coffee! Currently, she's working on learning and sharing her knowledge with the developer community by authoring tutorials, how-to guides, opinion pieces, and more.

More On This Topic

  • Software Engineering Tips and Best Practices for Data Science
  • Automation in Data Science Workflows
  • 7 Tips for Data Science Project Management
  • Quick Data Science Tips and Tricks to Learn SAS
  • 7 Tips To Produce Readable Data Science Code
  • Six Tips on Building a Data Science Team at a Small Company

Meet Maya, Myntra’s first virtual fashion influencer

Influencer marketing is no stranger to the world, but a new wave is currently surging across the consumer industry in India – the advent of virtual influencers. Big name global brands like Nike, Calvin Klein, and Samsung have been making the most of this trend for years. India joined the bandwagon in January 2022 with its first virtual influencer, ‘Kyra’.

Now, Myntra, the e-commerce platform owned by Walmart, has introduced ‘Maya’, its premier virtual fashion influencer. According to Sunder Balasubramanian, Myntra’s Chief Marketing Officer, “Maya, a distinctive figure of Myntra Fashion Forward (FWD), will function as an influencer on social media and also be part of Myntra’s own social commerce on the Myntra Studio platform.”

He adds, “Maya, in collaboration with our influencers, will jointly establish trends and guide users in identifying them, thus facilitating a simpler shopping experience.” This digital avatar, with the Instagram handle ‘@maya_unlimited’, is conceived to be located in Bengaluru within Myntra’s virtual universe.

Launching alongside Myntra’s 18th biannual ‘End of Reason Sale’ (‘EORS’), Maya will act as the ‘style hacker’ for Generation Z, providing insight into trends and deals. “With an understanding of the necessity to blend global progress with the interests of the next generation, we are leading the way with Maya, who will redefine fashion with her trendy and daring approach, sure to appeal to fashion-forward individuals nationwide,” Balasubramanian shares.

EORS-18 is slated to commence on June 1, 2023, with exclusive early access for ‘Myntra Insiders’ on May 31. The event will present a broad array of over 6,000 brands and two million styles. As per the company, Maya will personally select her top picks from EORS-18 and share the trendiest FWD styles on her Instagram, providing a sneak peek into the future of product endorsements.

Data from the ‘Virtual Influencers Survey 2022’ reveals that 58% of respondents follow at least one virtual influencer, with 27% following for the content, 19% for storytelling, and 15% for the inspiration they provide.

Myntra has been heavily integrating AI into their operations, as evident from their recent introduction of MyStylist, a digital personal stylist for users, and MyFashionGPT, which allows users to conduct searches in a more conversational manner rather than just relying on keywords. Balasubramanian concludes, “These tools help users to not only explore a wide variety of exciting offers but also discover them in a manner that suits them best.” The platform has further improved its technology by enabling search in over 11 languages to cater to a wider range of consumers.

The post Meet Maya, Myntra’s first virtual fashion influencer appeared first on Analytics India Magazine.

5 Mantras by Tech Leaders that Will Transform Your Life 

Over the years, several tech pioneers have given commencement speeches, but not all are memorable. Recently, NVIDIA’s founder and chief operating officer Jensen Huang addressed the graduating students at National Taiwan University in Taipei, imploring them to “Run, don’t walk”, seize opportunities fearlessly, but also be ready to embrace the inevitable failures along the way.

Looking back, we have found some interesting yet meaningful commencement speeches of all time that have shaped lives.

Read more: In 30 years, NVIDIA died almost 3 times

Bill Gates

“We can make market forces work better for the poor if we can develop a more creative capitalism.”

Bill Gates did not complete his bachelor’s degree. The Harward dropout left college to build Microsoft, which is now a leading tech giant. However, during his 2007 commencement speech at Harvard, Gates candidly admits that when leaving college, he was unaware of the extent of global inequities, but later became aware of them and took action. Gates emphasised the importance of addressing these inequities and advocated the concept of “creative capitalism”, which involves utilising market forces to benefit those in poverty, leading to the creation of the Bill & Melinda Gates Foundation.

The billionaire believes that the modern age, with its advancements in technology and innovation, presents unparalleled opportunities to combat poverty and preventable diseases. Gates encourages graduates to collaborate, harness their intellect and talents, and actively engage in solving global challenges. He called on Harvard graduates to dedicate their resources and intellectual prowess to improving the lives of the underprivileged. Ultimately, Gates urges graduates to apply their education towards innovative solutions that address and rectify social and economic disparities.

Sundar Pichai

“Be impatient. It will create the progress the world needs.”

At YouTube’s “Dear Class of 2020” virtual graduation ceremony event for graduates whose ceremonies were cancelled due to COVID-19, Google chief Sundar Pichai, gave an encouraging speech to the students to maintain a positive outlook and use their education for the betterment of the world.

Drawing inspiration from past generations who overcame similar challenges, he urged the graduates to remain open to new ideas and identify their personal passions without thinking about what society will say. Additionally, he encouraged them to fearlessly embrace impatience and actively strive for transformative progress.

Sheryl Sandberg

“It’s not enough to be technologists — we have to make sure that technology serves people.”

At MIT’s 2018 graduation, Sheryl Sandberg, the former COO of Meta encouraged students to embrace uncertainty and be open to new possibilities, highlighting that life’s challenges and opportunities are rooted in humanity, not just technology.

As technologists, it is their responsibility to ensure their tech advancements serve people and uphold the right values, emphasising the importance of diversity in shaping unbiased technology. She urged the graduates to use their skills to make a positive impact, addressing inequality, promoting ethics, and fostering respectful workplaces. The graduates were reminded of their ability to shape a better future by embracing challenges, being accountable, and building technology that serves humanity.

Read more: Why Big Techs Are Pushing Rust

Mark Zuckerberg

“Purpose is that sense that we are part of something bigger than ourselves, that we are needed, that we have something better ahead to work for. Purpose is what creates true happiness.”

Mark Zuckerberg, another successful Harvard dropout, Zuckerberg addressed the graduating students on the importance of entrepreneurship, big ideas, equal economic opportunities and having the freedom to fail.

The Meta chief and cofounder highlighted the need to create a society that allows everyone to pursue their ideas and goals. He also addressed issues such as student loans and immigration, a topic close to his heart. Zuckerberg’s speech threw light on the overarching theme of “purpose” and the importance of creating a more inclusive and meaningful world for others, urging students to actively contribute to helping others discover their own purpose in life.

Steve Jobs

“Stay Hungry, Stay Foolish”

In no way can we curate the finest speeches of all time without mentioning Steve Jobs. Jobs’ 2005 speech at Stanford University stands out to date with more than 42 million views on YouTube, making it the most-watched graduation speech ever.

The Apple cofounder shared important stories from his life that marked turning points in his professional life. He dropped out of college but took a calligraphy class that later influenced the design of the Macintosh computer. He then co-founded Apple with Steve Wozniak, Ronald Wayne, got fired, but rediscovered his passion and founded NeXT and Pixar. Eventually, Apple acquired NeXT, leading to his return and the company’s success.

Finally, he spoke about death. He shared how after being diagnosed with a rare form of pancreatic cancer and being told that had a short time to live, he learned to value each day and make meaningful choices. He spoke about the brevity of life, urging graduates to pursue their passions, and not to be influenced by others’ opinions. He encouraged them to trust their intuition, stay hungry for knowledge, and remain foolish in taking risks.

Although Jobs passed away in 2011, his speech continues to inspire countless individuals to this day.

Read more: The Untold Story of Alignment Tax of GPT

The post 5 Mantras by Tech Leaders that Will Transform Your Life appeared first on Analytics India Magazine.

In 30 years, NVIDIA died almost 3 times

“Run, don’t walk. Either you are running for food, or you are running from becoming food.” Jensen Huang’s recent speech to the graduating students of National Taiwan University (NTU) comes at a time right when NVIDIA is soaring high with its recent market cap valuation of close to $1 trillion. Of the many things that Jensen Huang addressed, including how an AI revolution has begun, the company’s resilience and future-thinking have made it what it is today in spite of the company reaching the brink of failure three times in as many decades.

Evolving Times

The fast pace with which technology is evolving has seen the invention of many things. As Huang pointed out, in the last 40 years, “we created the PC, internet, mobile and now an AI era”. He emphasised on how the AI we see now will be revolutionised, reborn and ready for new ideas.

With the accelerated pace of AI development, the scope for AI to create new jobs will go up and bring forth jobs that never existed, such as prompt engineering, AI factory operations, and AI safety engineers. He clarified that though there’s some worry about AI taking away jobs, it won’t actually be AI, but “someone who is an expert with AI” that may take your job away.

Carving a Niche

The company has always been a step ahead when it comes to innovating and breaking the market. NVIDIA has been successful in staying ahead of the curve by taking huge risks and going against the tide. In his NTU speech, Huang spoke about one of the biggest risks the company took in 2010. When every company was fighting to be a part of the phone market, NVIDIA, instead of trying to fight for a market share in the segment, retreated from it. “A strategic retreat that paid off,” he affirmed.

By not pursuing the phone market, the company went on to invent new things. NVIDIA envisioned creating a new type of computer with “neural network processors, safety architectures that run AI algorithms”. This was at a time when it was a “zero billion dollar market”. NVIDIA’s CUDA was released in 2007 and had been integrated into their GPUs despite initial criticism. Owing to the high cost of CUDA, the company took a huge hit on their profits for many years, however, it paid off as it became instrumental in machine learning.

Upfront about Failures

NVIDIA was on the verge of one of the biggest failures during its initial days. It had partnered with Sega to provide 3D chips for its new gaming console. However, the company realised that its architecture was wrong and the only way ahead was to back out from it. No matter how embarrassing it was, the company was upfront about its shortcomings and asked Sega to find another partner, and even requested them to pay them as a whole, or else the company would be out of business. With Sega agreeing, NVIDIA had a breather for six months when they built RIVA 128 which Huang believes “shocked the 3D market, put us on the map, and saved the company”. A simple act of confronting its mistake and asking for help ensured NVIDIA thrived.

Scaling New Heights

Almost touching $1 trillion, making it the 7th company in the world to reach a trillion dollar market, NVIDIA’s stock rose more than 25% to $383.43 owing to an optimistic financial earnings which calls out high chip demand because of the AI boom. The huge numbers are unparalleled and only Apple and Amazon have managed to reach a daily increase of $190 billion in the past.

With a few hiccups in the company’s 30 year journey, their unprecedented growth seems unstoppable. Huang spoke at the keynote for the Computex conference in Taiwan yesterday where he outlined the GPU’s plan for the AI-powered future. From advancing AI compute with Grace Hopper supercomputers, creating autonomous robots with Isaac AMR to powering 5G and 6G in Japan, the company made various announcements at the conference. Huang unveiled DGX GH200, which brings together 256 Grace Hopper chips into a single GPU and also announced their plan to create their own supercomputer called Helios which will utilize 4 DGX GH200 systems linked together.

A couple of months ago, NVIDIA announced its partnership with Google Cloud which will integrate L4 GPU with Vertex AI to help companies build generative AI applications.

The post In 30 years, NVIDIA died almost 3 times appeared first on Analytics India Magazine.

SoftBank, NVIDIA Partners to Build Data Centres in Japan

NVIDIA Collaborates with SoftBank for Generative AI

Taking another step after becoming the 7th company in the world to reach a trillion dollar market cap, NVIDIA has announced its partnership with SoftBank for driving generative AI applications in Japan.

SoftBank’s goal is to build 5G/6G applications with generative AI on NVIDIA’s GH200 Grace Hopper Superchip. These superchips will be used in the data centres that the company is planning to build across Japan, enabling generative AI and wireless applications on a “multi-tenant common server platform, which reduces costs and is more energy efficient”, as explained by the company.

Leveraging NVIDIA’s MGX reference architecture through GH200 Superchips, SoftBank is planning to create breakthroughs in autonomous driving, AI factors, AR, VR, and even digital twins. Apart from AI, the company is also seemingly wanting to invest in the omniverse.

CEO of SoftBank, Junichi Miyakawa, said that the era where society coexists with AI is incoming, and SoftBank aims to provide next-generation social infrastructure for a super-digitalised society in Japan.

Jensen Huang, founder and CEO of NVIDIA, said, “NVIDIA Grace Hopper is a revolutionary computing platform designed to process and scale-out generative AI services.” NVIDIA has been benefitting from the AI race the most all this while by providing hardware services to OpenAI, and now even SoftBank joins in.

SoftBank’s Pursuit of AI

The company has decided to move away from its defensive approach in AI, to cautious offence. SoftBank recently reported a total loss of $32 billion through their SoftBank Vision Fund. Most of the investments through this fund were AI and robotics focused startups. SoftBank’s Robotics arms has also been an industry leader when it comes to delivering industry grade robots.

In recent news, SoftBank Corporation set up a new AI-focused entity with a specific focus on building a product similar to ChatGPT. Miyakawa has gathered 1,000 people from the company to build a Japanese version of ChatGPT. “We are dead positive on ChatGPT,” said Miyakawa.

This was just after Japanese Prime Minister Fumio Kishida pushed the Japanese government to build frameworks for the development of generative AI as early as possible. This is also at the same time when OpenAI’s founder, Sam Altman decided to visit Japan to speak to the Prime Minister about building their office in the country.

The post SoftBank, NVIDIA Partners to Build Data Centres in Japan appeared first on Analytics India Magazine.