Skip to content

Instantly share code, notes, and snippets.

View marklin-latte's full-sized avatar

MarkLin marklin-latte

View GitHub Profile
![https://ithelp.ithome.com.tw/upload/images/20251005/20089358Eui0deSxc3.png](https://ithelp.ithome.com.tw/upload/images/20251005/20089358Eui0deSxc3.png)
在上一篇文中,我們有從這篇論文中有提到兩種 RAG Post-Retrieval 的主要方向分別為 :
- Reranking
- Context Compressing
[Retrieval-Augmented Generation for Large Language Models: A Survey](https://arxiv.org/pdf/2312.10997)
然後接下來我們就要說說 `Context Compressing` 的手法。
// Bug Version
function createArrayOfFunctions(y) {
var arr = [];
for(var i = 0; i<y; i++) {
arr[i] = function(x) { return x + i; } // <=== the i is bug ! the i will always be y+1;
}
return arr;
}
#include <iostream>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <vector>
#include <unordered_map>
using namespace std;
#include <iostream>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <vector>
using namespace std;
/**
function g(n){
let res = 0;
for (let i=1; i <= n; i++){
let temp = i;
while(temp != 0){
let digit = temp % 10;
if(digit == 7){
res++;
break;
}
@marklin-latte
marklin-latte / .cpp
Created April 21, 2019 08:44
148. Sort List
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
@marklin-latte
marklin-latte / .cpp
Created April 21, 2019 08:08
Leetcode 133 clone graph (c++)
/*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> neighbors;
Node() {}
Node(int _val, vector<Node*> _neighbors) {
public class Solution {
public int result;
/**
* @param amount: a total amount of money amount
* @param coins: the denomination of each coin
* @return: the number of combinations that make up the amount
*/
public int change(int amount, int[] coins) {
// write your code here
if(coins == null || coins.length == 0 ){
@marklin-latte
marklin-latte / coinchane.js
Created January 7, 2018 08:42
322. Coin Change
/**
* @param {number[]} coins
* @param {number} amount
* @return {number}
*/
var coinChange = function(coins, amount) {
// Using the greedy method. (Finding the maximum benefit.)
// 1. First, we should select the maximum denomination.
// 2. then, we should select the second largest coin.
@marklin-latte
marklin-latte / binaryTreePaths.js
Last active January 7, 2018 08:44
#257 Binary Tree Paths
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {string[]}