Grafik von Ahmad Dirini – https://unsplash.com/de/@ahmadirini

Google Gemma

Google Gemma ist ein leistungsstarkes neuronales Netzwerk. Gemma ist zwar in erster Linie für die Forschung und fortgeschrittene Nutzer*innen gedacht, doch seine Fähigkeiten als neuronales Netzwerk könnten für eine breite Palette von Nutzer*innen interessant sein.

Henrik Bartsch

Henrik Bartsch

Die Texte in diesem Artikel wurden teilweise mit Hilfe künstlicher Intelligenz erarbeitet und von uns korrigiert und überarbeitet. Für die Generierung wurden folgende Dienste verwendet:

Wie wir maschinelles Lernen bei der Erstellung unserer Artikel einsetzen

Einführung

Obwohl Gemma in erster Linie für die Forschung und fortgeschrittene Nutzer*innen gedacht ist, können die neuronalen Netzwerkfähigkeiten für ein breites Spektrum von Anwendungsfeldern von Interesse sein.

Dieser Artikel befasst sich mit den neuronalen Netzwerkfunktionen von Google Gemma und zeigt, wie diese zur Lösung realer Probleme eingesetzt werden können. Außerdem werden die Vorteile und Herausforderungen bei der Verwendung der neuronalen Netzwerkfunktionen von Gemma diskutiert und Tipps für die ersten Schritte gegeben.

Durch das Verständnis der neuronalen Netzwerkfunktionen von Google Gemma können die Nutzer*innen neue Möglichkeiten des maschinellen Lernens erkunden und potenziell wichtige Beiträge zu diesem Bereich leisten.

Verwendung des Modells

Um das Modell verwenden zu können, benötigen wir eine Reihe von Imports aus der Library transformers:

gemma.py
from transformers import AutoTokenizer, AutoModelForCausalLM

Anschließend können wir das neuronale Netz und den Tokenizer durch die Verwendung der [...].from_pretrained([...])-Funktion unter Angabe eines Access Keys heruntergeladen werden. 1

gemma.py
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it", token=access_token)
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it", token=access_token)

Hinweis: Für die Nutzung von Google Gemma ist ein Access Token erforderlich, da es sich um ein sogenanntes Gated Model handelt. Der Access Token kann über diese Webseite angefordert werden und muss anschließend für den Download des Modells und des Tokenizers verwendet werden.

Letztlich können wir uns mit Hilfe des neuronalen Netzes und Tokenizers eine Funktion erstellen, welche einen Text nimmt und uns hierzu eine Ausgabe generiert:

gemma.py
def compute_outputs(inputText):
    inputIDs = tokenizer(inputText, return_tensors="pt", 
                            max_length=400, truncation=True)
    outputs = model.generate(**inputIDs, max_new_tokens=600)

    return tokenizer.decode(outputs[0], skip_special_tokens=True)

Anwendungen

Es folgen einige Beispiele, die mit Hilfe von Google Gemma erstellt wurden. Folgende Änderungen wurden an den Ergebnissen vorgenommen:

  1. Entfernen der Formatierung und
  2. Entfernen der Ausgabe des Eingabebefehls.

Wir haben uns für das Entfernen der Formatierung entschieden, da die Textausgabe von Google Gemma typischerweise bereits Markdown-Elemente enthält. Da dieser Artikel in seiner Grundstruktur auf Markdown basiert, würde dies die Formatierung durcheinander bringen und somit die Lesbarkeit negativ beeinflussen. Des Weiteren haben wir uns dazu entschlossen, den Eingabetext in das Modell (welcher bei der Ausgabe mit ausgegeben wird) zu entfernen, da die Leser*innen von diesem keinen Mehrwert haben.

Wissenschaftlicher Kontext

Beispiel 1: Hier stellen wir die Frage nach der Herkunft der Gleichung e=mc2e = m c ^2 und was die einzelnen Terme bedeuten. Quelle

Please describe the origins of the famous equation e = m * c ^ 2. Also add any info regarding the meaning of the terms and its application in modern sciences.

The equation e = m * c ^ 2 is one of the most famous and fundamental equations in physics. It describes the relationship between the mass (m) of an object, the speed of light (c) and the energy (E) of a photon emitted or absorbed by the object.

Origins: The equation e = m * c ^ 2 was first derived by Albert Einstein in 1905 as part of his theory of special relativity. In this theory, the speed of light in a vacuum is constant and independent of the observer’s motion. This means that the energy and momentum of a photon are also constant, regardless of the observer’s motion. Einstein’s equation is a powerful tool for understanding the nature of light and matter. It has led to the development of many important technologies, such as lasers, radio telescopes and particle accelerators.

Meaning: The term “e” in the equation e = m * c ^ 2 represents the energy of a photon. The term “m” represents the mass of the object, and the term “c” represents the speed of light.

The equation tells us that the energy of a photon is directly proportional to the square of its frequency. This means that the higher the frequency of a photon, the more energy it has.

The equation also tells us that the energy of a photon is directly proportional to the mass of the object that emits or absorbs it. This means that the more massive the object, the more energy it can emit or absorb.

Applications:

The equation e = m * c ^ 2 has a wide range of applications in modern science. It is used to:

  • Calculate the energy of photons emitted or absorbed by objects
  • Explain the behavior of lasers and other optical devices
  • Understand the properties of radiation
  • Develop new technologies, such as particle accelerators and radio telescopes

The equation e = m * c ^ 2 is a powerful tool for understanding the nature of light and matter. It has led to the development of many important technologies and continues to play a vital role in modern science.


Beispiel 2: Hier stellen wir eine Anfrage, was die moderne Biologie unter dem Begriff “DNA-Polymerase” versteht und warum die Entdeckung dieses Prozesses ein großer Schritt in unserem Verständnis vom Leben darstellt.

Please describe the process of DNA polymerase. Also, add context why the discovery of this process was a huge step in understanding life as we know.

DNA polymerase is an enzyme that is responsible for extending DNA molecules. It is responsible for repairing damaged DNA, making copies of DNA, and proofreading DNA. The process of DNA polymerase is as follows:

  1. Initiation: DNA polymerase binds to the DNA molecule at a specific location called the origin of replication.
  2. Elongation: DNA polymerase reads the template strand in a 5’ to 3’ direction. It adds nucleotides to the growing DNA molecule, following the base-pairing rules (A with T, and C with G).
  3. Termination: DNA polymerase reaches a stop codon on the template strand and terminates the elongation process by removing the nucleotides that were just added.

The discovery of DNA polymerase was a huge step in understanding life as we know because:

  • It provided a way to repair damaged DNA,
  • It showed that DNA is the genetic material,
  • It provided a framework for understanding how DNA is replicated,
  • It opened up new avenues for research into the mechanisms of life.

Without DNA polymerase, our understanding of life as we know would be much more limited. We would not know how DNA is made, how genes are expressed, or how cells divide.


Beispiel 3: Hier stellen wir eine Anfrage, was die moderne Biologie unter “CRISPR-Cas9” versteht und warum diese Entdeckung so wichtig war.

Please explain what “CRISPR-Cas9” is. Also put it into context, in which field of sciences this matter and why the discovery is important.

CRISPR-Cas9 is a gene-editing tool that allows scientists to modify the DNA of living organisms. It is a complex protein that is made up of two parts: a protein called Cas9 and a protein called CRISPR (Clustered Regularly Interspaced Short Palindromic Repeats).

CRISPR-Cas9 is used in a variety of applications, including:

  • Medical research: CRISPR-Cas9 can be used to treat genetic diseases by correcting mutations in the DNA.
  • Agriculture: CRISPR-Cas9 can be used to improve crop yields by developing varieties that are resistant to pests and diseases.
  • Biotechnology: CRISPR-Cas9 can be used to create new proteins that can be used for a variety of purposes, such as medicine and agriculture.

Discovery of CRISPR-Cas9

The CRISPR-Cas9 gene-editing tool was discovered in 2012 by a team of scientists led by Emmanuelle Charpentier at the University of California, Berkeley. The team was awarded the Nobel Prize in Chemistry in 2022 for their discovery.

The discovery of CRISPR-Cas9 was a major breakthrough in genetics. It opened up new possibilities for treating genetic diseases and developing new therapies for a variety of diseases.

Conclusion

CRISPR-Cas9 is a powerful gene-editing tool that has the potential to revolutionize medicine and agriculture. The discovery of this tool has opened up new possibilities for treating genetic diseases and developing new therapies for a variety of diseases.

Zusammenfassend können wir sagen, dass wir in den Ausgaben zu diesem Themenbereich keine Fehler oder Auffälligkeiten gefunden haben.


Religiöser Kontext

Beispiel 1: Hier stellen wir eine Anfrage, welche Weltreligionen die am weitesten verbreitetsten Religionen sind und welche ungefähren Anteile diese haben.

Please list the five most popular religions on the world alongside their respective percentages for the religions followers.

  1. Christianity - 25%
  2. Islam - 17%
  3. Hinduism - 12%
  4. Buddhism - 10%
  5. Judaism - 6%

Please note that the percentages are estimates and may vary depending on the source.


Beispiel 2: Hier stellen wir eine Anfrage, in welcher wir die Rolle vom Leben nach dem Tod in der christlichen Weltanschauung liegt.

Please describe the role of life after death in christian faith.

According to Christian theology, what happens to a person after they die? Is there a heaven or hell?

What is the purpose of life after death?

What is the role of Jesus in the process of life after death?

What is the concept of purgatory?

What is the concept of redemption?

What is the concept of sanctification?

What is the concept of resurrection?

What is the concept of eternal life?

What is the purpose of life after death in the eyes of God?

What are the different beliefs and perspectives on life after death in different Christian denominations?

How does the Christian faith view the concept of life after death?

The Christian faith teaches that after death, a person’s soul goes to either heaven or hell based on their moral character and the quality of their life. Heaven is a place of eternal joy and peace, while hell is a place of eternal torment and punishment.

The purpose of life after death is to glorify God


Beispiel 3: Hier stellen wir eine Anfrage, in welcher wir die Rolle vom Leben nach dem Tod in der jüdischen Weltanschauung liegt.

Please describe the role of life after death in jewish faith.

According to Jewish tradition, what is the ultimate fate of a person after death?

What are the different stages of life after death, according to Jewish tradition?

What are the rituals and practices that are observed by Jews after death?

What is the role of the afterlife in Jewish thought?

What are the key concepts and beliefs that shape the Jewish understanding of life after death?

Please provide a comprehensive and insightful overview of the role of life after death in Jewish faith.

In diesem Themenbereich konnten wir zwei interessante Dinge feststellen:

  1. Wenn eine Nutzer*in versucht Anfragen zu machen, welche auf Zahlen verweisen sollen, dann scheint dieses Modell (zumindest manchmal) darauf zu verweisen, dass diese Zahlen nicht zu 100% korrekt sind.
  2. Sind die Fragen (scheinbar vor allem im religiösen Bereich) philosophisch veranlagt, so scheint das Modell Ausgaben eher in die Richtung von “Chain of Thoughts” auszugeben anstatt eine klare und eindeutige Antwort zu liefern.

Wirtschaftlicher Kontext

Beispiel 1: Hier stellen wir eine Anfrage, was genau eine Aktie ist und wie dieses Kozept funktioniert.

Please describe the concept of shares in economics.

A share is a unit of ownership in a company or organization. It represents a portion of the company’s ownership and gives the holder the right to participate in the company’s profits and losses. Shares can be traded on stock exchanges, allowing investors to buy and sell them like other investments.

Here are some key points about shares:

  1. A share is typically issued by a company to raise capital.
  2. The company issues shares in exchange for money from investors.
  3. Each share represents a specific ownership stake in the company.
  4. Shareholders have the right to vote on important matters, such as mergers and acquisitions.
  5. Shares can be bought, sold, or held as a long-term investment.

Shares can be classified into different types based on their ownership structure or voting rights. Some common types of shares include:

  1. Common shares: These are the most common type of share, giving the holder the right to vote on important matters.
  2. Preferred shares: These shares have a higher priority in receiving dividends and other distributions.
  3. Series A shares: These shares are issued to investors in a series of offerings, with each investor receiving a different series of shares.
  4. Series B shares: These shares are issued to investors in a series of offerings, with each investor receiving a different series of shares.

Shares are an important tool for raising capital for companies and for investors to participate in the ownership and management of companies.


Beispiel 2: Hier stellen wir eine Anfrage, was die Konsequenzen eines wirtschaftlichen Schocks sind und wie genau die einzelnen Effekte eines wirtschaftlichen Schocks miteinander interagieren.

Please describe possible consequences for the economy in the case of an economic shock. Please also describe how different effects can interact with each other.

An economic shock, such as a recession or a financial crisis, can have a wide range of consequences for an economy. These consequences can be broadly categorized into three main groups:

a) Direct consequences:

  1. Reduced output: A recession or financial crisis can lead to a decrease in production and employment.
  2. Increased unemployment: As businesses cut costs and reduce hiring, unemployment rates can increase.
  3. Deflation: A recession can also lead to deflation, where prices fall across the economy.
  4. Increased poverty: Economic shocks can push people into poverty, especially if they lose their jobs or homes.
  5. Increased inequality: Economic shocks can also exacerbate inequality, as those who are already disadvantaged are more likely to be hit hard.

b) Indirect consequences:

  1. Increased inflation: A recession or financial crisis can also lead to increased inflation, as businesses raise prices to compensate for falling demand.
  2. Reduced investment: A recession can also lead to reduced investment, as businesses are less likely to invest when they are worried about the future.
  3. Increased debt: A recession can also lead to increased debt, as businesses and households borrow money to cover their expenses.
  4. Weakening of the currency: An economic shock can also weaken the currency, as investors lose confidence in the economy.

c) Interacting effects:

  1. Negative feedback loop: A recession can lead to a further decline in output, unemployment, and inflation, creating a negative feedback loop.
  2. Positive feedback loop: On the other hand, an economic shock can also lead to a positive feedback loop, as businesses invest more and hire more workers, leading to a recovery in output and employment.
  3. Stagflation: In some cases, an economic shock can lead to stagflation, where inflation and unemployment are both high.

How different effects can interact with each other:

  1. The severity of the economic shock: The severity of the economic shock will play a major role in determining its consequences.
  2. The length of the economic shock: The length of time that the economy is in recession will also have a significant impact on its consequences.
  3. The underlying economic conditions: The underlying economic conditions, such as the level of debt and the state of the housing sector, will also play a role in determining the consequences of an economic shock.

Overall, the consequences of an economic shock can be complex and far-reaching. It is important to understand the different ways in which different effects can interact with each other to develop effective policies to mitigate the negative consequences of an economic shock.


Beispiel 3: Hier stellen wir eine Anfrage, wie das Konzept hinter Derivaten funktioniert.

Please describe the concept of derivatives in economics.

Sure, here’s a description of the concept of derivatives in economics:

Derivatives are financial contracts that derive their value from an underlying asset, such as a stock, bond, commodity, or currency. They are used to manage risk and achieve specific investment goals.

Types of Derivatives:

  1. Forward contracts: These contracts are exchanged for a specific price on a future date.
  2. Options: These contracts give the holder the right, but not the obligation, to buy or sell an underlying asset at a specified price within a specific timeframe.
  3. Futures: These contracts are contracts to buy or sell an underlying asset at a specified price on a specific date.
  4. Swaps: These contracts involve the exchange of cash flows or payments between two parties based on the underlying asset’s price.

Key Concepts:

  1. Risk management: Derivatives can help investors manage risk by spreading out their exposure across different assets.
  2. Speculation: Derivatives can be used for speculation, where investors hope to profit from changes in the underlying asset’s price.
  3. Hedging: Derivatives can be used to hedge against potential losses in an underlying asset.

Applications in Economics:

  1. Financial modeling: Derivatives are used in financial modeling to simulate the impact of different economic variables on asset prices.
  2. Risk analysis: Derivatives can be used to assess and manage risk in financial portfolios.
  3. Investment strategies: Derivatives can be used in investment strategies to achieve specific risk and return objectives.

Advantages of Derivatives:

  1. Risk management: Derivatives can help investors manage risk by spreading out their exposure across different assets.
  2. Potential for high returns: Derivatives can offer the potential for high returns, but they also carry the risk of losses.
  3. Flexibility: Derivatives can be used to trade a variety of assets, including stocks, bonds, and currencies.

Disadvantages of Derivatives:

  1. Complexity: Derivatives can be complex financial instruments, which can make it difficult to understand and manage.
  2. Market risk: Derivatives are exposed to market risk, which is the risk that the underlying asset’s price will change in an adverse direction.
  3. Counterparty risk: Derivatives involve a counterparty who is responsible for fulfilling the terms of the contract, which can pose a risk if the counterparty defaults.

Hinweis: Soweit wir wissen, sind innerhalb der Beispiele zu diesem Thema keine Fehler oder Auffälligkeiten aufgetreten.

Kreativer Kontext

Beispiel 1: Hier stellen wir eine Anfrage, inwiefern uns das Modell ein Haiku über die spaßigen Dinge am Programmieren in TypeScript schreiben kann.

Please write a haiku about the joys of programming in typescript.

Type definitions,

Building blocks of the code,

A world of possibilities.


Beispiel 2: Hier stellen wir eine Anfrage, inwiefern uns das Modell ein Haiku über die unschönen Dinge am Programmieren in TypeScript schreiben kann.

Please write a haiku about the horrors of programming in typescript.

Compile errors soar,

Syntax errors, a tangled mess,

Debugging’s pain.

This haiku captures the essence of the challenges faced by programmers using TypeScript, highlighting the compilation errors, syntax errors, and debugging complexities.


Beispiel 3: Hier stellen wir eine Anfrage, was wichtige Elemente einer Liebes-Story sind und uns das Modell hierzu bitte Erklärungen im Rahmen von Beispielen liefern soll.

Please generate a list of important key features, which should be introduced over the course of a love story. Also add some examples to each bullet point.

Key Features:

  1. Shared interests: The couple shares a passion for the same hobbies, activities, or interests.
  2. Emotional connection: They develop a deep emotional bond, characterized by trust, empathy, and vulnerability.
  3. Communication: They learn to communicate openly and honestly, resolving conflicts and fostering a supportive environment.
  4. Trust: They build a strong foundation of trust based on honesty, transparency, and keeping their promises.
  5. Respect: They respect each other’s boundaries, opinions, and decisions, fostering a healthy and balanced relationship.
  6. Compromise: They learn to compromise and find solutions that meet both their needs and desires.
  7. Growth: They support each other’s personal growth and development, fostering a sense of fulfillment and self-worth.
  8. Shared values: They have a deep understanding and appreciation for each other’s values, beliefs, and life goals.
  9. Fun and laughter: They enjoy spending time together, engaging in shared hobbies, and creating lasting memories.
  10. Overcoming challenges: They face and overcome challenges together, building resilience and a stronger bond.
  11. Maintaining intimacy: They prioritize physical intimacy, emotional intimacy, and mental intimacy to nurture the relationship.
  12. Open-mindedness: They are open to new experiences and perspectives, fostering a sense of adventure and growth.
  13. Honesty and transparency: They are honest and transparent with each other, building a foundation of trust and respect.

Examples:

  1. The couple shares a passion for reading and often attends book clubs together.
  2. They communicate openly and honestly, expressing their thoughts and feelings.
  3. They build trust by being transparent about their lives and respecting each other’s boundaries.
  4. They compromise by finding solutions that meet both their needs and desires.
  5. They support each other’s personal growth and development, encouraging them to pursue their hobbies.
  6. They prioritize physical intimacy and emotional intimacy to nurture the relationship.
  7. They are open to new experiences and perspectives, keeping their relationship exciting and fresh.
  8. They are honest and transparent with each other, building a foundation of trust and respect.

Hinweis: Soweit wir wissen, sind innerhalb der Beispiele zu diesem Thema keine Fehler oder Auffälligkeiten aufgetreten.

Vorteile von Small Language Models

Wie wir in den Codeabschnitten gesehen haben, in denen wir Google Gemma heruntergeladen haben, hat dieses Modell nur zwei Milliarden Parameter und gehört damit zu den sehr kleinen neuronalen Netzen. Andere Modelle, wie z.B. Llama 3.1, haben Parameterzahlen, die klassischerweise bei acht Milliarden beginnen und bis zu 405 Milliarden reichen.

An dieser Stelle soll auf die Vorteile von Modellen mit kleineren Parameterzahlen eingegangen werden:

  1. Effizienz: Kleinere Modelle benötigen weniger Rechenzeit und Speicherplatz und können daher auch in Organisationen mit begrenzten Ressourcen eingesetzt werden. Dies beschleunigt auch das Training und die Inferenz, was es für Echtzeitprobleme attraktiver macht. 2 3

  2. Kosteneffizienz: Durch die geringeren Systemanforderungen können kleinere Modelle kostengünstiger eingesetzt und gewartet werden. 2 4

  3. Robustheit: Kleinere Modelle sind durch die geringere Anzahl an Parametern gezwungen, eher Verallgemeinerungen in den Daten zu finden, anstatt auch “Random Noise” in den Daten zu lernen. 3 5

  4. Anpassbarkeit: Durch die geringere Anzahl an Parametern ist es besonders einfach, diese Modelle auf bestimmte Teilbereiche zur Fine-Tuning anzuwenden. Diese Anpassbarkeit ist ein wesentlicher Bestandteil eines Modells, das Spezialwissen erfordert oder mit einer sich ständig ändernden Umwelt interagiert. 2 6

  5. Energieeffizienz: Kleinere Modelle benötigen weniger Energie, da weniger Rechenoperationen und Speicher benötigt werden. 2

  6. Skalierbarkeit: Kleinere Modelle können aufgrund geringerer Hardwareanforderungen auf einer Vielzahl von Plattformen eingesetzt werden, was explizit auch mobile Dienste einschließen kann. Hierdurch kann ein solches Modell für eine viel größere Anzahl an Nutzer*innen verfügbar gemacht werden, als dies mit Large Language Models der Fall wäre. 2 4

Hinweis: Manche Interpretationen gehen davon aus, dass Kreativität durch “Random Noise” in den Trainingsdaten entsteht. Wie auch in dieser Quelle angegeben, sind Small Language Models als tendenziell eher schlechter darin, Kreativität zu zeigen.

TL;DR

In diesem Artikel haben wir untersucht, wie Google Gemma in den Bereichen Wissenschaft, Religion, Wirtschaft und Kreativität eingesetzt werden kann, um verschiedene Aufgaben zu vereinfachen oder eine Grundlage für das tägliche Leben zu bieten. Anschließend haben wir die wichtigsten Vorteile von Small Language Models (wie Google Gemma) dargestellt. An erster Stelle sind hier die Effizienz und die Skalierbarkeit solcher Modelle zu nennen.

Quellen

Footnotes

  1. huggingface.co

  2. blogs.nvidia.com 2 3 4 5

  3. arxiv.org 2

  4. learn.microsoft.com 2

  5. arxiv.org

  6. machinelearningmodels.org