-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '81faeed8832b8ad821622f3f19974e857e8281c0'
- Loading branch information
Showing
9 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+47.9 KB
00_fleeting/assets/explaining-gradient-descent-with-a-simple-analogy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions
55
...eeting/explaining-gradient-descent-in-machine-learning-with-a-simple-analogy.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
tags: | ||
- ai | ||
- LLM | ||
- machine-learning | ||
title: "Explaining Gradient Descent in Machine Learning with a simple analogy" | ||
date: 2024-06-25 | ||
description: Gradient descent is a fundamental optimization algorithm in machine learning. It's a way for models to learn from data and improve their accuracy by gradually adjusting their internal settings. Think of it like carefully descending a hill to find the lowest point—each small step you take brings you closer to the best possible solution. | ||
authors: | ||
- innno_ | ||
--- | ||
|
||
Gradient descent is a fundamental optimization algorithm in machine learning. It's a bit like finding your way down a mountain in the fog: you take small steps in the direction that seems to be going downhill the fastest. | ||
|
||
In machine learning, the "mountain" is a mathematical function, and the "downhill direction" helps us find the best values for our model's parameters. | ||
|
||
### Imagine you're sliding down a hill to find the lowest point | ||
**The Hill** | ||
|
||
Imagine you’re standing on a hill. The hill has many ups and downs, and your goal is to find the lowest point in the hill, where there’s a treasure hidden. | ||
|
||
**Your Steps** | ||
|
||
1. **Starting Point**: You start somewhere on the hill. You don't know if it's the lowest point, but you’re going to find out. | ||
|
||
2. **Looking Around**: You look around to see which direction the ground slopes downward. This tells you which way to go to get closer to the lowest point. | ||
|
||
3. **Taking a Step**: You take a small step down the hill in that direction. | ||
|
||
4. **Repeat**: After taking a step, you look around again, see which way is down, and take another small step. You keep doing this until you reach the lowest point where you can’t go down any further. | ||
|
||
### In Machine Learning | ||
**1. The Hill**: Represents the error or how wrong the computer’s guesses are when trying to learn something (like recognizing cats and dogs). | ||
|
||
**2. Lowest Point**: Represents the best possible way the computer can learn from the data, minimizing errors. | ||
|
||
**3. Steps**: Each small step you take is like the computer adjusting its guesses a little bit each time to improve its learning. | ||
|
||
**4. Looking Around:** The computer checks how it’s doing and decides which way to adjust its guesses to make fewer mistakes. | ||
|
||
**5. Repeat:** The computer keeps adjusting its guesses little by little until it finds the best way to learn from the data, which is like you reaching the lowest point on the hill. | ||
|
||
![](assets/explaining-gradient-descent-with-a-simple-analogy.png) | ||
|
||
### Gradient Descent in simple terms | ||
- **You:** The computer trying to learn. | ||
- **Hill:** The error in guesses. | ||
- **Lowest Point:** Best learning with the least errors. | ||
- **Steps:** Small adjustments to improve guesses. | ||
- **Looking Around:** Checking which way reduces errors the most. | ||
|
||
Just like you keep stepping down the hill to find the treasure, the computer keeps adjusting its guesses to learn better and make the fewest mistakes. | ||
|
||
### Reference | ||
https://medium.com/onfido-tech/machine-learning-101-be2e0a86c96a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
tags: | ||
- ai | ||
- prompt | ||
title: "How to talk to ChatGPT effectively" | ||
date: 2024-06-21 | ||
description: This post presents technique to improve the your output when prompting ChatGPT. | ||
authors: | ||
- minh_cloud | ||
--- | ||
ChatGPT, an advanced language model by OpenAI, offers a unique way to interact with AI. The quality of results depends on the information and how well you craft your input. Then, it’s essential to understand how to talk with ChatGPT effectively. | ||
|
||
## How can you talk with ChatGPT? | ||
Start by entering a message or prompt to begin the conversation. It's like a text-based chat with another person, but your interlocutor is AI. A prompt can include instructions, questions, context, inputs, or examples. Using these elements effectively can improve the quality of the results. | ||
|
||
## How AI responds to the prompts? | ||
AI systems like ChatGPT, Claude, and Gemini use natural language processing and machine learning. This allows them to understand conversational prompts, making the quality of the prompt crucial for the output's relevance and quality. | ||
|
||
To effectively communicate and maximize the potential of ChatGPT, you need some strategies: | ||
|
||
1. **Understand Your Objective**: Clearly define what you want to achieve with your prompt. Is it information, creativity, or problem-solving? | ||
2. **Keep It Clear and Concise**: Avoid overly complex or vague prompts. Clarity leads to better AI responses. | ||
3. **Context Matters**: Provide enough background for the AI to understand the scenario but avoid unnecessary information. | ||
4. **Experiment and Iterate**: Don’t hesitate to refine your prompts based on the responses you get. Iteration is key to finding the most effective wording. | ||
5. **Consider Your Audience**: Tailor your prompt based on who will interact with or benefit from the AI’s response. | ||
6. **Evaluate and Adapt**: Continuously assess the effectiveness of your prompts and be ready to adapt as needed. | ||
|
||
Here are two examples of prompt input for thesis topic about DeFi, and the resulting output from ChatGPT. It is obvious that instead of listing like the output of prompt 1, that of prompt 2 provides more valueable and usable information. | ||
|
||
![](https://i.postimg.cc/DwcdFp24/COMPARE.png) | ||
|
||
What make the difference of these two? | ||
|
||
## What are 5 principles of an effective prompt? | ||
### Give Direction | ||
The direction should describe the desired style in detail, or reference a relevant persona. You can design effective prompts for various simple tasks by using commands to instruct the model what you want to achieve, such as "Write", "Classify", "Summarize", "Translate", "Order", etc. You should also provide the context, which includes specifying a particular time period, geographical location, the role you want to play, or any other relevant limitations. | ||
|
||
### Specify Format | ||
Be very specific about the instruction and task you want the model to perform. The more descriptive and detailed the prompt is, the better the results. This is particularly important when you have a desired outcome or style of generation you are seeking. | ||
|
||
Define what rules to follow, and the required structure of the response. | ||
|
||
### Provide Examples | ||
Using prompts and examples can enhance the clarity of your question and guide Chat GPT in understanding the desired output. By providing sample inputs or expected formats, you can communicate your expectations effectively and receive more tailored responses. | ||
|
||
![](https://i.postimg.cc/ZnbnZHjj/prompt-1.png) | ||
|
||
### Evaluate Quality | ||
You need to identify errors and rate responses, testing what drives performance. | ||
|
||
### Divide Labor | ||
You should split tasks into multiple steps, chained together for complex goals. | ||
|
||
![](https://i.postimg.cc/sX9xtqPv/Clean-Shot-2024-06-11-at-17-07-19-2x.png) | ||
|
||
## Prompt Pattern | ||
### Output customization | ||
**1. Give persona** | ||
- **Use case**: Get better outputs by simulating an expert or specific role. | ||
- **Structure and Key Ideas:** | ||
- Act as persona X and provide outputs that they would create. | ||
- Explain <term> for <personaX> | ||
- Example | ||
- Explain the value chain model for a business freshman. | ||
- Please list all of the Defi topic that business student can use for bachelor thesis. | ||
|
||
**2. Give template** | ||
- **Use case**: Get the output in a specific structure | ||
- **Structure and Key Ideas:** Provide a template with placeholders for ChatGPT to fill in. | ||
- **Example**: Please list all of the Defi topic that business student can use for bachelor thesis. Each topic you propose must include the problems that the thesis solve, the data that the thesis would use.Return the results in this format: | ||
- Topic name: [Topic name] | ||
- Problem: [List of problems] | ||
- Data need: [List of data metrics] | ||
- Output | ||
|
||
![template.png](https://i.postimg.cc/Xv5pgppK/template.png) | ||
|
||
**3. Provide Recipe** | ||
- **Use case**: When you want achieve a specific end result in a provided sequence of steps. | ||
- **Structure and Key Ideas**: | ||
- Specify the desired outcome and any known constraints or partial information. | ||
- **Example pattern**: Provide step-by-step recipe to <do something>: <list your self-defined sequence of steps> | ||
- **Example**: Provide a step-by-step data analysis recipe to study the factors that affect employee satisfaction: 1. Identify problems 2. Data Collection 3. Data Cleaning 4. Data Analysis 5. Data Visualization. | ||
- **Output** | ||
|
||
![](https://i.postimg.cc/mgJPMQ22/recepie.png) | ||
|
||
### Context control | ||
- **Use case**: When you want to maintain and manage the context of the conversation to ensure coherence and relevance in ongoing interactions. | ||
- **Structure and Key Ideas:** Instruct ChatGPT to remember specific details from the conversation and use them in future responses. | ||
- **Example**: Please remember for every the data analysis request I want to solve by using R. | ||
|
||
### Interaction | ||
- **Use case**: You allow ChatGPT to drive the interaction, ensuring that it gathers all necessary information to provide a comprehensive response. | ||
- **Structure and Key Ideas:** Instruct ChatGPT to ask a series of questions aimed at achieving a specific outcome. | ||
- **Example**: From now on, I would like you to ask me questions to diagnose and solve a computer performance issue. Please ask question once at a time. When you have enough information, provide a summary of the problem and a solution. For example, 'Is your computer running slow all the time or only during certain activities? | ||
|
||
- ![](https://i.postimg.cc/sDfGRjNy/Clean-Shot-2024-06-21-at-14-02-56-2x.png) |
Binary file added
BIN
+25 KB
...assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-1.webp
Binary file not shown.
Binary file added
BIN
+33.4 KB
...assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-2.webp
Binary file not shown.
Binary file added
BIN
+4.75 KB
...assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-3.webp
Binary file not shown.
Binary file added
BIN
+9.72 KB
...assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-4.webp
Binary file not shown.
Binary file added
BIN
+73.8 KB
...assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-5.webp
Binary file not shown.
73 changes: 73 additions & 0 deletions
73
.../dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
tags: | ||
- blockchain | ||
- solana | ||
- amm | ||
title: Dynamic Liquidity Market Maker - a new form of concentrated liquidity AMM on Solana | ||
date: 2024-06-21 | ||
description: a new form of concentrated liquidity AMM on solana | ||
authors: | ||
- huymaius | ||
--- | ||
|
||
![](assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-1.webp) | ||
|
||
## Introduction | ||
Dynamic Liquidity Market Maker (DLMM) is a new form of concentrated liquidity AMM on Solana, developed to make it easier and more sustainable for users and project teams to provide broader, deeper liquidity on Solana. DLMM aim to improve LP profitability with dynamic fees, allow new tokens to bootstrap their liquidity in new creative ways, and allow LPs a broader array of LP strategies and more precise liquidity concentration. | ||
|
||
![](assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-2.webp) | ||
|
||
## Technical Overview of DLMM | ||
The DLMM allows liquidity providers to contribute to discrete liquidity bins, enabling them to specify buy or sell orders for token pairs at predetermined prices. Essentially, the DLMM's liquidity pools consist of numerous price-specific bins filled with tokens by LPs. Trading within these pools transitions sequentially from one bin to another as tokens are exchanged, ensuring continuous market operation. | ||
|
||
### DLMM Bin Price | ||
Liquidity is distributed across discrete bins with a fixed width and fixed price. Within each bin, liquidity can be exchanged at a fixed price **X + Y = k** within each bin. Basically you add **X** tokens and take out **Y** tokens (or vice versa), until there is only just one type of token left. | ||
|
||
Each bin represents a single price point, and difference between 2 consecutive bins is the bin step. Bin steps are calculated based on the basis points set by the pool creator. For example, taking SOL/USDC. If the current price is $20 and the bin step is 25 basis points (0.25%), then the consecutive bins would be 20 x 1.0025 = 20.05, 20.05 * 1.0025 = 20.10 and so on. | ||
|
||
### Bin Liquidity | ||
Liquidity in each bin is calculated by the constant sum price variant, `𝑃.𝑥+𝑦=𝐿`, where ***x*** is the quantity of token **X**, ***y*** is the quantity of token **Y**, **L** is the amount of liquidity in the bin and `𝑃=Δ𝑦/Δ𝑥`. **P** is defined as the rate of change of **Y** reserves per change in **X** reserves, and is a price constant unique to each pool. | ||
|
||
**P** can be visualized as the gradient of the line in the following image: | ||
|
||
![](assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-3.webp) | ||
|
||
### Market Aggregation | ||
The constant sum curve intercepts both the **x** and **y** axes, meaning that the reserves of **X** or **Y** token can be exhausted. When this happens, the current price would move to the next bin either on the left or right. | ||
|
||
Active price bin is defined as the bin that contains reserves of both **X** and **Y**. Note that there can only be one active bin at any point in time. All bins to the left of the active bin will only contain token **Y**, while all bins to the right of it will only contain token **X**. | ||
|
||
![](assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-4.webp) | ||
|
||
## Differences Over Other Models | ||
### Over AMMs | ||
DLMMs offer a number of benefits over traditional automated market makers (AMMs): | ||
|
||
- Reduced slippage: By concentrating liquidity in a specific price range, DLMMs reduce the amount of slippage that traders experience. | ||
- Improved capital efficiency: DLMMs allow liquidity providers to deposit their assets into specific price bins, which makes better use of their capital. | ||
- Deeper liquidity: DLMMs can provide deeper liquidity for asset pairs, even those with low trading volume. | ||
- Improved LP profitability: Dynamic fees allow LPs to make more money on market volatility | ||
|
||
### Over CLMMs | ||
![](assets/dynamic-liquidity-market-a-new-form-of-concentrated-liquidity-amm-on-solana-5.webp) | ||
|
||
## Advantages of DLMM | ||
DLMM offers several benefits but the main ones include: | ||
|
||
**Zero Slippage**: Trading within an active bin has zero slippage or price impact. This makes it easier for LPs to concentrate their liquidity even further and capture more volume and fees than they could before. | ||
|
||
**Higher capital efficiency:** DLMM offers zero slippage for swaps within the same bins. Further, it also supports lower liquidity requirements and higher volume of trading as liquidity is concentrated on the market value. | ||
|
||
**Better profitability and flexibility:** LPs can create richer and more precise strategies by creating liquidity shapes that suit their need. Profitability is also increased as LPs earn a base fee as well as a variable fee when price actions become more volatile, causing the DLMM to switch bins. | ||
|
||
## What’s next? | ||
Today, Jupiter is leveraging the DLMM model in its Launchpad, there are many project using Jup Launchpad such as: | ||
|
||
- [Jupiter](https://jup.ag/) - Top DEX aggregator in crypto. | ||
- [Zeus Network](https://zeusnetwork.xyz/) - Permissionless communication layer connecting. Solana and Bitcoin. | ||
- [Uprock](https://uprock.com/) - The premier DePIN network fueling AI | ||
|
||
In addition, users can create a new pool or add liquidity to the existing DLMM pool to earn fees by visit [Meteora DLMM pools](https://app.meteora.ag/dlmm). | ||
|
||
## References | ||
https://docs.meteora.ag |