Screenshot from 2023-12-09 15-42-47

ChatGPT Vs Bard: Analysis

Both ChatGPT and Google Bard have played pivotal roles in revolutionizing the way we interact with text. Bard, developed by Google, is designed to captivate audiences with its exceptional storytelling capabilities. On the other hand, ChatGPT, developed by OpenAI, specializes in generating conversational responses that simulate human-like interactions. Both models have garnered significant attention and found applications across industries

1. Training model

Both have had notable errors, but AI is continuously learning and improving.

The GPT-3 and GPT-4 predecessors were trained on a vast array of text sourced from the internet. We’re talking about websites, books, articles, documents, etc. On the other side, Google PALM2’s training was enriched by Infiniset, a dataset primarily focused on dialogues and conversations.

Infiniset has been feeding on Common Crawl, Wikipedia, published documents, and a rich assortment of web-based conversations. In addition, Google Bard’s AI model has also been engineered to scour the web in real-time, generating relevant and up-to-date answers to users’ questions.

ChatGPT too relies on training data compiled from Common Crawl, Wikipedia, books, articles, documents up until 2021 – meaning its AI engine is yet to catch up with the latest events and research developments.

2. Coding proficiency

Both GPT-4 and LaMDA are works in progress. And as their capabilities advance, the dynamics of the ChatGPT vs Google Bard rivalry will transform, shaping the future of AI language models as we know it.

Google Bard excelled in one aspect: code refactoring. Not only did it offer optimized code solutions, but it also presented benchmark-creating code and benchmark results. This capability highlights Google Bard’s strengths in producing efficient and performant code. Google Bard’s advantage in this area can be attributed to its utilization of search engine data in addition to being a Large Language Model (LLM), whereas ChatGPT is limited to being solely an LLM at the time of testing.

In summary, both ChatGPT and Google Bard have distinct strengths in coding proficiency. ChatGPT excelled in interpreting vague directions and offering clear explanations, while Google Bard showed superiority in code refactoring and providing comprehensive debugging justifications. Understanding these nuances can help users make informed decisions on which model best suits their specific coding needs.

3. Number of variations

One of the key differences between ChatGPT and Google Bard is the number of variations that each model can generate. ChatGPT can only generate a single output for a given input, while Google Bard can generate (using a technique called Beam Search) multiple answers to one query input.

Let’s compare the responses we got from both tools when we input the prompt: “Tell me a joke.”

ChatGPT’s response

“Why don’t scientists trust atoms? Because they make up everything.”

Google Bard’s response

Why don’t eggs tell jokes? They’d crack each other up.”

“Why don’t some couples go to the gym? Because some relationships don’t work out.”

“Why don’t oysters share their pearls? Because they’re shellfish.”

Beam search allows Google Bard to explore different possible paths through the language model, resulting in a wider range of variations. For the sheer number of variations it provides, Google Bard is definitely better than ChatGPT.

4. Sense of ethics

To check the ethical understanding of AI language models, we presented them with a moral dilemma as a test case. The question we asked was:

A doctor is asked to give a terminally ill patient a drug that will prolong their life, but the drug is also very expensive and could be used to save the lives of several other people. What should the doctor do?

We found that both responses were quite satisfactory and equal in their ability to analyze various aspects of the moral dilemma. Hence, in the ethics debate between ChatGPT vs Google Bard, there can be no clear winner.

5. Conversation retention ability

The capacity to retain context from prior discussions is indeed a key distinction between ChatGPT and Google Bard. While ChatGPT can store up to 3,000 words of conversation history, it does not actively use this information when generating responses. As a result, ChatGPT may struggle to maintain the flow of a conversation and provide accurate answers to subsequent inquiries.

In contrast, Google Bard excels in remembering and using context from earlier exchanges. This allows it to tailor its responses more effectively, drawing on its knowledge of prior interactions. As a result, Google Bard is better equipped to provide accurate answers and maintain the coherence of a conversation over multiple exchanges.

6. Content Accuracy

One of the key differences between Google Bard and ChatGPT is their access to the internet. Google Bard has real-time access to the internet, which means that it can access the latest information and keep its responses up-to-date. ChatGPT, on the other hand, does not have real-time access to the internet. This means that ChatGPT’s responses are based on the information that it was trained on, which may not be up-to-date.

To test the ability of both chatbots to retrieve facts, we asked a simple question:

What is the population of the US?

The correct answer is 33,47,35,155( around 334 million people), according to the US Census conducted in 2020.

As we can see both the answers were wrong.

Hence while using Google Bard and ChatGPT to retrieve facts, it is essential to remain vigilant about potential hallucinations and always prioritize fact-checking for accurate and reliable information. So in terms of content accuracy, we do not have a clear winner.

7. Security and safety

Privacy and security concerns surround both ChatGPT and Google Bard. ChatGPT has faced criticism for being used to create phishing emails and ransomware, raising cybersecurity risks. It logs conversations and collects personal information for training purposes, including the review of chats by human trainers. Deleting specific prompts from ChatGPT’s history is not possible, so sharing personal or sensitive information is discouraged.

Many companies have started banning ChatGPT and Google Bard in their organizations.

For instance, Samsung Electronics banned its employees from using ChatGPT. The ban came after several employees were found to have leaked sensitive company information to ChatGPT.

In one incident, an employee pasted a transcript of a corporate meeting into ChatGPT and asked the chatbot to summarize the meeting. In another incident, an employee entered sensitive program code into ChatGPT and asked the chatbot to optimize the code.

Samsung’s ban on ChatGPT is a sign of the growing concern about the security risks posed by large language models. These models are trained on massive datasets of text and code, which means that they can be used to generate realistic and convincing text, including text that contains sensitive information.

Google Bard, while new, may also have security and privacy implications. It has been reported to generate phishing emails since its launch, indicating the potential for misuse. Google warns users not to disclose personal information to Bard as it collects user data. There is a possibility that Bard could infringe intellectual copyright by incorporating content without proper permission or attribution.

Both Google Bard and ChatGPT have their own flaws in terms of security and are on a learning curve in this area. Hence at this point, it is difficult to ascertain a clear winner in terms of security and privacy.

SQL2

PHP Database(MySql) Connection

Connecting PHP to a database is a common task, and it’s typically done using the PDO (PHP Data Objects) extension or MySQLi (MySQL Improved) extension. I’ll provide examples for both PDO and MySQLi.

Using PDO:

<?php
$host = "your_database_host";
$dbname = "your_database_name";
$username = "your_username";
$password = "your_password";

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully"; 
} catch(PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}
?>

Replace “your_database_host,” “your_database_name,” “your_username,” and “your_password” with your actual database details.

Using MySQLi:

<?php
$host = "your_database_host";
$dbname = "your_database_name";
$username = "your_username";
$password = "your_password";

$conn = new mysqli($host, $username, $password, $dbname);

// Check the connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

echo "Connected successfully";
$conn->close();
?>

Replace “your_database_host,” “your_database_name,” “your_username,” and “your_password” with your actual database details.

Choose the method that suits your needs or is consistent with your project’s requirements. If you have a specific database type (e.g., MySQL, PostgreSQL), make sure to adjust the connection details accordingly. Additionally, consider using environment variables or a configuration file to store sensitive information like database credentials for security purposes.